guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/15] build: syscalls: Add clone syscall wrapper.


From: Thompson, David
Subject: Re: [PATCH 05/15] build: syscalls: Add clone syscall wrapper.
Date: Tue, 7 Jul 2015 20:28:16 -0400

On Tue, Jul 7, 2015 at 9:23 AM, Ludovic Courtès <address@hidden> wrote:
> 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.)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]