coredump: introduce an enum to wrap dumpable constants

Two constants are described in the man page, but are not defined by a header.
The third constant is described in the kernel docs. Use explicit values to
show that those are values are defined externally.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-05-29 00:12:10 +02:00
parent e6a8687b93
commit 76e0ab49c4
2 changed files with 12 additions and 5 deletions
+7
View File
@@ -28,6 +28,13 @@ typedef enum CoredumpFilter {
/* The kernel doesn't like UINT64_MAX and returns ERANGE, use UINT32_MAX to support future new flags */
#define COREDUMP_FILTER_MASK_ALL UINT32_MAX
typedef enum SuidDumpMode {
SUID_DUMP_DISABLE = 0, /* PR_SET_DUMPABLE(2const) */
SUID_DUMP_USER = 1, /* PR_SET_DUMPABLE(2const) */
SUID_DUMP_SAFE = 2, /* https://www.kernel.org/doc/html/latest/admin-guide/sysctl/fs.html#suid-dumpable */
_SUID_DUMP_MODE_MAX,
} SuidDumpMode;
const char* coredump_filter_to_string(CoredumpFilter i) _const_;
CoredumpFilter coredump_filter_from_string(const char *s) _pure_;
int coredump_filter_mask_from_string(const char *s, uint64_t *ret);