apparmor/tests/stress/subdomain/child.c
Steve Beattie 6d3e74907d Import the rest of the core functionality of the internal apparmor
development tree (trunk branch). From svn repo version 6381.
2006-04-11 21:52:54 +00:00

35 lines
507 B
C

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/wait.h>
static int zombies;
void sigchld(int num)
{
zombies++;
}
int main()
{
pid_t pid;
int i;
signal(SIGCHLD, sigchld);
again:
for (i = 0; i < 500; i++) {
pid = fork();
if (pid > 0)
continue;
else if (pid == 0)
exit(0);
else
printf("fork: %s\n", strerror(errno));
}
while (waitpid(0, NULL, WNOHANG) > 0);
goto again;
}