mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-31 14:00:12 +00:00
ptrace: Add comment about early interrupt
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
800c4d09bb
commit
805e25effe
1 changed files with 9 additions and 1 deletions
10
ptrace.c
10
ptrace.c
|
|
@ -53,7 +53,15 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
|
|||
ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
|
||||
ptrace_errno = errno;
|
||||
if (ret == 0) {
|
||||
/* Stop task before determing its state */
|
||||
/*
|
||||
* If we SEIZE-d the task stop it before going
|
||||
* and reading its stat from proc. Otherwise task
|
||||
* may die _while_ we're doing it and we'll have
|
||||
* inconsistent seize/state pair.
|
||||
*
|
||||
* If task dies after we seize it but before we
|
||||
* do this interrupt, we'll notice it via proc.
|
||||
*/
|
||||
ret = ptrace(PTRACE_INTERRUPT, pid, NULL, NULL);
|
||||
if (ret < 0) {
|
||||
pr_perror("SEIZE %d: can't interrupt task", pid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue