guix-commits
[Top][All Lists]
Advanced

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

[dmd] 01/04: 'halt' and 'reboot' connect to the system socket.


From: Ludovic Courtès
Subject: [dmd] 01/04: 'halt' and 'reboot' connect to the system socket.
Date: Thu, 07 Jan 2016 23:09:22 +0000

civodul pushed a commit to branch master
in repository dmd.

commit 536574127cd8759b46eaf42d5d280efbc8ae5c16
Author: Ludovic Courtès <address@hidden>
Date:   Thu Jan 7 21:38:50 2016 +0100

    'halt' and 'reboot' connect to the system socket.
    
    * modules/dmd/support.scm (%system-socket-dir): New variable.
    (default-socket-dir): Use it.
    (%system-socket-file): New variable.
    * modules/halt.scm (main): Use %SYSTEM-SOCKET-FILE.
    * modules/reboot.scm (main): Likewise.
---
 modules/dmd/support.scm |   13 +++++++++++--
 modules/halt.scm        |    4 ++--
 modules/reboot.scm      |    4 ++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules/dmd/support.scm b/modules/dmd/support.scm
index 7eacc70..d13d260 100644
--- a/modules/dmd/support.scm
+++ b/modules/dmd/support.scm
@@ -1,6 +1,6 @@
 ;; support.scm -- Various support facilities, used by deco and dmd.
 ;; Copyright (C) 2014 A.Sassmannshausen <address@hidden>
-;; Copyright (C) 2013, 2014 Ludovic Courtès <address@hidden>
+;; Copyright (C) 2013, 2014, 2016 Ludovic Courtès <address@hidden>
 ;; Copyright (C) 2002, 2003 Wolfgang Jährling <address@hidden>
 ;;
 ;; This file is part of GNU dmd.
@@ -40,6 +40,7 @@
             default-config-file
             default-socket-dir
             default-socket-file
+            %system-socket-file
             default-persistency-state-file
 
             load-in-user-module
@@ -224,16 +225,24 @@ create a template configuration file if non exists."
             (make-bare-init-file config-file))
         config-file)))
 
+;; Socket directory for the system's instance (PID 1).
+(define %system-socket-dir
+  (string-append %localstatedir "/run/dmd"))
+
 ;; The directory where the socket resides.
 (define default-socket-dir
   (if (zero? (getuid))
-      (string-append %localstatedir "/run/dmd")
+      %system-socket-dir
       (string-append user-dmddir "/run")))
 
 ;; Unix domain socket for receiving commands in dmd.
 (define default-socket-file
   (string-append default-socket-dir "/socket"))
 
+;; Location of the socket of the system's instance (PID 1).
+(define %system-socket-file
+  (string-append %system-socket-dir "/socket"))
+
 ;; Saving the state on exit.
 (define default-persistency-state-file
   (if (zero? (getuid))
diff --git a/modules/halt.scm b/modules/halt.scm
index 3cf71ab..ad42daf 100644
--- a/modules/halt.scm
+++ b/modules/halt.scm
@@ -1,5 +1,5 @@
 ;; halt.scm -- Halt or power off the system.
-;; Copyright (C) 2013, 2014, 2015 Ludovic Courtès <address@hidden>
+;; Copyright (C) 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;
 ;; This file is part of GNU dmd.
 ;;
@@ -33,7 +33,7 @@
 (define (main . args)
   (false-if-exception (setlocale LC_ALL ""))
 
-  (let ((socket-file default-socket-file)
+  (let ((socket-file %system-socket-file)
        (command-args '()))
     (process-args program-name args
                  ""
diff --git a/modules/reboot.scm b/modules/reboot.scm
index b366d9e..45aeaf5 100644
--- a/modules/reboot.scm
+++ b/modules/reboot.scm
@@ -1,5 +1,5 @@
 ;; reboot.scm -- Reboot the system.
-;; Copyright (C) 2013, 2014, 2015 Ludovic Courtès <address@hidden>
+;; Copyright (C) 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 ;;
 ;; This file is part of GNU dmd.
 ;;
@@ -33,7 +33,7 @@
 (define (main . args)
   (false-if-exception (setlocale LC_ALL ""))
 
-  (let ((socket-file default-socket-file)
+  (let ((socket-file %system-socket-file)
        (command-args '()))
     (process-args program-name args
                  ""



reply via email to

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