wait4 does not seem to be properly reaping zombie processes. I noticed
this when my process table filled up with sendmail zombies.
The following example will give me 10 zombies stuck in do_exit. Am I doing
something wrong or is this a kernel bug?
#define _USE_BSD
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
int main(int argc, char **argv)
{
int status;
int c;
pid_t pid;
pid_t rpid;
struct rusage r;
for (c = 0; c < 10; c++)
{
pid = fork();
if (pid == -1)
{
perror("fork");
exit(-1);
}
if (pid == 0)
{
exit(0);
}
sleep(1);
rpid = wait4(pid, &status, WNOHANG, &r);
printf("wait4: r = %i s = %i\n", rpid, status);
}
return(0);
}
Regards,
Damien Miller
| WWW: http://silicon.vitnet.com.sg
| PGP public key: send me an email with "send file pgp_key" as the subject
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu