[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/13: build: syscalls: Add pivot-root.
From: |
David Thompson |
Subject: |
06/13: build: syscalls: Add pivot-root. |
Date: |
Fri, 26 Jun 2015 00:27:34 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit 831a6f5d26b329c37f1abb1e67ae4a8c33cc6f10
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 b6e60c9..1e2afb8 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 bfd304b), David Thompson, 2015/06/25
- 01/13: build: syscalls: Add clone syscall wrapper., David Thompson, 2015/06/25
- 04/13: build: syscalls: Add unmount flags., David Thompson, 2015/06/25
- 02/13: build: syscalls: Add setns syscall wrapper., David Thompson, 2015/06/25
- 03/13: build: syscalls: Add additional mount flags., David Thompson, 2015/06/25
- 05/13: build: syscalls: Add mkdtemp!, David Thompson, 2015/06/25
- 06/13: build: syscalls: Add pivot-root.,
David Thompson <=
- 07/13: utils: Add call-with-temporary-directory., David Thompson, 2015/06/25
- 09/13: gnu: Add Linux container system script., David Thompson, 2015/06/25
- 10/13: gnu: system: Do not activate firmware when activating a container., David Thompson, 2015/06/25
- 08/13: gnu: Add Linux container module., David Thompson, 2015/06/25
- 11/13: gnu: system: Add operating-system-derivation/container., David Thompson, 2015/06/25
- 12/13: scripts: system: Add 'container' subcommand., David Thompson, 2015/06/25
- 13/13: scripts: environment: Add --container option., David Thompson, 2015/06/25