2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

Helper for si_code event extraction.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2012-04-25 21:34:05 +04:00
parent b749f4b1c3
commit 59a2f13e7e
3 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -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:
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;

View File

@ -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