guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 03/06: service: Improve handling of the no-PR_SET_CHILD_SUBRE


From: Ludovic Courtès
Subject: [shepherd] 03/06: service: Improve handling of the no-PR_SET_CHILD_SUBREAPER case.
Date: Mon, 1 Jan 2024 17:38:52 -0500 (EST)

civodul pushed a commit to branch main
in repository shepherd.

commit 839823eb61c6206bc6bc3a5dbad31b8d2eddb334
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Jan 1 17:55:00 2024 +0100

    service: Improve handling of the no-PR_SET_CHILD_SUBREAPER case.
    
    This is used on GNU/Hurd when not running as PID 1.
    
    * modules/shepherd/service.scm (check-for-dead-services): Send a message
    to the process monitor instead of calling ‘respawn-service’.
---
 modules/shepherd/service.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 24224c0..7130f37 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -2767,7 +2767,14 @@ where prctl/PR_SET_CHILD_SUBREAPER is unsupported."
                                    (not (process-exists? running)))
                           (local-output (l10n "PID ~a (~a) is dead!")
                                         running (service-canonical-name 
service))
-                            (respawn-service service))))))
+
+                          ;; Tell the process monitor, which in turn will
+                          ;; forward it to the service.  The status is
+                          ;; unknown, since we could not call 'waitpid' on it,
+                          ;; so provide an arbitrary value.  Terrible.
+                          (put-message (current-process-monitor)
+                                       `(handle-process-termination
+                                         ,running ,(ash 77 8))))))))
 
 (define %post-daemonize-hook
   ;; Hook invoked after the 'daemonize' action in the child process.



reply via email to

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