lfs: Introduces lfs-chroot
[lcapit-junk-code.git] / clone.c
blob7ae9fe9cac45fd9f58cc42a2dc5c0074a8a8e565
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sched.h>
4 #include <sys/wait.h>
5 #include <sys/types.h>
7 #define UNUSED(x) (x = x)
8 #define STACK_SIZE 16
10 int child(void *arg)
12 UNUSED(arg);
14 printf("[child] Hello world!\n");
15 return 0;
18 int main(void)
20 int tid;
21 char stack[STACK_SIZE];
23 tid = clone(child, (void *) stack, 0, NULL);
24 if (tid < 0) {
25 perror("clone()");
26 exit(1);
29 wait(NULL);
31 printf("[parent]: exiting\n");
32 return 0;