diff options
Diffstat (limited to '410user/progs/fork_exit_bomb.c')
| -rw-r--r-- | 410user/progs/fork_exit_bomb.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/410user/progs/fork_exit_bomb.c b/410user/progs/fork_exit_bomb.c new file mode 100644 index 0000000..a0a8fbc --- /dev/null +++ b/410user/progs/fork_exit_bomb.c @@ -0,0 +1,41 @@ +/** @file 410user/progs/fork_exit_bomb.c + * @author ? + * @brief Tests many invocations of fork/exit + * @public yes + * @for p3 + * @covers fork set_status vanish + * @status done + */ + +#include <syscall.h> +#include <stdlib.h> +#include <stdio.h> +#include "410_tests.h" +#include <report.h> + +DEF_TEST_NAME("fork_exit_bomb:"); + +int main(int argc, char *argv[]) { + int pid = 0; + int count = 0; + + report_start(START_CMPLT); + TEST_PROG_ENGAGE(200); + + lprintf("parent pid: %d", gettid()); + + while(count < 1000) { + if((pid = fork()) == 0) { + exit(42); + } + if(pid < 0) { + break; + } + count++; + report_fmt("child: %d", pid); + TEST_PROG_PROGRESS; + } + + report_end(END_SUCCESS); + exit(42); +} |
