aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-13 17:57:25 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-13 18:05:54 +0200
commitd1f33ba44b60526d20da04d384f3af5437f8a3ae (patch)
treef012eeee7a71c0038c5b0723651f920d483b27b0
parent1752a17a1e6f7138892eeeb4806cd04ccb3ca1b0 (diff)
downloadpatches-d1f33ba44b60526d20da04d384f3af5437f8a3ae.tar
patches-d1f33ba44b60526d20da04d384f3af5437f8a3ae.tar.gz
syscalls: Use 'syscall->procedure' everywhere.
* guix/build/syscalls.scm (mkdtemp!, setns, %ioctl, network-interfaces): (free-ifaddrs): Use 'syscall->procedure'.
-rw-r--r--guix/build/syscalls.scm16
1 files changed, 5 insertions, 11 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index ed0eb060d9..c663899160 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -494,8 +494,7 @@ user-land process."
<))
(define mkdtemp!
- (let* ((ptr (dynamic-func "mkdtemp" (dynamic-link)))
- (proc (pointer->procedure '* ptr '(*))))
+ (let ((proc (syscall->procedure '* "mkdtemp" '(*))))
(lambda (tmpl)
"Create a new unique directory in the file system using the template
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
;; is no 'setns' function available.
(false-if-exception
- (let* ((ptr (dynamic-func "setns" (dynamic-link)))
- (proc (pointer->procedure int ptr (list int int))))
+ (let ((proc (syscall->procedure int "setns" (list int int))))
(lambda (fdes nstype)
"Reassociate the current process with the namespace specified by FDES, a
file descriptor obtained by opening a /proc/PID/ns/* file. NSTYPE specifies
@@ -833,9 +831,7 @@ bytevector BV at INDEX."
(define %ioctl
;; The most terrible interface, live from Scheme.
- (pointer->procedure int
- (dynamic-func "ioctl" (dynamic-link))
- (list int unsigned-long '*)))
+ (syscall->procedure int "ioctl" (list int unsigned-long '*)))
(define (bytevector->string-list bv stride len)
"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)))))))
(define network-interfaces
- (let* ((ptr (dynamic-func "getifaddrs" (dynamic-link)))
- (proc (pointer->procedure int ptr (list '*))))
+ (let ((proc (syscall->procedure int "getifaddrs" (list '*))))
(lambda ()
"Return a list of <interface> objects, each denoting a configured
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)))))))
(define free-ifaddrs
- (let ((ptr (dynamic-func "freeifaddrs" (dynamic-link))))
- (pointer->procedure void ptr '(*))))
+ (syscall->procedure void "freeifaddrs" '(*)))
;;;