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.
This commit is contained in:
parent
0a17fd7c0b
commit
a8f3424b25
|
@ -110,9 +110,7 @@
|
||||||
termios-input-speed
|
termios-input-speed
|
||||||
termios-output-speed
|
termios-output-speed
|
||||||
local-flags
|
local-flags
|
||||||
TCSANOW
|
tcsetattr-action
|
||||||
TCSADRAIN
|
|
||||||
TCSAFLUSH
|
|
||||||
tcgetattr
|
tcgetattr
|
||||||
tcsetattr
|
tcsetattr
|
||||||
|
|
||||||
|
@ -1059,9 +1057,11 @@ given an integer, returns the list of names of the constants that are or'd."
|
||||||
(define EXTPROC #o0200000))
|
(define EXTPROC #o0200000))
|
||||||
|
|
||||||
;; "Actions" values for 'tcsetattr'.
|
;; "Actions" values for 'tcsetattr'.
|
||||||
(define TCSANOW 0)
|
(define-bits tcsetattr-action
|
||||||
(define TCSADRAIN 1)
|
%unused-tcsetattr-action->symbols
|
||||||
(define TCSAFLUSH 2)
|
(define TCSANOW 0)
|
||||||
|
(define TCSADRAIN 1)
|
||||||
|
(define TCSAFLUSH 2))
|
||||||
|
|
||||||
(define-record-type <termios>
|
(define-record-type <termios>
|
||||||
(termios input-flags output-flags control-flags local-flags
|
(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
|
(define tcsetattr
|
||||||
(let ((proc (syscall->procedure int "tcsetattr" (list int int '*))))
|
(let ((proc (syscall->procedure int "tcsetattr" (list int int '*))))
|
||||||
(lambda (fd actions termios)
|
(lambda (fd actions termios)
|
||||||
"Use TERMIOS for the tty at FD. ACTIONS is one of 'TCSANOW',
|
"Use TERMIOS for the tty at FD. ACTIONS is one of of the values
|
||||||
'TCSADRAIN', or 'TCSAFLUSH'; see tcsetattr(3) for details."
|
produced by 'tcsetattr-action'; see tcsetattr(3) for details."
|
||||||
(define bv
|
(define bv
|
||||||
(make-bytevector sizeof-termios))
|
(make-bytevector sizeof-termios))
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@
|
||||||
|
|
||||||
(test-assert "tcsetattr"
|
(test-assert "tcsetattr"
|
||||||
(let ((first (tcgetattr 0)))
|
(let ((first (tcgetattr 0)))
|
||||||
(tcsetattr 0 TCSANOW first)
|
(tcsetattr 0 (tcsetattr-action TCSANOW) first)
|
||||||
(equal? first (tcgetattr 0))))
|
(equal? first (tcgetattr 0))))
|
||||||
|
|
||||||
(test-assert "terminal-window-size ENOTTY"
|
(test-assert "terminal-window-size ENOTTY"
|
||||||
|
|
Loading…
Reference in New Issue