aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-08-16 08:08:34 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-08-17 14:51:18 -0400
commit39e336b5c83e652feb1c3ac962b0929ca8466763 (patch)
tree69a711abda4d55e2d32543039fce5dbed2c96796
parent12a9f4af016130cdfd4563c144df5a852eecb52e (diff)
downloadpatches-39e336b5c83e652feb1c3ac962b0929ca8466763.tar
patches-39e336b5c83e652feb1c3ac962b0929ca8466763.tar.gz
syscalls: setns: Skip binding if there is no such C function.
On systems with a glibc prior to 2.14, the 'setns' function is not available. Thanks to Eric Bavier for reporting the issue. * guix/build/syscalls.scm (setns): Wrap with 'false-if-exception'.
-rw-r--r--guix/build/syscalls.scm23
1 files changed, 13 insertions, 10 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 68f340ce7b..fc801a5e9d 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -328,19 +328,22 @@ are shared between the parent and child processes."
(proc syscall-id flags %null-pointer))))
(define setns
- (let* ((ptr (dynamic-func "setns" (dynamic-link)))
- (proc (pointer->procedure int ptr (list int int))))
- (lambda (fdes nstype)
- "Reassociate the current process with the namespace specified by FDES, a
+ ;; 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))))
+ (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
which type of namespace the current process may be reassociated with, or 0 if
there is no such limitation."
- (let ((ret (proc fdes nstype))
- (err (errno)))
- (unless (zero? ret)
- (throw 'system-error "setns" "~d ~d: ~A"
- (list fdes nstype (strerror err))
- (list err)))))))
+ (let ((ret (proc fdes nstype))
+ (err (errno)))
+ (unless (zero? ret)
+ (throw 'system-error "setns" "~d ~d: ~A"
+ (list fdes nstype (strerror err))
+ (list err))))))))
(define pivot-root
(let* ((ptr (dynamic-func "pivot_root" (dynamic-link)))