From: Vasileios Kalintiris <Vasileios.Kalintiris@imgtec.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [PATCH] Define and use the __ptrace_request enumeration type in ptrace.
Date: Thu, 17 Sep 2015 14:20:00 +0000 [thread overview]
Message-ID: <8B7D5EC97CB15C4DBFDCE766959C1607C6ABD1@hhmail02.hh.imgtec.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2831 bytes --]
[PATCH] Define and use the __ptrace_request enumeration type in ptrace.
Signed-off-by: Vasileios Kalintiris <Vasileios.Kalintiris@imgtec.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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: __ptrace_request.patch --]
[-- Type: text/x-patch; name="__ptrace_request.patch", Size: 2719 bytes --]
[PATCH] Define and use the __ptrace_request enumeration type in ptrace.
Signed-off-by: Vasileios Kalintiris <Vasileios.Kalintiris@imgtec.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
next reply other threads:[~2015-09-17 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 14:20 Vasileios Kalintiris [this message]
2015-09-21 20:31 ` Rich Felker
2015-09-21 21:39 ` Vasileios Kalintiris
2015-10-01 20:08 ` Alexander Monakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8B7D5EC97CB15C4DBFDCE766959C1607C6ABD1@hhmail02.hh.imgtec.org \
--to=vasileios.kalintiris@imgtec.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).