On Tue, Jul 7, 2015 at 9:23 AM, Ludovic Courtès <l...@gnu.org> wrote: > David Thompson <dthomps...@worcester.edu> skribis: > >> From: David Thompson <da...@gnu.org> >> >> * guix/build/syscalls.scm (clone): New procedure. >> (CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWUSER, CLONE_NEWPID, >> CLONE_NEWNET): New variables. >> * tests/syscalls.scm: Test it. > > [...] > >> +;; The libc interface to sys_clone is not useful for Scheme programs, so the >> +;; low-level system call is wrapped instead. >> +(define clone >> + (let* ((ptr (dynamic-func "syscall" (dynamic-link))) >> + (proc (pointer->procedure int ptr (list int int '*))) >> + ;; TODO: Handle all supported architectures >> + (syscall-id (match (utsname:machine (uname)) >> + ("x86_64" 56) >> + (_ 120)))) > > Please add the value for at least i386, mips64el, and armv7 (grep -r > NR_clone arch/ in the kernel tree.)
Done. I should mention that Mark really doesn't like this, and rightfully so. How can we make this more portable in the future? >> + (match (clone (logior CLONE_NEWUSER)) > > No need for logior. I ended up needing it because I had to add the SIGCHLD flag. :) >> + (0 (primitive-exit 0)) > > Maybe exit with code 42 here... > >> + (pid >> + ;; Check if user namespaces are different. >> + (not (equal? (readlink (user-namespace pid)) >> + (readlink (user-namespace "self"))))))) > > ... and here to a waitpid and check the status:exit-val. > > OK with these changes. Done and pushed. Thanks! - Dave