syscalls: Use 'syscall->procedure' everywhere.
* guix/build/syscalls.scm (mkdtemp!, setns, %ioctl, network-interfaces): (free-ifaddrs): Use 'syscall->procedure'.
This commit is contained in:
parent
1752a17a1e
commit
d1f33ba44b
|
@ -494,8 +494,7 @@ user-land process."
|
||||||
<))
|
<))
|
||||||
|
|
||||||
(define mkdtemp!
|
(define mkdtemp!
|
||||||
(let* ((ptr (dynamic-func "mkdtemp" (dynamic-link)))
|
(let ((proc (syscall->procedure '* "mkdtemp" '(*))))
|
||||||
(proc (pointer->procedure '* ptr '(*))))
|
|
||||||
(lambda (tmpl)
|
(lambda (tmpl)
|
||||||
"Create a new unique directory in the file system using the template
|
"Create a new unique directory in the file system using the template
|
||||||
string TMPL and return its file name. TMPL must end with 'XXXXXX'."
|
string TMPL and return its file name. TMPL must end with 'XXXXXX'."
|
||||||
|
@ -626,8 +625,7 @@ are shared between the parent and child processes."
|
||||||
;; Some systems may be using an old (pre-2.14) version of glibc where there
|
;; Some systems may be using an old (pre-2.14) version of glibc where there
|
||||||
;; is no 'setns' function available.
|
;; is no 'setns' function available.
|
||||||
(false-if-exception
|
(false-if-exception
|
||||||
(let* ((ptr (dynamic-func "setns" (dynamic-link)))
|
(let ((proc (syscall->procedure int "setns" (list int int))))
|
||||||
(proc (pointer->procedure int ptr (list int int))))
|
|
||||||
(lambda (fdes nstype)
|
(lambda (fdes nstype)
|
||||||
"Reassociate the current process with the namespace specified by FDES, a
|
"Reassociate the current process with the namespace specified by FDES, a
|
||||||
file descriptor obtained by opening a /proc/PID/ns/* file. NSTYPE specifies
|
file descriptor obtained by opening a /proc/PID/ns/* file. NSTYPE specifies
|
||||||
|
@ -833,9 +831,7 @@ bytevector BV at INDEX."
|
||||||
|
|
||||||
(define %ioctl
|
(define %ioctl
|
||||||
;; The most terrible interface, live from Scheme.
|
;; The most terrible interface, live from Scheme.
|
||||||
(pointer->procedure int
|
(syscall->procedure int "ioctl" (list int unsigned-long '*)))
|
||||||
(dynamic-func "ioctl" (dynamic-link))
|
|
||||||
(list int unsigned-long '*)))
|
|
||||||
|
|
||||||
(define (bytevector->string-list bv stride len)
|
(define (bytevector->string-list bv stride len)
|
||||||
"Return the null-terminated strings found in BV every STRIDE bytes. Read at
|
"Return the null-terminated strings found in BV every STRIDE bytes. Read at
|
||||||
|
@ -1075,8 +1071,7 @@ return the list of resulting <interface> objects."
|
||||||
(loop ptr (cons ifaddr result)))))))
|
(loop ptr (cons ifaddr result)))))))
|
||||||
|
|
||||||
(define network-interfaces
|
(define network-interfaces
|
||||||
(let* ((ptr (dynamic-func "getifaddrs" (dynamic-link)))
|
(let ((proc (syscall->procedure int "getifaddrs" (list '*))))
|
||||||
(proc (pointer->procedure int ptr (list '*))))
|
|
||||||
(lambda ()
|
(lambda ()
|
||||||
"Return a list of <interface> objects, each denoting a configured
|
"Return a list of <interface> objects, each denoting a configured
|
||||||
network interface. This is implemented using the 'getifaddrs' libc function."
|
network interface. This is implemented using the 'getifaddrs' libc function."
|
||||||
|
@ -1093,8 +1088,7 @@ network interface. This is implemented using the 'getifaddrs' libc function."
|
||||||
(list err)))))))
|
(list err)))))))
|
||||||
|
|
||||||
(define free-ifaddrs
|
(define free-ifaddrs
|
||||||
(let ((ptr (dynamic-func "freeifaddrs" (dynamic-link))))
|
(syscall->procedure void "freeifaddrs" '(*)))
|
||||||
(pointer->procedure void ptr '(*))))
|
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Reference in New Issue