From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E07B159CAB for ; Tue, 29 Mar 2016 12:24:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D92921C08B; Tue, 29 Mar 2016 12:24:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 98E4221C08B for ; Tue, 29 Mar 2016 12:24:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 41986340CA7 for ; Tue, 29 Mar 2016 12:24:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E158186C for ; Tue, 29 Mar 2016 12:24:34 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1459242975.9b2b36945ec4e0335e0375cc45e14c41c66d28ae.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: src/ X-VCS-Repository: proj/sandbox X-VCS-Files: src/sandbox.c X-VCS-Directories: src/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 9b2b36945ec4e0335e0375cc45e14c41c66d28ae X-VCS-Branch: master Date: Tue, 29 Mar 2016 12:24:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d20b6b71-3f66-47a4-9dbf-13605f176ad1 X-Archives-Hash: cb2924874770cb632ca6639737b5619a commit: 9b2b36945ec4e0335e0375cc45e14c41c66d28ae Author: Mike Frysinger gentoo org> AuthorDate: Tue Mar 29 09:16:15 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Mar 29 09:16:15 2016 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=9b2b3694 sandbox: allow user to force SIGKILL Sometimes the child process can get wedged and not respond to CTRL+C, so add an escape hatch so the user can easily force SIGKILL. Signed-off-by: Mike Frysinger gentoo.org> src/sandbox.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sandbox.c b/src/sandbox.c index c668ab6..503ad0b 100644 --- a/src/sandbox.c +++ b/src/sandbox.c @@ -128,13 +128,21 @@ static void print_sandbox_log(char *sandbox_log) sb_eerror("--------------------------------------------------------------------------------\n"); } +static int stop_count = 5; + static void stop(int signum) { if (0 == stop_called) { stop_called = signum; sb_warn("caught signal %d in pid %d", signum, getpid()); - } else - sb_warn("signal already caught and busy still cleaning up!"); + } else if (--stop_count) { + sb_warn("Send signal %i more time%s to force SIGKILL", + stop_count, stop_count == 1 ? "" : "s"); + } else { + /* This really should kill all children; see usr1_handler. */ + kill(child_pid, SIGKILL); + stop_count = 1; + } } static void usr1_handler(int signum, siginfo_t *siginfo, void *ucontext)