Excluding riscv64 because it does not support riscv64.
[platform/upstream/ltrace.git] / testsuite / ltrace.minor / trace-fork.c
1 /* Ltrace Test : trace-fork.c
2    Objectives  : Verify that ltrace can trace to child process after
3    fork called.
4
5    This file was written by Yao Qi <qiyao@cn.ibm.com>.  */
6
7 #include <stdio.h>
8 #include <sys/types.h>
9
10 void 
11 child ()
12 {
13   printf("Fork Child\n");
14   sleep(1);
15 }
16
17 int 
18 main ()
19 {
20   pid_t pid;
21   pid = fork ();
22   
23   if (pid == -1)
24     puts("fork failed!");
25   else if (pid == 0)
26     child();
27   else
28     {
29       printf("My child pid is %d\n",pid);
30       wait(); 
31     }
32   return 0;
33 }