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.
This commit is contained in:
Nick Rosbrook
2023-10-13 15:13:11 -04:00
parent b426b4eed8
commit 6cf96ab456
7 changed files with 59 additions and 3 deletions
+12
View File
@@ -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,
+2
View File
@@ -212,6 +212,8 @@ int cg_is_threaded(const char *path);
int cg_is_delegated(const char *path);
int cg_has_coredump_receive(const char *path);
typedef enum {
CG_KEY_MODE_GRACEFUL = 1 << 0,
} CGroupKeyMode;