[Ilugc] problem using popen with xinetd--VERY URGENT
- From: umavichu1@xxxxxxxxx (Uma Viswanathan)
- Date: Thu, 3 Jun 2004 00:27:26 -0700 (PDT)
--0-1538988507-1086247646=:61299
Content-Type: text/plain; charset=us-ascii
Hi Jayakumar,
Thanks for replying.
This should not be a problem, because the code retrieves the username from a
tag in the xml message that is contained in the body of the http request and
does the ps --User for this username. It searches if the particular process is
running for this username retrieved from the message. As I have said, the read
from the pipe opened to the command fails (when the process is run via xinetd)
i.e., returns zero bytes as if the particular process is not running for the
user. However, when run as standalone, the read succeeds and we are able to
correctly determine if the particular process is already running for the
username. The same scenario occurs when I try use system() instead of popen. In
this case also the return value from the system() call is misleading when run
via xinetd but is correct when run as standalone.
My guess is there may be some parameter that we need to set properly in the
xinetd.conf file against this service(which is running our application) which
will enable the popen() or system() to correctly work. If I could get any help
in this angle that is also welcome
Jayakumar KK <kk_jay82@xxxxxxxxxxx> wrote:
Uma Viswanathan wrote: > Hi,
I am currently working on an application that
receives a HTTP
request,processes it and sends back the response.
Part of the
processing involves validation of the user and to
see if the user
is running a particular process (whose name is
hard coded as of
now). To see if the process is being run by the
user, the
application does a popen to the shell command
(which involves doing
a ps --User | cut ..|grep
) and reads the response
from the pipe.
The problem that I am facing is that reading from
the pipe works
fine when the application is run as a standalone,
but when we
register it as a service with xinetd and execute
it, the reading
from the pipe fails. As an alternative, I tried
using system()
command for the above scenario. However, that too
fails when the
application is invoked via inetd. Please offer ur
sugesstions to
overcome this problem...This is VERY URGENT for my
project
completion. Please revert back at the earliest
Hi
I suppose that when u invoke a process thro' xinetd or
other daemons the process is not owned by the user.
hence when u give the ps --User command ur process
wont get listed. try using ps -ax instead of ps
--User.
Thanks
Jayakumar K K
________________________________________________________________________
Yahoo! India Matrimony: Find your partner online.
http://yahoo.shaadi.com/india-matrimony/
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
--0-1538988507-1086247646=:61299
Content-Type: text/html; charset=us-ascii
<DIV>Hi Jayakumar,</DIV>
<DIV> Thanks for replying.</DIV>
<DIV> </DIV>
<DIV> This should not be a problem, because the code retrieves the
username from a tag in the xml message that is contained in the body of the
http request and does the ps --User for this username. It searches if the
particular process is running for this username retrieved from the message. As
I have said, the read from the pipe opened to the command fails (when the
process is run via xinetd) i.e., returns zero bytes as if the particular
process is not running for the user. However, when run as standalone, the read
succeeds and we are able to correctly determine if the particular process is
already running for the username. The same scenario occurs when I try use
system() instead of popen. In this case also the return value from the system()
call is misleading when run via xinetd but is correct when run as
standalone.</DIV>
<DIV> </DIV>
<DIV> My guess is there may be some parameter that we need to
set properly in the xinetd.conf file against this service(which is running our
application) which will enable the popen() or system() to correctly work. If I
could get any help in this angle that is also welcome<BR><BR><B><I>Jayakumar KK
<kk_jay82@xxxxxxxxxxx></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
BORDER-LEFT: #1010ff 2px solid">Uma Viswanathan wrote: > Hi,<BR>> > I
am currently working on an application that<BR>> receives a HTTP<BR>>
> request,processes it and sends back the response.<BR>> Part of
the<BR>> > processing involves validation of the user and to<BR>> see
if the user<BR>> > is running a particular process (whose name is<BR>>
hard coded as of<BR>> > now). To see if the process is being run by
the<BR>> user, the<BR>> > application does a popen to the shell
command<BR>> (which involves doing<BR>> > a ps --User | cut ..|grep
<BR>> ) and reads the response<BR>> > from the pipe. <BR>> >
<BR>> > The problem that I am facing is that reading from<BR>> the
pipe works<BR>> > fine when the application is run as a
standalone,<BR>> but when we<BR>> > register it as a service with
xinetd and execute<BR>&
gt; it,
the reading<BR>> > from the pipe fails. As an alternative, I
tried<BR>> using system()<BR>> > command for the above scenario.
However, that too<BR>> fails when the<BR>> > application is invoked
via inetd. Please offer ur<BR>> sugesstions to<BR>> > overcome this
problem...This is VERY URGENT for my<BR>> project<BR>> > completion.
Please revert back at the earliest<BR>> > <BR><BR>Hi<BR><BR>I suppose
that when u invoke a process thro' xinetd or<BR>other daemons the process is
not owned by the user.<BR>hence when u give the ps --User command ur
process<BR>wont get listed. try using ps -ax instead of
ps<BR>--User.<BR><BR>Thanks<BR>Jayakumar K
K<BR><BR>________________________________________________________________________<BR>Yahoo!
India Matrimony: Find your partner online.
http://yahoo.shaadi.com/india-matrimony/</BLOCKQUOTE><BR><BR><p>
<hr size=1><font face=arial size=-1>Do you Yahoo!?<br>Friends.
Fun. <a href="
http://messenger.yahoo.com/";>Try the all-new Yahoo! Messenger</a>
--0-1538988507-1086247646=:61299--
Other related posts: