From ce2bfb856987526c2f27fb934b5eedd70d3472d7 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Netto Date: Thu, 24 Aug 2023 13:42:17 -0300 Subject: linux: Add posix_spawnattr_{get, set}cgroup_np (BZ 26371) These functions allow to posix_spawn and posix_spawnp to use CLONE_INTO_CGROUP with clone3, allowing the child process to be created in a different cgroup version 2. These are GNU extensions that are available only for Linux, and also only for the architectures that implement clone3 wrapper (HAVE_CLONE3_WRAPPER). To create a process on a different cgroupv2, one can use the: posix_spawnattr_t attr; posix_spawnattr_init (&attr); posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETCGROUP); posix_spawnattr_setcgroup_np (&attr, cgroup); posix_spawn (...) Similar to other posix_spawn flags, POSIX_SPAWN_SETCGROUP control whether the cgroup file descriptor will be used or not with clone3. There is no fallback if either clone3 does not support the flag or if the architecture does not provide the clone3 wrapper, in this case posix_spawn returns EOPNOTSUPP. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer --- sysdeps/unix/sysv/linux/arc/libc.abilist | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sysdeps/unix/sysv/linux/arc') diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist index dfe0c3f7b6..d7ed2f66de 100644 --- a/sysdeps/unix/sysv/linux/arc/libc.abilist +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist @@ -2434,3 +2434,5 @@ GLIBC_2.38 strlcat F GLIBC_2.38 strlcpy F GLIBC_2.38 wcslcat F GLIBC_2.38 wcslcpy F +GLIBC_2.39 posix_spawnattr_getcgroup_np F +GLIBC_2.39 posix_spawnattr_setcgroup_np F -- cgit 1.4.1