]> granicus.if.org Git - strace/blob - tests/mbind.c
Update copyright headers
[strace] / tests / mbind.c
1 /*
2  * Check decoding of mbind syscall.
3  *
4  * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #include "tests.h"
11 #include <asm/unistd.h>
12
13 #ifdef __NR_mbind
14
15 # include <stdio.h>
16 # include <unistd.h>
17
18 int
19 main(void)
20 {
21         const unsigned long len = (unsigned long) 0xcafef00dbadc0dedULL;
22         const unsigned long mode = 3;
23         const unsigned long nodemask = (unsigned long) 0xfacefeedfffffff1ULL;
24         const unsigned long maxnode = (unsigned long) 0xdeadbeeffffffff2ULL;
25         const unsigned long flags = -1UL;
26
27         long rc = syscall(__NR_mbind, 0, len, mode, nodemask, maxnode, flags);
28         printf("mbind(NULL, %lu, %s, %#lx, %lu, %s|%#x) = %ld %s (%m)\n",
29                len, "MPOL_INTERLEAVE", nodemask, maxnode,
30                "MPOL_MF_STRICT|MPOL_MF_MOVE|MPOL_MF_MOVE_ALL",
31                (unsigned) flags & ~7, rc, errno2name());
32
33         puts("+++ exited with 0 +++");
34         return 0;
35 }
36
37 #else
38
39 SKIP_MAIN_UNDEFINED("__NR_mbind")
40
41 #endif