summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-02 08:59:57 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-03 17:45:29 +0200
commita8f3424b25cbbc585126420bcc1434c4a2398588 (patch)
tree3077ac67697d9cb2cff83383239efe351b3fb7ae
parent0a17fd7c0b82ac315b68c88e6f206e0051dcd661 (diff)
downloadguix-a8f3424b25cbbc585126420bcc1434c4a2398588.tar.gz
guix-a8f3424b25cbbc585126420bcc1434c4a2398588.tar.xz
syscalls: Wrap TCSA* constants in 'tcsetattr-action' macro.
* guix/build/syscalls.scm (tcsetattr-action): New macro. (TCSANOW, TCSADRAIN, TCSAFLUSH): Remove. (tcsetattr): Adjust docstring accordingly. * tests/syscalls.scm ("tcsetattr"): Adjust accordingly.
-rw-r--r--guix/build/syscalls.scm16
-rw-r--r--tests/syscalls.scm2
2 files changed, 9 insertions, 9 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 4e543d70d8..a9cd6e93c8 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -110,9 +110,7 @@
termios-input-speed
termios-output-speed
local-flags
- TCSANOW
- TCSADRAIN
- TCSAFLUSH
+ tcsetattr-action
tcgetattr
tcsetattr
@@ -1059,9 +1057,11 @@ given an integer, returns the list of names of the constants that are or'd."
(define EXTPROC #o0200000))
;; "Actions" values for 'tcsetattr'.
-(define TCSANOW 0)
-(define TCSADRAIN 1)
-(define TCSAFLUSH 2)
+(define-bits tcsetattr-action
+ %unused-tcsetattr-action->symbols
+ (define TCSANOW 0)
+ (define TCSADRAIN 1)
+ (define TCSAFLUSH 2))
(define-record-type <termios>
(termios input-flags output-flags control-flags local-flags
@@ -1107,8 +1107,8 @@ given an integer, returns the list of names of the constants that are or'd."
(define tcsetattr
(let ((proc (syscall->procedure int "tcsetattr" (list int int '*))))
(lambda (fd actions termios)
- "Use TERMIOS for the tty at FD. ACTIONS is one of 'TCSANOW',
-'TCSADRAIN', or 'TCSAFLUSH'; see tcsetattr(3) for details."
+ "Use TERMIOS for the tty at FD. ACTIONS is one of of the values
+produced by 'tcsetattr-action'; see tcsetattr(3) for details."
(define bv
(make-bytevector sizeof-termios))
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index ab1e13984d..0b73fb4b0c 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -281,7 +281,7 @@
(test-assert "tcsetattr"
(let ((first (tcgetattr 0)))
- (tcsetattr 0 TCSANOW first)
+ (tcsetattr 0 (tcsetattr-action TCSANOW) first)
(equal? first (tcgetattr 0))))
(test-assert "terminal-window-size ENOTTY"