guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 02/02: Remove EINTR-safe, and all references to it.


From: Carlo Zancanaro
Subject: [shepherd] 02/02: Remove EINTR-safe, and all references to it.
Date: Tue, 10 Apr 2018 07:06:38 -0400 (EDT)

czan pushed a commit to branch master
in repository shepherd.

commit 2756a929d96725d837738e396619072d50b366cc
Author: Carlo Zancanaro <address@hidden>
Date:   Mon Mar 26 14:49:18 2018 +1100

    Remove EINTR-safe, and all references to it.
    
    * modules/shepherd/support.scm (EINTR-safe): Remove procedure and its 
export.
    * modules/shepherd/service.scm (system*, system*): Remove now-unnecessary
      procedures.
      (waitpid*): Remove references to EINTR-safe.
    * modules/shepherd.scm (main): Remove references to EINTR-safe.
---
 modules/shepherd.scm         |  7 +------
 modules/shepherd/service.scm | 35 +++++++++++++----------------------
 modules/shepherd/support.scm | 14 --------------
 3 files changed, 14 insertions(+), 42 deletions(-)

diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index fede338..5d97598 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -241,12 +241,7 @@
           ;; Get commands from the standard input port.
           (process-textual-commands (current-input-port))
           ;; Process the data arriving at a socket.
-          (let ((sock   (open-server-socket socket-file))
-
-                ;; With Guile <= 2.0.9, we can get a system-error exception for
-                ;; EINTR, which happens anytime we receive a signal, such as
-                ;; SIGCHLD.  Thus, wrap the 'accept' call.
-                (accept (EINTR-safe accept)))
+          (let ((sock   (open-server-socket socket-file)))
 
             ;; Possibly write out our PID, which means we're ready to accept
             ;; connections.  XXX: What if we daemonized already?
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 7b062a1..93d3779 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -590,13 +590,6 @@ results."
                (apply action service the-action args))
              which-services))))
 
-;; EINTR-safe versions of 'system' and 'system*'.
-
-(define system*
-  (EINTR-safe (@ (guile) system*)))
-
-(define system
-  (EINTR-safe (@ (guile) system)))
 
 
 
@@ -981,21 +974,19 @@ returned in unspecified."
   (hashq-ref %services name '()))
 
 (define waitpid*
-  (let ((waitpid (EINTR-safe waitpid)))
-    (lambda (what flags)
-      "Like 'waitpid', but EINTR-safe, and return (0 . _) when there's no
-child left."
-      (catch 'system-error
-        (lambda ()
-          (waitpid what flags))
-        (lambda args
-          ;; Did we get ECHILD or something?  If we did, that's a problem,
-          ;; because this procedure is supposed to be called only upon
-          ;; SIGCHLD.
-          (let ((errno (system-error-errno args)))
-            (local-output "warning: 'waitpid' ~a failed unexpectedly: ~a"
-                          what (strerror errno))
-            '(0 . #f)))))))
+  (lambda (what flags)
+    "Like 'waitpid', and return (0 . _) when there's no child left."
+    (catch 'system-error
+      (lambda ()
+        (waitpid what flags))
+      (lambda args
+        ;; Did we get ECHILD or something?  If we did, that's a problem,
+        ;; because this procedure is supposed to be called only upon
+        ;; SIGCHLD.
+        (let ((errno (system-error-errno args)))
+          (local-output "warning: 'waitpid' ~a failed unexpectedly: ~a"
+                        what (strerror errno))
+          '(0 . #f))))))
 
 (define (handle-SIGCHLD signum)
   "Handle SIGCHLD, possibly by respawning the service that just died, or
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 380866e..9f02719 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -30,7 +30,6 @@
 
             catch-system-error
             with-system-error-handling
-            EINTR-safe
             with-atomic-file-output
             mkdir-p
             with-directory-excursion
@@ -127,19 +126,6 @@ turned into user error messages."
    (lambda ()
      body ...)))
 
-(define (EINTR-safe proc)
-  "Wrap PROC so that if a 'system-error' exception with EINTR is raised (that
-was possible up to Guile 2.0.9 included) the call to PROC is restarted."
-  (lambda args
-    (let loop ()
-      (catch 'system-error
-        (lambda ()
-          (apply proc args))
-        (lambda args
-          (if (= EINTR (system-error-errno args))
-              (loop)
-              (apply throw args)))))))
-
 (define (with-atomic-file-output file proc)       ;copied from Guix
   "Call PROC with an output port for the file that is going to replace FILE.
 Upon success, FILE is atomically replaced by what has been written to the



reply via email to

[Prev in Thread] Current Thread [Next in Thread]