xen: refactor the various "version not supported" messages into a single helper
[valgrind.git] / gdbserver_tests / clean_after_fork.c
blob6b9aa15d3531d242847e5ef787531fefb71fe761
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <errno.h>
4 #include <unistd.h>
5 #include <sys/wait.h>
6 int main()
8 int mem = 0, pid;
9 pid = fork();
10 if (pid == -1) {
11 mem = 1;
12 perror("fork");
13 exit(1);
16 if (pid == 0) {
17 int burn;
18 for (burn = 0; burn < 100000; burn++) /* burncpu */__asm__ __volatile("":::"memory") ;
19 if (mem == 0)
20 exit(0);
21 else
22 exit(1);
23 } else {
24 int ret;
25 int status;
26 while((ret = waitpid(pid, &status, 0)) != pid) {
27 if (errno != EINTR) {
28 perror("waitpid");
29 exit(1);
32 mem = status;
34 if (mem == 0)
35 printf("mem is zero\n");
37 return 0;