public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/sandbox:master commit in: src/
Date: Tue, 29 Mar 2016 12:24:34 +0000 (UTC)	[thread overview]
Message-ID: <1459242975.9b2b36945ec4e0335e0375cc45e14c41c66d28ae.vapier@gentoo> (raw)

commit:     9b2b36945ec4e0335e0375cc45e14c41c66d28ae
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 29 09:16:15 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> 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 <vapier <AT> 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)


             reply	other threads:[~2016-03-29 12:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 12:24 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-08 15:30 [gentoo-commits] proj/sandbox:master commit in: src/ Mike Gilbert
2023-08-05 23:38 Mike Gilbert
2023-08-05 23:38 Mike Gilbert
2021-11-05 10:25 Mike Frysinger
2021-11-05 10:25 Mike Frysinger
2021-11-03  4:55 Mike Frysinger
2021-11-02  4:28 Mike Frysinger
2021-11-02  4:28 Mike Frysinger
2021-11-01 18:31 Mike Frysinger
2021-10-29  5:37 Mike Frysinger
2021-10-28  9:56 Mike Frysinger
2015-09-11  7:53 Mike Frysinger
2015-09-11  7:53 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459242975.9b2b36945ec4e0335e0375cc45e14c41c66d28ae.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox