[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Daemons - Using the process class?
From: |
Wolfgang Alper |
Subject: |
Daemons - Using the process class? |
Date: |
Wed, 9 May 2007 17:21:38 +0200 |
User-agent: |
KMail/1.9.4 |
Hello,
I am using commoncpp2-1.5.6 under linux.
I tried using the process class but it seems i miss a piece.
Basicallyl i would like to create a daemon (using linux) based on fork.
i thought i would have to call: Process::detach();
From the docs
"Detach current process into a daemon, posix only. Perhaps a similar method
can be used for creating win32 "services"?"
but this cannot work as it is defined as follows:
void Process::detach(void) { attach("/dev/null"); }
So it seems that :
void Process::attach (const char * devname )
"Attach the current process to another device or i/o session. It is
deamonified and dissasociated with the prior parent process and controlling
terminal."
is the better choice.
But i still do not get it to work.
-What to pass as devname?
-How do it get the PID to know wether i am the child or parent?
-How can i pass parameter (like waitpid) to decide wether the parent wants to
wait for the child or not?
I am sure i missunderstood something, so if anyone could give an example on
how to use this class, this would be great.
Thanks
Wolfgang
- Daemons - Using the process class?,
Wolfgang Alper <=