[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/15] build: syscalls: Add clone syscall wrapper.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 05/15] build: syscalls: Add clone syscall wrapper. |
Date: |
Tue, 07 Jul 2015 15:23:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
David Thompson <address@hidden> skribis:
> From: David Thompson <address@hidden>
>
> * 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.)
> + (match (clone (logior CLONE_NEWUSER))
No need for logior.
> + (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.
Thanks,
Ludo’.
[PATCH 06/15] build: syscalls: Add setns syscall wrapper., David Thompson, 2015/07/06
[PATCH 10/15] gnu: system: Move file-system->spec to (gnu system file-systems)., David Thompson, 2015/07/06