guix-patches
[Top][All Lists]
Advanced

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

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


From: Ludovic Courtès
Subject: [bug#70494] [PATCH 13/23] syscalls: Add unshare.
Date: Thu, 16 May 2024 18:14:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Christopher Baines <mail@cbaines.net> 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’.





reply via email to

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