lkml.org 
[lkml]   [1998]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: Possible bug in wait4(), 2.1.126-129 ?
The following program

#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
int pid;
struct sigaction act;

sigaction(SIGCHLD, NULL, &act);
act.sa_handler = SIG_IGN;
sigaction(SIGCHLD, &act, NULL);

pid = fork();

if (pid == 0) {
fprintf(stderr, "\nnobody waits for me?\n");
} else if (pid != -1) {
sleep(3);
if (waitpid(pid, NULL, 0) == -1)
perror("waitpid");
}

exit(0);
}

demonstrates the behaviour of a reported ECHILD without
the need for cron. Now it is immediately clear what the
problem is.
Note that POSIX explicitly disallows setting the action
of SIGCHLD to SIG_IGN. It follows that crond and atd are
not POSIX compliant.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:3.115 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site