signal handling in child process.
From: micheel drippee (micheel_d23_at_yahoo.com.tr)
Date: 10/30/05
- Previous message: Ivan Voras: "ext2 large_file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Oct 2005 20:10:17 +0200 (EET) To: freebsd-hackers@freebsd.org
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
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: Ivan Voras: "ext2 large_file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|