lkml.org 
[lkml]   [2017]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC][PATCH 6/7] x86, mpx, selftests: Use prctl header instead of magic numbers
From
Date

I got away with just hard-coding the prctl() numbers in the MPX
selftests. Include the kernel header so we can just use the
symbolic names.

---

b/tools/testing/selftests/x86/mpx-mini-test.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN tools/testing/selftests/x86/mpx-mini-test.c~mawa-068-selftests-inc tools/testing/selftests/x86/mpx-mini-test.c
--- a/tools/testing/selftests/x86/mpx-mini-test.c~mawa-068-selftests-inc 2017-02-01 15:12:18.083231385 -0800
+++ b/tools/testing/selftests/x86/mpx-mini-test.c 2017-02-01 15:12:18.087231565 -0800
@@ -40,6 +40,8 @@ int zap_all_every_this_many_mallocs = 10
#include "mpx-debug.h"
#include "mpx-mm.h"

+#include "../../../../include/uapi/linux/prctl.h"
+
#ifndef __always_inline
#define __always_inline inline __attribute__((always_inline)
#endif
@@ -666,7 +668,7 @@ bool process_specific_init(void)
check_clear(dir, size);
enable_mpx(dir);
check_clear(dir, size);
- if (prctl(43, 0, 0, 0, 0)) {
+ if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0)) {
printf("no MPX support\n");
abort();
return false;
@@ -676,7 +678,7 @@ bool process_specific_init(void)

bool process_specific_finish(void)
{
- if (prctl(44)) {
+ if (prctl(PR_MPX_DISABLE_MANAGEMENT)) {
printf("no MPX support\n");
return false;
}
_
\
 
 \ /
  Last update: 2017-02-02 00:26    [W:0.070 / U:2.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site