1 /*
2 * Copyright (c) International Business Machines Corp., 2007
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 * the GNU General Public License for more details.
12 */
13
14 #include "../libclone/libclone.h"
15 #include "test.h"
16 #include "safe_macros.h"
17
dummy_child(void * v)18 static int dummy_child(void *v)
19 {
20 (void) v;
21 return 0;
22 }
23
check_newpid(void)24 static int check_newpid(void)
25 {
26 int pid, status;
27
28 if (tst_kvercmp(2, 6, 24) < 0)
29 tst_brkm(TCONF, NULL, "CLONE_NEWPID not supported");
30
31 pid = do_clone_unshare_test(T_CLONE, CLONE_NEWPID, dummy_child, NULL);
32 if (pid == -1)
33 tst_brkm(TCONF | TERRNO, NULL, "CLONE_NEWPID not supported");
34 SAFE_WAIT(NULL, &status);
35
36 return 0;
37 }
38