blob: 5d4fc726ac7472f9785da3744ceb9e3816ea2620 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* 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__))
10static int child_fn(void *arg)
11{
12 fprintf(stderr, "in child_fn\n");
13 exit(1);
14}
15
16int 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}