guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 01/03: Remove traces of "persistency" (sic) support.


From: Ludovic Courtès
Subject: [shepherd] 01/03: Remove traces of "persistency" (sic) support.
Date: Sun, 26 Feb 2023 16:40:49 -0500 (EST)

civodul pushed a commit to branch master
in repository shepherd.

commit 82a91544ed00481e0d87920ba2fbdb2894ecc210
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Feb 25 23:00:52 2023 +0100

    Remove traces of "persistency" (sic) support.
    
    This functionality was untested and would have been hard to use.
    
    * modules/shepherd.scm (run-daemon): Remove #:persistency and related
    code.  Adjust caller.
    (main): Remove '--persistency' option.
    * modules/shepherd/service.scm (shutdown-services): Remove traces of
    persistency.
    (root-service): Remove the 'persistency' and 'no-persistency' actions.
    * modules/shepherd/support.scm (default-persistency-state-file)
    (persistency, persistency-state-file): Remove.
---
 doc/shepherd.texi            |  6 +-----
 modules/shepherd.scm         | 23 ++---------------------
 modules/shepherd/service.scm | 29 +++--------------------------
 modules/shepherd/support.scm | 14 --------------
 4 files changed, 6 insertions(+), 66 deletions(-)

diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index 6ac5d0b..b4275e6 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -301,7 +301,7 @@ using with the additional argument @code{list-actions}.
 $ herd doc root
 The root service is used to operate on shepherd itself.
 $ herd doc root list-actions
-root (help status halt power-off load eval unload reload daemonize persistency 
no-persistency cd restart)
+root (help status halt power-off load eval unload reload daemonize cd restart)
 $ herd doc root action power-off
 power-off: Halt the system and turn it off.
 @end example
@@ -440,10 +440,6 @@ is the case on other operating systems, it falls back to
 When @command{shepherd} is ready to accept connections, write its PID to 
@var{file} or
 to the standard output if @var{file} is omitted.
 
-@item -p [@var{file}]
-@itemx --persistency[=@var{file}]
-@c FIXME-CRITICAL
-
 @item -s @var{file}
 @itemx --socket=@var{file}
 @cindex socket special file
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 2949f77..1d51db1 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -165,7 +165,7 @@ already ~a threads running, disabling 'signalfd' support")
            (fcntl fd F_SETFD (logior FD_CLOEXEC flags)))))
       (loop (+ fd 1)))))
 
-(define* (run-daemon #:key (config-file (default-config-file)) persistency
+(define* (run-daemon #:key (config-file (default-config-file))
                      socket-file pid-file signal-port poll-services?)
   ;; We might have file descriptors inherited from our parent, as well as file
   ;; descriptors wrongfully opened by Guile or Fibers (see
@@ -183,15 +183,6 @@ already ~a threads running, disabling 'signalfd' support")
     (lambda (key . args)
       (caught-error key args)
       (quit 1)))
-  ;; Start what was started last time.
-  (and persistency
-       (catch 'system-error
-         (lambda ()
-           (start-in-order (read (open-input-file
-                                  persistency-state-file))))
-         (lambda (key . args)
-           (apply format #f (gettext (cadr args)) (caddr args))
-           (quit 1))))
 
   ;; Ignore SIGPIPE so that we don't die if a client closes the connection
   ;; prematurely.
@@ -288,15 +279,6 @@ already ~a threads running, disabling 'signalfd' support")
                  ""
                  "This is a service manager for Unix and GNU."
                  not ;; Fail on unknown args.
-                 (make <option>
-                   #:long "persistency" #:short #\p
-                   #:takes-arg? #t #:optional-arg? #t
-                    #:arg-name (l10n "FILE")
-                   #:description (l10n "use FILE to load and store state")
-                   #:action (lambda (file)
-                              (set! persistency #t)
-                              (and file
-                                   (set! persistency-state-file file))))
                  (make <option>
                    #:long "quiet"
                    #:takes-arg? #f
@@ -439,8 +421,7 @@ already ~a threads running, disabling 'signalfd' support")
                             #:config-file config-file
                             #:pid-file pid-file
                             #:signal-port signal-port
-                            #:poll-services? poll-services?
-                            #:persistency persistency)))
+                            #:poll-services? poll-services?)))
             (case-lambda
               ((key value . _)
                (primitive-exit value))
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index b94f387..4a4824a 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -2364,8 +2364,7 @@ requested to be removed."
 ;; The 'root' service.
 
 (define (shutdown-services)
-  "Shut down all the currently running services; update the persistent state
-file when persistence is enabled."
+  "Shut down all the currently running services."
   (let ((running-services '()))
     ;; Note: Do not use 'for-each-service' since it introduces a continuation
     ;; barrier via 'hash-fold', thereby preventing the 'stop' method from
@@ -2373,17 +2372,8 @@ file when persistence is enabled."
     (for-each
      (lambda (service)
        (when (running? service)
-         (stop service)
-         (when persistency
-           (set! running-services
-                 (cons (canonical-name service)
-                       running-services)))))
-     (service-list))
-
-    (when persistency
-      (call-with-output-file persistency-state-file
-        (lambda (p)
-          (format p "~{~a ~}~%" running-services))))))
+         (stop service)))
+     (service-list))))
 
 (define (check-for-dead-services)
   "Poll each process that we expect to be running, and respawn any which have
@@ -2517,19 +2507,6 @@ we want to receive these signals."
                      (catch-system-error (prctl PR_SET_CHILD_SUBREAPER 1))
                      #t)
                    (primitive-exit 0))))))
-     (persistency
-      "Save the current state of running and non-running services.
-This status gets written into a file on termination, so that we can
-restore the status on next startup.  Optionally, you can pass a file
-name as argument that will be used to store the status."
-      (lambda* (running #:optional (file #f))
-               (set! persistency #t)
-               (when file
-                 (set! persistency-state-file file))))
-     (no-persistency
-      "Don't save state in a file on exit."
-      (lambda (running)
-       (set! persistency #f)))
      (cd
       "Change the working directory of shepherd.  This only makes sense
 when in interactive mode, i.e. with `--socket=none'."
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index ed02d89..f629b5d 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -52,14 +52,10 @@
             default-socket-dir
             default-socket-file
             %system-socket-file
-            default-persistency-state-file
 
             load-in-user-module
             eval-in-user-module
 
-            persistency
-            persistency-state-file
-
             %user-log-dir
             %user-config-dir
             %user-runtime-dir
@@ -341,16 +337,6 @@ create a template configuration file if non exists."
 (define %system-socket-file
   (string-append %system-socket-dir "/socket"))
 
-;; Saving the state on exit.
-(define default-persistency-state-file
-  (if (zero? (getuid))
-      (string-append %localstatedir "/lib/shepherd/state")
-      (string-append %user-config-dir "/state")))
-
-;; Global variables set from (shepherd).
-(define persistency #f)
-(define persistency-state-file default-persistency-state-file)
-
 (define (make-user-module)
   "Return a new module, for use when evaluating the user's configuration,
 which has essential bindings pulled in."



reply via email to

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