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'.
This commit is contained in:
David Thompson 2015-08-16 08:08:34 -04:00
parent 12a9f4af01
commit 39e336b5c8
1 changed files with 13 additions and 10 deletions

View File

@ -328,6 +328,9 @@ are shared between the parent and child processes."
(proc syscall-id flags %null-pointer))))
(define setns
;; 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)
@ -340,7 +343,7 @@ there is no such limitation."
(unless (zero? ret)
(throw 'system-error "setns" "~d ~d: ~A"
(list fdes nstype (strerror err))
(list err)))))))
(list err))))))))
(define pivot-root
(let* ((ptr (dynamic-func "pivot_root" (dynamic-link)))