diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-09-19 10:54:46 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-09-19 18:25:27 +0200 |
commit | 7fd3082522e7007b47a6aa765d10a9cc3277b36d (patch) | |
tree | be0ea3cce6899855964a20c06ed263d641377c05 | |
parent | 4d679255dad798da0bbac22412e4f3f4d09a771a (diff) | |
download | patches-7fd3082522e7007b47a6aa765d10a9cc3277b36d.tar patches-7fd3082522e7007b47a6aa765d10a9cc3277b36d.tar.gz |
services: udev: Simplify 'start' method.
* gnu/services/base.scm (udev-shepherd-service)[start](find): Remove.
(udev): Hardwire the eudev file name.
Use 'fork+exec-command' instead of 'primitive-fork' and 'exec-command'.
-rw-r--r-- | gnu/services/base.scm | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 921914ccdf..beb473151d 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1846,16 +1846,9 @@ item of @var{packages}." (documentation "Populate the /dev directory, dynamically.") (start #~(lambda () - (define find - (@ (srfi srfi-1) find)) - (define udevd - ;; Choose the right 'udevd'. - (find file-exists? - (map (lambda (suffix) - (string-append #$udev suffix)) - '("/libexec/udev/udevd" ;udev - "/sbin/udevd")))) ;eudev + ;; 'udevd' from eudev. + #$(file-append udev "/sbin/udevd")) (define (wait-for-udevd) ;; Wait until someone's listening on udevd's control @@ -1891,24 +1884,20 @@ item of @var{packages}." (make-static-device-nodes directory) (umask old-umask)) - (let ((pid (primitive-fork))) - (case pid - ((0) - (exec-command (list udevd))) - (else - ;; Wait until udevd is up and running. This - ;; appears to be needed so that the events - ;; triggered below are actually handled. - (wait-for-udevd) - - ;; Trigger device node creation. - (system* #$(file-append udev "/bin/udevadm") - "trigger" "--action=add") - - ;; Wait for things to settle down. - (system* #$(file-append udev "/bin/udevadm") - "settle") - pid))))) + (let ((pid (fork+exec-command (list udevd)))) + ;; Wait until udevd is up and running. This appears to + ;; be needed so that the events triggered below are + ;; actually handled. + (wait-for-udevd) + + ;; Trigger device node creation. + (system* #$(file-append udev "/bin/udevadm") + "trigger" "--action=add") + + ;; Wait for things to settle down. + (system* #$(file-append udev "/bin/udevadm") + "settle") + pid))) (stop #~(make-kill-destructor)) ;; When halting the system, 'udev' is actually killed by |