I m facing problem with this code . When I execute this program it forks 2 process A zombie syslog-ng process on the forked ID syslog-ng on the next pid but without while loop every thing is working properly TIA niraj #include<iostream> #include<unistd.h> using namespace std; int main() { int cpid; cpid=fork(); if(cpid==0) { if(execv( "/usr/local/sbin/syslog-ng" ,NULL)==-1) { cout<<"hello"<<endl; } cout<<"ok"<<endl; } while(1) { ; } return 0; } ~ ~
On Thu, 2005-04-07 at 10:38 +0530, niraj wrote:
I m facing problem with this code . When I execute this program it forks 2 process A zombie syslog-ng process on the forked ID syslog-ng on the next pid
but without while loop every thing is working properly
syslog-ng goes into background automatically, unless you specify the --foreground parameter. syslog-ng becomes a zombie as you don't wait() for it. -- Bazsi
But what parameter I SHOULD GIVE IT RUN TO foreground .I want to run syslog-ng of the forked pid not on the background plz help me Niraj On Thu, 2005-04-07 at 23:20, Balazs Scheidler wrote:
On Thu, 2005-04-07 at 10:38 +0530, niraj wrote:
I m facing problem with this code . When I execute this program it forks 2 process A zombie syslog-ng process on the forked ID syslog-ng on the next pid
but without while loop every thing is working properly
syslog-ng goes into background automatically, unless you specify the --foreground parameter. syslog-ng becomes a zombie as you don't wait() for it.
On Fri, Apr 08, 2005 at 04:27:56PM +0530, niraj wrote:
But what parameter I SHOULD GIVE IT RUN TO foreground .I want to run syslog-ng of the forked pid not on the background
You should be able to figure this one out on your own: # syslog-ng -h Usage: syslog-ng [options] Accept and manage system log messages Options: -s, --syntax-only Only read and parse config file -d, --debug Turn on debugging messages -v, --verbose Be a bit more verbose -F, --foreground Don't fork into background -f <fname>, --cfgfile=<fname> Set config file name, default=/etc/syslog-ng/syslog-ng.conf -V, --version Display version number (syslog-ng 1.6.5) -p <fname>, --pidfile=<fname> Set pid file name, default=/var/run/syslog-ng.pid -C <dir>, --chroot=<dir> Chroot to directory -u <user>, --user=<user> Switch to user -g <group>, --group=<group> Switch to group -y, --yydebug Turn on yacc debug messages -- Nate The best answer when anybody asks you if you're any good with explosives is to hold up two open hands and simply say "Ten".
participants (3)
-
Balazs Scheidler
-
Nate Campi
-
niraj