signal handling in child process.
micheel drippee
micheel_d23 at yahoo.com.tr
Sun Oct 30 10:10:19 PST 2005
hello,
i have a daemon program and installed a
signal_handler() function for it. from signal_handler:
case SIGCHLD:
if ((wait(&status)) == -1) return;
if (WIFSIGNALED(status)) return;
if (WIFSTOPPED(status)) return;
if (WIFEXITED(status)) return;
break;
in child process i am doing a fork() and then execve.
switch((pid = vfork())) {
case -1:
error...
case 0:
execve();
default:
if (wait(&stat) == -1) {
syslog(LOG_ERR, "wait: %s", strerror(errno));
return -1;
}
}
The problem is that: when the executing program is
exited wait() returns error. 'No child processes'
I determined that, my signal handler catchs SIGCHLD
when the process finish. And then waits it. So the
child process cannot wait its own child.
How can i solve this problem? I found a solution but i
am not sure if it is best way.
I ignore SIGCHLD in child before execve.
signal(SIGCHLD, SIG_IGN);
What is your comments.
thank you..
-mch
___________________________________________________________________
Yahoo! kullaniyor musunuz? http://tr.mail.yahoo.com
Istenmeyen postadan biktiniz mi? Istenmeyen postadan en iyi korunma
Yahoo! Posta’da
More information about the freebsd-hackers
mailing list