added -E switch
[tridge/junkcode.git] / cl.c
1 #include <errno.h>
2 #include <asm/unistd.h>
3
4 _syscall2(int, clone, int, flags, int, sp);
5
6
7 int libc_clone(int (*fn)(), void *child_stack, int flags)
8 {
9         int ret;
10
11         if (!child_stack) {
12                 errno = EINVAL;
13                 return -1;
14         }
15
16         ret = clone(flags, child_stack);
17         if (ret != 0) return ret;
18
19         ret = fn();
20         exit(ret);
21 }
22
23 main()
24 {
25         libc_clone(0,0);
26 }