[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/15: build: syscalls: Add pivot-root.
From: |
David Thompson |
Subject: |
05/15: build: syscalls: Add pivot-root. |
Date: |
Fri, 03 Jul 2015 19:34:57 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit eabe5ee29cf0aebeac9e988d17c11593f46e2ce1
Author: David Thompson <address@hidden>
Date: Thu Jun 25 20:17:46 2015 -0400
build: syscalls: Add pivot-root.
* guix/build/syscalls.scm (pivot-root): 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 61877bf..7fb353e 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -45,6 +45,7 @@
swapon
swapoff
processes
+ pivot-root
CLONE_NEWNS
CLONE_NEWUTS
@@ -274,6 +275,20 @@ user-land process."
(scandir "/proc"))
<))
+(define pivot-root
+ (let* ((ptr (dynamic-func "pivot_root" (dynamic-link)))
+ (proc (pointer->procedure int ptr (list '* '*))))
+ (lambda (new-root put-old)
+ "Change the root file system to NEW-ROOT and move the current root file
+system to PUT-OLD."
+ (let ((ret (proc (string->pointer new-root)
+ (string->pointer put-old)))
+ (err (errno)))
+ (unless (zero? ret)
+ (throw 'system-error "pivot_root" "~S ~S: ~A"
+ (list new-root put-old (strerror err))
+ (list err)))))))
+
;; Linux clone flags, from linux/sched.h
(define CLONE_NEWNS #x00020000)
(define CLONE_NEWUTS #x04000000)
- branch wip-container created (now 33f2e7a), David Thompson, 2015/07/03
- 02/15: build: syscalls: Add setns syscall wrapper., David Thompson, 2015/07/03
- 01/15: build: syscalls: Add clone syscall wrapper., David Thompson, 2015/07/03
- 03/15: build: syscalls: Add additional mount flags., David Thompson, 2015/07/03
- 06/15: build: syscalls: Add mkdtemp!, David Thompson, 2015/07/03
- 07/15: utils: Add call-with-temporary-directory., David Thompson, 2015/07/03
- 04/15: build: syscalls: Add unmount flags., David Thompson, 2015/07/03
- 05/15: build: syscalls: Add pivot-root.,
David Thompson <=
- 09/15: gnu: system: Move <file-system-mapping> into (gnu system file-systems)., David Thompson, 2015/07/03
- 10/15: gnu: system: Move file-system->spec to (gnu system file-systems)., David Thompson, 2015/07/03
- 08/15: gnu: build: Add Linux container module., David Thompson, 2015/07/03
- 11/15: gnu: system: Add Linux container module., David Thompson, 2015/07/03
- 12/15: gnu: system: Add Linux container file systems., David Thompson, 2015/07/03
- 13/15: scripts: system: Add 'container' action., David Thompson, 2015/07/03
- 14/15: scripts: environment: Add --container option., David Thompson, 2015/07/03
- 15/15: scripts: Add 'container' subcommand., David Thompson, 2015/07/03