Date: Fri, 30 May 2003 22:00:18 -0700 (PDT) From: Paul Herman <pherman@frenchfries.net> To: hackers@freebsd.org Subject: Proper behaviour for wait()? Message-ID: <20030530213533.E229-100000@mammoth.eat.frenchfries.net>
next in thread | raw e-mail | index | archive | help
Just curious, anyone know what the "proper" behavior for wait() is when SIGCHLD is ignored? Is it simply undefined? Don't see anything mentioned in the wait(2) manpage one way or tother, and other OSes don't seem to agree much. -Paul. bash$ cat wait.c #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <stdio.h> #include <unistd.h> int main() { int status; pid_t pid = fork(); if (!pid) { sleep(1); _exit(0); } signal(SIGCHLD, SIG_IGN); printf("waitpid() = %d\n", waitpid(pid, &status, 0)); signal(SIGCHLD, SIG_DFL); return 0; } bash$ cc wait.c [FreeBSD 4.8] bash$ ./a.out waitpid() = 7553 bash$ [Linux 2.4.21] bash$ ./a.out waitpid() = 24536 bash$ [Darwin 6.6] bash$ ./a.out waitpid() = -1 bash$ [Solaris 8] bash$ ./a.out waitpid() = -1 bash$ [OpenBSD 3.3] bash$ ./a.out ...just hangs...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030530213533.E229-100000>