[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 01/05: support: Remove 'buffering-mode' compatibility macro.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 01/05: support: Remove 'buffering-mode' compatibility macro. |
Date: |
Mon, 29 Aug 2022 11:18:08 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit f0ec1afdd1c8b5145ba33f0d4505d06b562dea3b
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Aug 29 16:55:59 2022 +0200
support: Remove 'buffering-mode' compatibility macro.
This macro is no longer needed because Guile >= 2.2 is required since
commit 3edbcaedbe4c456097a46a6214ddd249b014b0cf.
* modules/shepherd/support.scm (buffering-mode): Remove.
(initialize-cli): Adjust accordingly.
* modules/shepherd/comm.scm (open-connection)
(call-with-syslog-port): Likewise.
* tests/misbehaved-client.sh: Likewise.
---
modules/shepherd.scm | 2 +-
modules/shepherd/comm.scm | 8 ++++----
modules/shepherd/support.scm | 16 +++-------------
tests/misbehaved-client.sh | 4 ++--
4 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index cbc5eaa..9fbed1b 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -217,7 +217,7 @@ already ~a threads running, disabling 'signalfd' support")
(let next-command ()
(match (accept sock)
((command-source . client-address)
- (setvbuf command-source (buffering-mode block) 1024)
+ (setvbuf command-source 'block 1024)
(spawn-fiber
(lambda ()
(process-connection command-source))))
diff --git a/modules/shepherd/comm.scm b/modules/shepherd/comm.scm
index a993439..255f6ea 100644
--- a/modules/shepherd/comm.scm
+++ b/modules/shepherd/comm.scm
@@ -83,7 +83,7 @@ return the socket."
(catch 'system-error
(lambda ()
(connect sock address)
- (setvbuf sock (buffering-mode block) 1024))
+ (setvbuf sock 'block 1024))
(lambda (key proc format-string format-args errno . rest)
;; Guile's 'connect' throws an exception that doesn't specify
;; FILE. Augment it with this information.
@@ -244,7 +244,7 @@ mechanism."
(catch 'system-error
(lambda ()
(connect sock AF_UNIX "/dev/log")
- (setvbuf sock (buffering-mode line))
+ (setvbuf sock 'line)
(set! port sock)
(call/syslog))
(lambda args
@@ -255,14 +255,14 @@ mechanism."
(lambda ()
(call-with-output-file "/dev/kmsg"
(lambda (port)
- (setvbuf port (buffering-mode block))
+ (setvbuf port 'block)
(proc port))))
(lambda args
(if (memv (system-error-errno args)
(list ENOENT EACCES EPERM))
(call-with-output-file "/dev/console"
(lambda (port)
- (setvbuf port (buffering-mode none))
+ (setvbuf port 'none)
(proc port)))
(apply throw args))))
(apply throw args)))))))))
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index f85afda..a1f9d75 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -24,9 +24,7 @@
#:use-module (shepherd config)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
- #:export (buffering-mode
-
- caught-error
+ #:export (caught-error
assert
label
@@ -68,14 +66,6 @@
verify-dir))
-(define-syntax buffering-mode
- (syntax-rules (line block none)
- "Return the appropriate buffering mode depending on whether we're on Guile
-2.0 or later."
- ((_ line) 'line)
- ((_ block) 'block)
- ((_ none) 'none)))
-
;; Report the caught error.
;; FIXME: Needs some more work.
(define (caught-error key args)
@@ -204,8 +194,8 @@ output port, and PROC's result is returned."
(bindtextdomain %gettext-domain %localedir)
(textdomain %gettext-domain)
- (setvbuf (current-output-port) (buffering-mode line))
- (setvbuf (current-error-port) (buffering-mode line)))
+ (setvbuf (current-output-port) 'line)
+ (setvbuf (current-error-port) 'line))
;; Localized version of STR.
(define-syntax l10n
diff --git a/tests/misbehaved-client.sh b/tests/misbehaved-client.sh
index 7c55e06..7494223 100644
--- a/tests/misbehaved-client.sh
+++ b/tests/misbehaved-client.sh
@@ -1,5 +1,5 @@
# GNU Shepherd --- Make sure shepherd tolerates misbehaved clients.
-# Copyright © 2016, 2018 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2016, 2018, 2022 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of the GNU Shepherd.
#
@@ -68,7 +68,7 @@ $herd status # still here?
(use-modules (shepherd comm) (shepherd support))
(let ((sock (open-connection \"$socket\")))
- (setvbuf sock (buffering-mode block) 5000)
+ (setvbuf sock 'block 5000)
(write-command (shepherd-command 'status 'root) sock)
;; Close prematurely, right after sending the command.