aboutsummaryrefslogtreecommitdiff
path: root/testsuite/ltrace.minor/trace-clone.c
blob: c71de9f9a22fd95ec5dd1ba88b32fee06c16fd22 (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
/* Ltrace Test : trace-clone.c.
   Objectives  : Verify that ltrace can trace to child process after
   clone called.

   This file was written by Yao Qi <qiyao@cn.ibm.com>.  */

#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sched.h>

int child ()
{
  return 0;
}

typedef int (* myfunc)();

int main ()
{
  pid_t pid;
  static char stack[1024];
  
  if ((pid = clone((myfunc)&child, stack,CLONE_FS, NULL )) < 0)
    {
      perror("clone called failed");
      exit (1);
    }
  
  return 0;
}