diff options
author | Manolis Ragkousis <manolis837@gmail.com> | 2016-12-28 02:49:22 +0200 |
---|---|---|
committer | Jan Nieuwenhuizen <janneke@gnu.org> | 2020-03-26 12:59:33 +0100 |
commit | d0ed201e0a9736c64cb3c59d8c987c79fd6046d6 (patch) | |
tree | e9eb4a1dd55cf1133598aba3a52e9b44f9a1d4fc /nix | |
parent | 9c3b28b911ef8774f42d35d500a86fb25bd50d3c (diff) | |
download | patches-d0ed201e0a9736c64cb3c59d8c987c79fd6046d6.tar patches-d0ed201e0a9736c64cb3c59d8c987c79fd6046d6.tar.gz |
daemon: Avoid kill -1 bug on the Hurd.
This allows for native builds on the Hurd, doing
sudo ./pre-inst-env guix-daemon --disable-chroot --build-users-group=guixbuild &
./pre-inst-env guix build hello
* nix/libutil/util.cc (killUser)[__GNU__]: Avoid kill -1 bug; kill only
current process and ignore SIGKILL status in parent.
Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org>
Diffstat (limited to 'nix')
-rw-r--r-- | nix/libutil/util.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index fb2dfad1f7..17d145b4c6 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -861,6 +861,10 @@ void killUser(uid_t uid) which means "follow POSIX", which we don't want here */ if (syscall(SYS_kill, -1, SIGKILL, false) == 0) break; +#elif __GNU__ + /* Killing all a user's processes using PID=-1 does currently + not work on the Hurd. */ + if (kill(getpid(), SIGKILL) == 0) break; #else if (kill(-1, SIGKILL) == 0) break; #endif @@ -873,6 +877,10 @@ void killUser(uid_t uid) }); int status = pid.wait(true); +#if __GNU__ + /* When the child killed itself, status = SIGKILL. */ + if (status == SIGKILL) return; +#endif if (status != 0) throw Error(format("cannot kill processes for uid `%1%': %2%") % uid % statusToString(status)); |