diff options
author | Nick Rosbrook <enr0n@ubuntu.com> | 2023-09-29 21:39:17 +0200 |
---|---|---|
committer | Nick Rosbrook <enr0n@ubuntu.com> | 2023-10-13 21:13:11 +0200 |
commit | 6cf96ab4568e39c534e6db6aa80a44fcf43b0c24 (patch) | |
tree | d598bdb20127c3580b1c08c8447af00ccc2fdba4 /src/basic/cgroup-util.c | |
parent | cgroup-util: add cg_is_delegated helper (diff) | |
download | systemd-6cf96ab4568e39c534e6db6aa80a44fcf43b0c24.tar.xz systemd-6cf96ab4568e39c534e6db6aa80a44fcf43b0c24.zip |
core: add CoredumpReceive= setting
This setting indicates that the given unit wants to receive coredumps
for processes that crash within the cgroup of this unit. This setting
requires that Delegate= is also true, and therefore is only available
where Delegate= is available.
This will be used by systemd-coredump to support forwarding coredumps to
containers.
Diffstat (limited to 'src/basic/cgroup-util.c')
-rw-r--r-- | src/basic/cgroup-util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 7df419d607..f4012f1c61 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -2287,6 +2287,18 @@ int cg_is_delegated(const char *path) { return r; } +int cg_has_coredump_receive(const char *path) { + int r; + + assert(path); + + r = cg_get_xattr_bool(path, "user.coredump_receive"); + if (ERRNO_IS_NEG_XATTR_ABSENT(r)) + return false; + + return r; +} + const uint64_t cgroup_io_limit_defaults[_CGROUP_IO_LIMIT_TYPE_MAX] = { [CGROUP_IO_RBPS_MAX] = CGROUP_LIMIT_MAX, [CGROUP_IO_WBPS_MAX] = CGROUP_LIMIT_MAX, |