[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/14: build: syscalls: Add setns syscall wrapper.
From: |
David Thompson |
Subject: |
02/14: build: syscalls: Add setns syscall wrapper. |
Date: |
Tue, 30 Jun 2015 01:54:05 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit 02f7ba82814c72e23f6a4f31b5a6fb067def3a9b
Author: David Thompson <address@hidden>
Date: Mon Jun 8 08:43:05 2015 -0400
build: syscalls: Add setns syscall wrapper.
* guix/build/syscalls.scm (setns): New procedure.
---
guix/build/syscalls.scm | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 3346358..6794d9d 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -45,6 +45,7 @@
CLONE_NEWPID
CLONE_NEWNET
clone
+ setns
IFF_UP
IFF_BROADCAST
@@ -279,6 +280,20 @@ Unlike the fork system call, clone accepts FLAGS that
specify which resources
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.
+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)))))))
+
;;;
;;; Packed structures.
- branch wip-container created (now 53c036c), David Thompson, 2015/06/29
- 02/14: build: syscalls: Add setns syscall wrapper.,
David Thompson <=
- 04/14: build: syscalls: Add unmount flags., David Thompson, 2015/06/29
- 05/14: build: syscalls: Add mkdtemp!, David Thompson, 2015/06/29
- 01/14: build: syscalls: Add clone syscall wrapper., David Thompson, 2015/06/29
- 06/14: build: syscalls: Add pivot-root., David Thompson, 2015/06/29
- 03/14: build: syscalls: Add additional mount flags., David Thompson, 2015/06/29
- 07/14: utils: Add call-with-temporary-directory., David Thompson, 2015/06/29
- 09/14: gnu: system: Move <file-system-mapping> into (gnu system file-systems)., David Thompson, 2015/06/29
- 12/14: gnu: system: Add Linux container file systems., David Thompson, 2015/06/29
- 10/14: gnu: system: Move file-system->spec to (gnu system file-systems)., David Thompson, 2015/06/29
- 13/14: scripts: system: Add 'container' subcommand., David Thompson, 2015/06/29