]> granicus.if.org Git - strace/blob - tests/pkey_free.c
9f1ba6181040ff8033dc13eb61f2c9e6e96896ad
[strace] / tests / pkey_free.c
1 /*
2  * Check decoding of pkey_free syscall.
3  *
4  * Copyright (c) 2016 Eugene Syromyatnikov <evgsyr@gmail.com>
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 #include "scno.h"
13
14 #ifdef __NR_pkey_free
15
16 # include <stdio.h>
17 # include <unistd.h>
18
19 int
20 main(void)
21 {
22         static const kernel_ulong_t keys[] = {
23                 0,
24                 3141592653U,
25                 (kernel_ulong_t) 0xbadc0ded00000000ULL,
26                 (kernel_ulong_t) 0xffff00001111eeeeULL,
27                 (kernel_ulong_t) 0x123456789abcdef0ULL,
28         };
29
30         long rc;
31         unsigned int i;
32
33         for (i = 0; i < ARRAY_SIZE(keys); i++) {
34                 rc = syscall(__NR_pkey_free, keys[i]);
35                 printf("pkey_free(%d) = %s\n", (int) keys[i], sprintrc(rc));
36         }
37
38         puts("+++ exited with 0 +++");
39
40         return 0;
41 }
42
43 #else
44
45 SKIP_MAIN_UNDEFINED("__NR_pkey_free");
46
47 #endif