This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
>>>>> "HJ" == H J Lu <hjl@lucon.org> writes: HJ> On Thu, Oct 31, 2002 at 02:50:28PM -0500, Jes Sorensen wrote: >> Hi >> >> We are chasing a problem on Linux/mips with glibc-2.2.x, which I am >> not sure whether is a kernel bug or a libc bug. We haven't been >> able to reproduce it under Linux/x86 or Linux/ia64 so far though. >> >> Basically what seems to be happening is the following, a task is >> spawned from fork(), the child sends some signals to the parent >> after which it exits. [snip] HJ> A testcase? Included - but please no swearing, it's not pretty (no I didn't write it ;-) Thanks, Jes #include <signal.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> pid_t child = 0; void usr1handler(int sig) { printf("pid=%d usr1handler\n", getpid()); } void usr2handler(int sig) { printf("pid=%d usr2handler\n", getpid()); kill(child, SIGALRM); } pid_t forkit() { pid_t pid = fork(); if (0 == pid) { // Child kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); usleep(15); kill(getppid(), SIGIO); sleep(1); } return pid; } void reaper(int sig) { int status = 0; pid_t pid = wait(&status); printf("reaper: process %d returned %d\n", pid, status); child = forkit(); } int main(int argc, char* argv[]) { signal(SIGCHLD, reaper); signal(SIGIO, usr2handler); signal(SIGALRM, usr1handler); child = forkit(); if (0 != child) { // Parent sleep(20); sleep(20); sleep(20); sleep(20); } }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |