From 6acb4ed8e75e72485a7d174d6366a227b1879805 Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Sat, 7 Mar 2009 17:35:02 +0100 Subject: [PATCH] signals: stop all threads of a process before taking a checkpoint If we want to checkpoint a multi-threaded process, we need to wait until the process is in a quiescent state, otherwise our checkpoint might be incorrect. --- sys/kern/kern_checkpoint.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/kern/kern_checkpoint.c b/sys/kern/kern_checkpoint.c index 470cd5ac5a..38324643d7 100644 --- a/sys/kern/kern_checkpoint.c +++ b/sys/kern/kern_checkpoint.c @@ -693,7 +693,11 @@ ckpt_freeze_proc(struct lwp *lp, struct file *fp) PRINTF(("calling generic_elf_coredump\n")); limit = p->p_rlimit[RLIMIT_CORE].rlim_cur; if (limit) { + proc_stop(p); + while (p->p_nstopped < p->p_nthreads - 1) + tsleep(&p->p_nstopped, 0, "freeze", 1); error = generic_elf_coredump(lp, SIGCKPT, fp, limit); + proc_unstop(p); } else { error = ERANGE; } -- 2.11.4.GIT