blob: 791e3e48b9c839caf0264eb4f3106adb87aa73d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/** @file 410user/progs/fork_wait.c
* @author zra
* @brief Tests fork() and wait().
* @public yes
* @for p3
* @covers fork wait set_status vanish
* @status done
*/
#include <syscall.h>
#include <stdlib.h>
#include "410_tests.h"
#include <report.h>
DEF_TEST_NAME("fork_wait:");
int main()
{
int pid, status;
report_start(START_CMPLT);
pid = fork();
if (pid < 0) {
report_end(END_FAIL);
exit(-1);
}
if (pid == 0) {
exit(17);
report_end(END_FAIL); /* panic("vanish() didn't"); */
}
if (wait(&status) != pid) {
report_end(END_FAIL);
exit(-1);
}
if (status != 17) {
report_end(END_FAIL);
exit(-1);
}
report_end(END_SUCCESS);
exit(0);
}
|