[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/11: build: syscalls: Add mkdtemp!
From: |
David Thompson |
Subject: |
04/11: build: syscalls: Add mkdtemp! |
Date: |
Thu, 25 Jun 2015 01:48:12 +0000 |
davexunit pushed a commit to branch wip-container
in repository guix.
commit ad3145e4cd47e7731395f15a054e58dca97f3521
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 | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 72a91a5..0d4d37e 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -62,7 +62,9 @@
set-network-interface-flags
set-network-interface-address
set-network-interface-up
- configure-network-interface))
+ configure-network-interface
+
+ mkdtemp!))
;;; Commentary:
;;;
@@ -630,4 +632,18 @@ the same type as that returned by 'make-socket-address'."
(lambda ()
(close-port sock)))))
-;;; syscalls.scm ends here
+(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)))))
+
+;;; syscalls.scm ends her
- branch wip-container created (now cee7d21), David Thompson, 2015/06/24
- 04/11: build: syscalls: Add mkdtemp!,
David Thompson <=
- 03/11: build: syscalls: Add additional mount flags., David Thompson, 2015/06/24
- 01/11: build: syscalls: Add clone syscall wrapper., David Thompson, 2015/06/24
- 05/11: utils: Add call-with-temporary-directory., David Thompson, 2015/06/24
- 02/11: build: syscalls: Add setns syscall wrapper., David Thompson, 2015/06/24
- 08/11: gnu: system: Do not activate firmware when activating a container., David Thompson, 2015/06/24
- 06/11: gnu: Add Linux container module., David Thompson, 2015/06/24
- 07/11: gnu: Add Linux container system script., David Thompson, 2015/06/24
- 09/11: gnu: system: Add operating-system-derivation/container., David Thompson, 2015/06/24
- 10/11: scripts: system: Add 'container' subcommand., David Thompson, 2015/06/24
- 11/11: scripts: environment: Add --container option., David Thompson, 2015/06/24