[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/15: build: syscalls: Add mkdtemp!
From: |
David Thompson |
Subject: |
06/15: build: syscalls: Add mkdtemp! |
Date: |
Thu, 02 Jul 2015 00:58:58 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit 138bbc90cbde4dce1b2b61372ebb705f0a8663fd
Author: David Thompson <address@hidden>
Date: Wed Jun 24 20:50:34 2015 -0400
build: syscalls: Add mkdtemp!
* guix/build/syscalls.scm (mkdtemp!): 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 7fb353e..2ac1263 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -46,6 +46,7 @@
swapoff
processes
pivot-root
+ mkdtemp!
CLONE_NEWNS
CLONE_NEWUTS
@@ -289,6 +290,20 @@ system to PUT-OLD."
(list new-root put-old (strerror err))
(list err)))))))
+(define mkdtemp!
+ (let* ((ptr (dynamic-func "mkdtemp" (dynamic-link)))
+ (proc (pointer->procedure '* ptr '(*))))
+ (lambda (tmpl)
+ "Create a new unique directory in the file system using the template
+string TMPL and return its file name. TMPL must end with 'XXXXXX'."
+ (let ((result (proc (string->pointer tmpl)))
+ (err (errno)))
+ (when (null-pointer? result)
+ (throw 'system-error "mkdtemp!" "mkdtemp ~S: ~A"
+ (list tmpl (strerror err))
+ (list err)))
+ (pointer->string result)))))
+
;; Linux clone flags, from linux/sched.h
(define CLONE_NEWNS #x00020000)
(define CLONE_NEWUTS #x04000000)
- branch wip-container created (now a3cbf11), David Thompson, 2015/07/01
- 02/15: build: syscalls: Add setns syscall wrapper., David Thompson, 2015/07/01
- 03/15: build: syscalls: Add additional mount flags., David Thompson, 2015/07/01
- 04/15: build: syscalls: Add unmount flags., David Thompson, 2015/07/01
- 05/15: build: syscalls: Add pivot-root., David Thompson, 2015/07/01
- 06/15: build: syscalls: Add mkdtemp!,
David Thompson <=
- 07/15: utils: Add call-with-temporary-directory., David Thompson, 2015/07/01
- 01/15: build: syscalls: Add clone syscall wrapper., David Thompson, 2015/07/01
- 10/15: gnu: system: Move file-system->spec to (gnu system file-systems)., David Thompson, 2015/07/01
- 09/15: gnu: system: Move <file-system-mapping> into (gnu system file-systems)., David Thompson, 2015/07/01
- 12/15: gnu: system: Add Linux container file systems., David Thompson, 2015/07/01
- 11/15: gnu: system: Add Linux container module., David Thompson, 2015/07/01
- 14/15: scripts: environment: Add --container option., David Thompson, 2015/07/01
- 08/15: gnu: build: Add Linux container module., David Thompson, 2015/07/01
- 15/15: scripts: Add 'container' subcommand., David Thompson, 2015/07/01
- 13/15: scripts: system: Add 'container' subcommand., David Thompson, 2015/07/01