[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/14: build: syscalls: Add pivot-root.
From: |
David Thompson |
Subject: |
06/14: build: syscalls: Add pivot-root. |
Date: |
Tue, 30 Jun 2015 01:54:07 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit 44cdb7c2a26ce9d2bf32e137432b0c4d7c3169dd
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 d877a12..f325837 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -45,6 +45,7 @@
swapon
swapoff
processes
+ pivot-root
CLONE_NEWNS
CLONE_NEWUTS
@@ -276,6 +277,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 53c036c), David Thompson, 2015/06/29
- 02/14: build: syscalls: Add setns syscall wrapper., David Thompson, 2015/06/29
- 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 <=
- 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
- 14/14: scripts: environment: Add --container option., David Thompson, 2015/06/29
- 08/14: gnu: build: Add Linux container module., David Thompson, 2015/06/29
- 11/14: gnu: system: Add Linux container module., David Thompson, 2015/06/29