mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-05-28 20:12:11 +02:00
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>
This commit is contained in:
committed by
Jan Nieuwenhuizen
parent
9c3b28b911
commit
d0ed201e0a
@@ -861,6 +861,10 @@ void killUser(uid_t uid)
|
|||||||
which means "follow POSIX", which we don't want here
|
which means "follow POSIX", which we don't want here
|
||||||
*/
|
*/
|
||||||
if (syscall(SYS_kill, -1, SIGKILL, false) == 0) break;
|
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
|
#else
|
||||||
if (kill(-1, SIGKILL) == 0) break;
|
if (kill(-1, SIGKILL) == 0) break;
|
||||||
#endif
|
#endif
|
||||||
@@ -873,6 +877,10 @@ void killUser(uid_t uid)
|
|||||||
});
|
});
|
||||||
|
|
||||||
int status = pid.wait(true);
|
int status = pid.wait(true);
|
||||||
|
#if __GNU__
|
||||||
|
/* When the child killed itself, status = SIGKILL. */
|
||||||
|
if (status == SIGKILL) return;
|
||||||
|
#endif
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
throw Error(format("cannot kill processes for uid `%1%': %2%") % uid % statusToString(status));
|
throw Error(format("cannot kill processes for uid `%1%': %2%") % uid % statusToString(status));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user