lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* based originally on one the clone tests in the LTP */ |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | #include <errno.h> |
| 6 | #include <sched.h> |
| 7 | #include "clone_cruft.h" |
| 8 | |
| 9 | __attribute__ ((__noreturn__)) |
| 10 | static int child_fn(void *arg) |
| 11 | { |
| 12 | fprintf(stderr, "in child_fn\n"); |
| 13 | exit(1); |
| 14 | } |
| 15 | |
| 16 | int main(void) |
| 17 | { |
| 18 | int r_clone, ret_errno; |
| 19 | |
| 20 | r_clone = do_clone(child_fn, NULL, 0, NULL); |
| 21 | ret_errno = errno; |
| 22 | if (ret_errno != EINVAL || r_clone != -1) { |
| 23 | fprintf(stderr, "clone: res=%d (wanted -1) errno=%d (wanted %d)\n", |
| 24 | r_clone, errno, EINVAL); |
| 25 | return 1; |
| 26 | } |
| 27 | |
| 28 | return 0; |
| 29 | } |