Commit 59a2f13e authored by Pavel Emelyanov's avatar Pavel Emelyanov

Helper for si_code event extraction.

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent b749f4b1
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#define PTRACE_O_TRACEVFORKDONE 0x00000020 #define PTRACE_O_TRACEVFORKDONE 0x00000020
#define PTRACE_O_TRACEEXIT 0x00000040 #define PTRACE_O_TRACEEXIT 0x00000040
#define SI_EVENT(_si_code) (((_si_code) & 0xFFFF) >> 8)
extern int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid); extern int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid);
extern int unseize_task(pid_t pid, int state); extern int unseize_task(pid_t pid, int state);
extern int ptrace_peek_area(pid_t pid, void *dst, void *addr, long bytes); extern int ptrace_peek_area(pid_t pid, void *dst, void *addr, long bytes);
......
...@@ -171,7 +171,7 @@ retry_signal: ...@@ -171,7 +171,7 @@ retry_signal:
goto err; goto err;
} }
if (((siginfo.si_code & 0xffff) >> 8) != PTRACE_EVENT_STOP) if (SI_EVENT(siginfo.si_code) != PTRACE_EVENT_STOP)
goto retry_signal; goto retry_signal;
/* /*
...@@ -218,7 +218,7 @@ retry_signal: ...@@ -218,7 +218,7 @@ retry_signal:
goto err; goto err;
} }
if (((siginfo.si_code & 0xffff) >> 8) != PTRACE_EVENT_STOP) { if (SI_EVENT(siginfo.si_code) != PTRACE_EVENT_STOP) {
pr_err("si_code doesn't match (pid: %d si_code: %d)\n", pr_err("si_code doesn't match (pid: %d si_code: %d)\n",
pid, siginfo.si_code); pid, siginfo.si_code);
goto err; goto err;
......
...@@ -113,7 +113,7 @@ try_again: ...@@ -113,7 +113,7 @@ try_again:
goto err; goto err;
} }
if (((si.si_code & 0xffff)>> 8) != PTRACE_EVENT_STOP) { if (SI_EVENT(si.si_code) != PTRACE_EVENT_STOP) {
/* /*
* Kernel notifies us about the task being seized received some * Kernel notifies us about the task being seized received some
* event other than the STOP, i.e. -- a signal. Let the task * event other than the STOP, i.e. -- a signal. Let the task
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment