From 8950ed11c6a0d51be056b3509f3ab269787696e9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 31 May 2015 20:26:47 -0400 Subject: build: syscalls: Add clone. * guix/build/syscalls.scm (clone): New procedure. (CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWUSER, CLONE_NEWPID, CLONE_NEWNET): New variables. * tests/syscalls.scm ("clone"): New test. --- tests/syscalls.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/syscalls.scm') diff --git a/tests/syscalls.scm b/tests/syscalls.scm index 049ca93267..4bc6f0332c 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -76,6 +76,21 @@ (rmdir dir) #t)))) +(define (user-namespace pid) + (string-append "/proc/" (number->string pid) "/ns/user")) + +(test-assert "clone" + (match (clone (logior CLONE_NEWUSER SIGCHLD)) + (0 (primitive-exit 42)) + (pid + ;; Check if user namespaces are different. + (and (not (equal? (readlink (user-namespace pid)) + (readlink (user-namespace (getpid))))) + (match (waitpid pid) + ((_ . status) + (= 42 (status:exit-val status)))))))) + + (test-assert "all-network-interfaces" (match (all-network-interfaces) (((? string? names) ..1) -- cgit v1.2.3