[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/06: services: dhcp-client: Better track dhclient's PID.
From: |
Ludovic Courtès |
Subject: |
03/06: services: dhcp-client: Better track dhclient's PID. |
Date: |
Sat, 09 May 2015 21:54:06 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit c217cbd84d7aee7414945a6cf85e1d704fff6e32
Author: Ludovic Courtès <address@hidden>
Date: Sat May 9 22:28:03 2015 +0200
services: dhcp-client: Better track dhclient's PID.
* gnu/services/networking.scm (dhcp-client-service)[start]: Remove
PID-FILE first. When 'call-with-input-file' throws ENOENT, try
again.
---
gnu/services/networking.scm | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index f9d262d..33ecf9c 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -165,6 +165,8 @@ Protocol (DHCP) client, on all the non-loopback network
interfaces."
(provision '(networking))
(start #~(lambda _
+ (false-if-exception (delete-file #$pid-file))
+
;; When invoked without any arguments, 'dhclient'
;; discovers all non-loopback interfaces *that are
;; up*. However, the relevant interfaces are
@@ -178,7 +180,19 @@ Protocol (DHCP) client, on all the non-loopback network
interfaces."
"-pf" #$pid-file
ifaces))))
(and (zero? (cdr (waitpid pid)))
- (call-with-input-file #$pid-file read)))))
+ (let loop ()
+ (catch 'system-error
+ (lambda ()
+ (call-with-input-file #$pid-file read))
+ (lambda args
+ ;; 'dhclient' returned before PID-FILE
+ ;; was created, so try again.
+ (let ((errno (system-error-errno args)))
+ (if (= ENOENT errno)
+ (begin
+ (sleep 1)
+ (loop))
+ (apply throw args))))))))))
(stop #~(make-kill-destructor))))))
(define %ntp-servers
- branch master updated (15f0de0 -> dd51caa), Ludovic Courtès, 2015/05/09
- 01/06: gnu: wicd: Add patch to fix template instantiation., Ludovic Courtès, 2015/05/09
- 02/06: doc: Rename OS config example., Ludovic Courtès, 2015/05/09
- 03/06: services: dhcp-client: Better track dhclient's PID.,
Ludovic Courtès <=
- 04/06: doc: Add desktop configuration example., Ludovic Courtès, 2015/05/09
- 05/06: install: Have several OS config templates under /etc/configuration., Ludovic Courtès, 2015/05/09
- 06/06: doc: Show both the "bare-bones" and the "desktop" configurations., Ludovic Courtès, 2015/05/09