Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 17 Sep 2015 14:20:00 +0000
From: Vasileios Kalintiris <Vasileios.Kalintiris@...tec.com>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: [PATCH] Define and use the __ptrace_request enumeration type in
 ptrace.

[PATCH] Define and use the __ptrace_request enumeration type in ptrace.

Signed-off-by: Vasileios Kalintiris <Vasileios.Kalintiris@...tec.com>
---
 include/sys/ptrace.h | 70 +++++++++++++++++++++++++++-------------------------
 src/linux/ptrace.c   |  2 +-
 2 files changed, 38 insertions(+), 34 deletions(-)

diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h
index a133e66..7551955 100644
--- a/include/sys/ptrace.h
+++ b/include/sys/ptrace.h
@@ -6,40 +6,44 @@ extern "C" {
 
 #include <stdint.h>
 
-#define PTRACE_TRACEME 0
-#define PT_TRACE_ME PTRACE_TRACEME
+enum __ptrace_request {
+	PTRACE_TRACEME = 0,
+	PTRACE_PEEKTEXT,
+	PTRACE_PEEKDATA,
+	PTRACE_PEEKUSER,
+	PTRACE_POKETEXT,
+	PTRACE_POKEDATA,
+	PTRACE_POKEUSER,
+	PTRACE_CONT,
+	PTRACE_KILL,
+	PTRACE_SINGLESTEP,
+
+	PTRACE_GETREGS = 12,
+	PTRACE_SETREGS,
+	PTRACE_GETFPREGS,
+	PTRACE_SETFPREGS,
+	PTRACE_ATTACH,
+	PTRACE_DETACH,
+	PTRACE_GETFPXREGS,
+	PTRACE_SETFPXREGS,
 
-#define PTRACE_PEEKTEXT 1
-#define PTRACE_PEEKDATA 2
-#define PTRACE_PEEKUSER 3
-#define PTRACE_POKETEXT 4
-#define PTRACE_POKEDATA 5
-#define PTRACE_POKEUSER 6
-#define PTRACE_CONT 7
-#define PTRACE_KILL 8
-#define PTRACE_SINGLESTEP 9
-#define PTRACE_GETREGS 12
-#define PTRACE_SETREGS 13
-#define PTRACE_GETFPREGS 14
-#define PTRACE_SETFPREGS 15
-#define PTRACE_ATTACH 16
-#define PTRACE_DETACH 17
-#define PTRACE_GETFPXREGS 18
-#define PTRACE_SETFPXREGS 19
-#define PTRACE_SYSCALL 24
-#define PTRACE_SETOPTIONS 0x4200
-#define PTRACE_GETEVENTMSG 0x4201
-#define PTRACE_GETSIGINFO 0x4202
-#define PTRACE_SETSIGINFO 0x4203
-#define PTRACE_GETREGSET 0x4204
-#define PTRACE_SETREGSET 0x4205
-#define PTRACE_SEIZE 0x4206
-#define PTRACE_INTERRUPT 0x4207
-#define PTRACE_LISTEN 0x4208
-#define PTRACE_PEEKSIGINFO 0x4209
-#define PTRACE_GETSIGMASK 0x420a
-#define PTRACE_SETSIGMASK 0x420b
+	PTRACE_SYSCALL = 24,
 
+	PTRACE_SETOPTIONS = 0x4200,
+	PTRACE_GETEVENTMSG,
+	PTRACE_GETSIGINFO,
+	PTRACE_SETSIGINFO,
+	PTRACE_GETREGSET,
+	PTRACE_SETREGSET,
+	PTRACE_SEIZE,
+	PTRACE_INTERRUPT,
+	PTRACE_LISTEN,
+	PTRACE_PEEKSIGINFO,
+	PTRACE_GETSIGMASK,
+	PTRACE_SETSIGMASK
+};
+
+#define PT_TRACE_ME PTRACE_TRACEME
 #define PT_READ_I PTRACE_PEEKTEXT
 #define PT_READ_D PTRACE_PEEKDATA
 #define PT_READ_U PTRACE_PEEKUSER
@@ -90,7 +94,7 @@ struct ptrace_peeksiginfo_args {
 	int32_t nr;
 };
 
-long ptrace(int, ...);
+long ptrace(enum __ptrace_request, ...);
 
 #ifdef __cplusplus
 }
diff --git a/src/linux/ptrace.c b/src/linux/ptrace.c
index 83b8022..35ee262 100644
--- a/src/linux/ptrace.c
+++ b/src/linux/ptrace.c
@@ -3,7 +3,7 @@
 #include <unistd.h>
 #include "syscall.h"
 
-long ptrace(int req, ...)
+long ptrace(enum __ptrace_request req, ...)
 {
 	va_list ap;
 	pid_t pid;
-- 
2.5.0

View attachment "__ptrace_request.patch" of type "text/x-patch" (2719 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.