Date: Sun, 30 Oct 2005 20:10:17 +0200 (EET) From: micheel drippee <micheel_d23@yahoo.com.tr> To: freebsd-hackers@freebsd.org Subject: signal handling in child process. Message-ID: <20051030181017.25043.qmail@web26508.mail.ukl.yahoo.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051030181017.25043.qmail>