1 /*
2 * Copyright (c) 2016-2019 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #include "tests.h"
9 #include "scno.h"
10
11 #ifdef __NR_semop
12
13 # include "semop-common.c"
14
15 static long
16 k_semop(const unsigned int semid,
17 const kernel_ulong_t sops,
18 const unsigned int nsops)
19 {
20 const kernel_ulong_t fill = (kernel_ulong_t) 0xdefaced00000000ULL;
21 const kernel_ulong_t bad = (kernel_ulong_t) 0xbadc0dedbadc0dedULL;
22 const kernel_ulong_t arg1 = fill | semid;
23 const kernel_ulong_t arg2 = sops;
24 const kernel_ulong_t arg3 = fill | nsops;
25 const long rc = syscall(__NR_semop, arg1, arg2, arg3, bad, bad, bad);
26 errstr = sprintrc(rc);
27 return rc;
28 }
29
30 #else
31
32 SKIP_MAIN_UNDEFINED("__NR_semop")
33
34 #endif