1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
--- ltp-full-20190930.orig/testcases/kernel/syscalls/pkeys/pkey.h 2019-09-30 13:30:26.000000000 +0200
+++ ltp-full-20190930/testcases/kernel/syscalls/pkeys/pkey.h 2019-10-29 15:02:09.524423510 +0100
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2019 Red Hat, Inc.
+ * Copyright (c) Linux Test Project, 2019
*/
#ifndef PKEYS_H
@@ -15,25 +16,29 @@
#endif
#ifndef HAVE_PKEY_MPROTECT
-static inline int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
+inline int ltp_pkey_mprotect(void *addr, size_t len, int prot, int pkey)
{
return tst_syscall(__NR_pkey_mprotect, addr, len, prot, pkey);
}
-static inline int pkey_alloc(unsigned int flags, unsigned int access_rights)
+inline int ltp_pkey_alloc(unsigned int flags, unsigned int access_rights)
{
return tst_syscall(__NR_pkey_alloc, flags, access_rights);
}
-static inline int pkey_free(int pkey)
+inline int ltp_pkey_free(int pkey)
{
return tst_syscall(__NR_pkey_free, pkey);
}
+#else
+#define ltp_pkey_alloc pkey_alloc
+#define ltp_pkey_free pkey_free
+#define ltp_pkey_mprotect pkey_mprotect
#endif /* HAVE_PKEY_MPROTECT */
static inline void check_pkey_support(void)
{
- int pkey = pkey_alloc(0, 0);
+ int pkey = ltp_pkey_alloc(0, 0);
if (pkey == -1) {
if (errno == ENOSYS)
@@ -44,7 +49,7 @@ static inline void check_pkey_support(vo
tst_brk(TCONF, "pkeys are not available for test");
}
- pkey_free(pkey);
+ ltp_pkey_free(pkey);
}
#endif /* PKEYS_H */
|