Subject: Re: [bug#70494] [PATCH 13/23] syscalls: Add unshare.

From: Ludovic Courtès <[email-masked]>
Date: Thu, 16 May 2024 18:14:47 +0200

Christopher Baines <[email-masked]> skribis:

> * guix/build/syscalls.scm (unshare): New procedure.
>
> Change-Id: I7caad207117b17b349290e680277f650c51d2f3b

[...]

> +(define unshare
> +  (false-if-exception
> +   (let ((proc (syscall->procedure int "unshare" (list int))))
> +     (lambda (flags)
> +       (let ((ret err (proc flags)))
> +         (unless (zero? ret)
> +           (throw 'system-error "unshare" "~d ~d: ~A"
> +                  (list flags (strerror err))
> +                  (list err))))))))

Please remove ‘false-if-exception’, add a docstring, and add a test or
two.

(I find that unshare(2) is not that useful because a process cannot
unshare(2) its PID namespace: it has to fork to do that.  At that point,
one might as well call clone(CLONE_NEWPID) directly.)

Ludo’.