unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#52887] [PATCH staging] containers: Add CLONE_NEWCGROUP cgroup namespace support
@ 2021-12-30  3:52 Ryan Sundberg via Guix-patches via
  2022-01-05 21:58 ` bug#52887: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ryan Sundberg via Guix-patches via @ 2021-12-30  3:52 UTC (permalink / raw)
  To: 52887; +Cc: Ryan Sundberg

Adds low-level support for launching linux containers with cgroup namespaces.

gnu/build/linux-container.scm (%namespaces): Add 'cgroup
guix/build/syscalls.scm (CLONE_NEWCGROUP): Add flag definition
---
 gnu/build/linux-container.scm | 3 ++-
 guix/build/syscalls.scm       | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 4a8bed5a9a..bdeca2cdb9 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -52,7 +52,7 @@ exists."
   (file-exists? "/proc/self/setgroups"))
 
 (define %namespaces
-  '(mnt pid ipc uts user net))
+  '(cgroup mnt pid ipc uts user net))
 
 (define (call-with-clean-exit thunk)
   "Apply THUNK, but exit with a status code of 1 if it fails."
@@ -210,6 +210,7 @@ corresponds to the symbols in NAMESPACES."
   ;; Use the same flags as fork(3) in addition to the namespace flags.
   (apply logior SIGCHLD
          (map (match-lambda
+               ('cgroup  CLONE_NEWCGROUP)
                ('mnt  CLONE_NEWNS)
                ('uts  CLONE_NEWUTS)
                ('ipc  CLONE_NEWIPC)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 45f95c509d..a7401fd73f 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -132,6 +132,7 @@
 
             CLONE_CHILD_CLEARTID
             CLONE_CHILD_SETTID
+            CLONE_NEWCGROUP
             CLONE_NEWNS
             CLONE_NEWUTS
             CLONE_NEWIPC
@@ -1025,6 +1026,7 @@ caller lacks root privileges."
 ;; Linux clone flags, from linux/sched.h
 (define CLONE_CHILD_CLEARTID #x00200000)
 (define CLONE_CHILD_SETTID   #x01000000)
+(define CLONE_NEWCGROUP      #x02000000)
 (define CLONE_NEWNS          #x00020000)
 (define CLONE_NEWUTS         #x04000000)
 (define CLONE_NEWIPC         #x08000000)
-- 
2.31.1





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#52887: [PATCH staging] containers: Add CLONE_NEWCGROUP cgroup namespace support
  2021-12-30  3:52 [bug#52887] [PATCH staging] containers: Add CLONE_NEWCGROUP cgroup namespace support Ryan Sundberg via Guix-patches via
@ 2022-01-05 21:58 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2022-01-05 21:58 UTC (permalink / raw)
  To: Ryan Sundberg; +Cc: 52887-done

Hi,

Ryan Sundberg <ryan@arctype.co> skribis:

> Adds low-level support for launching linux containers with cgroup namespaces.
>
> gnu/build/linux-container.scm (%namespaces): Add 'cgroup
> guix/build/syscalls.scm (CLONE_NEWCGROUP): Add flag definition

I tweaked the commit log and applied to ‘master’, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-05 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30  3:52 [bug#52887] [PATCH staging] containers: Add CLONE_NEWCGROUP cgroup namespace support Ryan Sundberg via Guix-patches via
2022-01-05 21:58 ` bug#52887: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).