guix-commits
[Top][All Lists]
Advanced

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

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


From: Ludovic Courtès
Subject: [shepherd] 01/07: Remove EINTR-safe, and all references to it.
Date: Wed, 19 Sep 2018 11:44:27 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit c4ba8c79db0aa4ba3517acc82ebafe16105fbb97
Author: Carlo Zancanaro <address@hidden>
Date:   Wed Sep 19 11:42:03 2018 +0200

    Remove EINTR-safe, and all references to it.
    
    This fixes commit 2756a929d96725d837738e396619072d50b366cc by removing
    leftover #:replace in (shepherd service), which had the effect of
    leaving 'system' and 'system*' unbound.
    
    * modules/shepherd/support.scm (EINTR-safe): Remove procedure and its 
export.
    * modules/shepherd/service.scm (system*, system*): Remove now-unnecessary
    procedures, and remove corresponding #:replace.
    (waitpid*): Remove references to EINTR-safe.
    * modules/shepherd.scm (main): Remove references to EINTR-safe.
    
    Co-authored-by: Ludovic Courtès <address@hidden>
---
 modules/shepherd.scm         |  7 +------
 modules/shepherd/service.scm | 37 +++++++++++++------------------------
 modules/shepherd/support.scm | 14 --------------
 3 files changed, 14 insertions(+), 44 deletions(-)

diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 0e55088..1efe4ce 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 be86621..0cfa387 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -35,8 +35,6 @@
   #:use-module (shepherd comm)
   #:use-module (shepherd config)
   #:use-module (shepherd system)
-  #:replace (system
-             system*)
   #:export (<service>
             service?
             canonical-name
@@ -613,13 +611,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)))
 
 
 
@@ -1014,21 +1005,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]