Update.
[platform/upstream/glibc.git] / posix / test-vfork.c
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <error.h>
4 #include <errno.h>
5
6 void noop (void);
7
8 int
9 main (void)
10 {
11   int pid;
12
13   printf ("Before vfork\n");
14   fflush (stdout);
15   pid = vfork ();
16   if (pid == 0)
17     {
18       /* This will clobber the return pc from vfork in the parent on
19          machines where it is stored on the stack, if vfork wasn't
20          implemented correctly, */
21       noop ();
22       _exit (2);
23     }
24   else if (pid < 0)
25     error (1, errno, "vfork");
26   printf ("After vfork (parent)\n");
27   wait (0);
28   exit (0);
29 }
30
31 void
32 noop ()
33 {
34 }