asterinas/regression/apps/fork_c/fork.c

14 lines
282 B
C
Raw Normal View History

2022-10-28 05:47:57 +00:00
#include <stdio.h>
#include <unistd.h>
int main() {
printf("before fork\n");
fflush(stdout);
if(fork() == 0) {
printf("after fork: Hello from child\n");
2022-10-28 05:47:57 +00:00
} else {
printf("after fork: Hello from parent\n");
2022-10-28 05:47:57 +00:00
}
fflush(stdout);
return 0;
}