]> git.ipfire.org Git - thirdparty/systemd.git/commit
process-util: always retry with pidfd_spawn() w/o cgroup first 34053/head
authorMike Yuan <me@yhndnzj.com>
Tue, 20 Aug 2024 18:04:46 +0000 (20:04 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 21 Aug 2024 13:27:57 +0000 (15:27 +0200)
commite06c5be29adbc38b3797c251fe78dbc6ebefa639
treeb531e28b5ce715d0c860d29391b27fc1e2c5e386
parentdf99a8ef3db84453fbe5acaa313ea7524b3ebb70
process-util: always retry with pidfd_spawn() w/o cgroup first

Follow-up for 7ac58157ca67ab001307f1fd72e0cc7c0c4e846a

With the mentioned commit, iff E2BIG we'd retry pidfd_spawn()
with POSIX_SPAWN_SETCGROUP disabled. However, the same strategy
should actually apply to EOPNOTSUPP/ENOSYS/EPERM too -
they can mean two things here: no clone3() or no CLONE_PIDFD.
Therefore, let's first try clone() + CLONE_PIDFD, and fall further back
to plain clone() (posix_spawn()) only as last resort. Plus, record
the fact so that we don't unnecessarily retry every single time
if CLONE_PIDFD is the one that's unavailable.
src/basic/process-util.c