mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
services: shepherd: Leave the finalization thread in peace.
This gets rid of that (in)famous at boot time: error in finalization thread: Success This was caused by the file-descriptor closing loop, which would clause the finalization pipe, leading the finalization thread to (erroneously) error out. Thanks to Josselin Poiret for locating the problem! * gnu/services/shepherd.scm (shepherd-boot-gexp): In 'loop', replace 'close-fdes' with a pair of 'fcntl' calls to add FD_CLOEXEC.
This commit is contained in:
parent
e6777cfa5e
commit
168a7933c0
1 changed files with 7 additions and 6 deletions
|
@ -107,14 +107,15 @@ (define (shepherd-boot-gexp config)
|
||||||
(symlink (canonicalize-path "/run/current-system")
|
(symlink (canonicalize-path "/run/current-system")
|
||||||
"/run/booted-system")
|
"/run/booted-system")
|
||||||
|
|
||||||
;; Close any remaining open file descriptors to be on the safe
|
;; Ensure open file descriptors are close-on-exec so shepherd doesn't
|
||||||
;; side. This must be the very last thing we do, because
|
;; inherit them.
|
||||||
;; Guile has internal FDs such as 'sleep_pipe' that need to be
|
|
||||||
;; alive.
|
|
||||||
(let loop ((fd 3))
|
(let loop ((fd 3))
|
||||||
(when (< fd 1024)
|
(when (< fd 1024)
|
||||||
(false-if-exception (close-fdes fd))
|
(false-if-exception
|
||||||
(loop (+ 1 fd))))
|
(let ((flags (fcntl fd F_GETFD)))
|
||||||
|
(when (zero? (logand flags FD_CLOEXEC))
|
||||||
|
(fcntl fd F_SETFD (logior FD_CLOEXEC flags)))))
|
||||||
|
(loop (+ fd 1))))
|
||||||
|
|
||||||
;; Start shepherd.
|
;; Start shepherd.
|
||||||
(execl #$(file-append shepherd "/bin/shepherd")
|
(execl #$(file-append shepherd "/bin/shepherd")
|
||||||
|
|
Loading…
Reference in a new issue