coredump: optionally store coredumps on disk, not in the journal

Introduce a new configuration file /etc/systemd/coredump.conf to
configure when to place coredumps in the journal and when on disk.

Since the coredumps are quite large, default to storing them only on
disk.
This commit is contained in:
Lennart Poettering
2014-06-18 22:02:18 +02:00
parent 3bdace9bf7
commit 34c10968cb
7 changed files with 385 additions and 101 deletions

View File

@@ -3689,6 +3689,14 @@ systemd_coredump_LDADD = \
rootlibexec_PROGRAMS += \
systemd-coredump
dist_pkgsysconf_DATA += \
src/journal/coredump.conf
if HAVE_ACL
systemd_coredump_LDADD += \
libsystemd-acl.la
endif
systemd_coredumpctl_SOURCES = \
src/journal/coredumpctl.c

File diff suppressed because it is too large Load Diff

14
src/journal/coredump.conf Normal file
View File

@@ -0,0 +1,14 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# See coredump.conf(5) for details
[Coredump]
#Storage=external
#ProcessSizeMax=2G
#ExternalSizeMax=2G
#JournalSizeMax=767M

View File

@@ -205,7 +205,7 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
log_warning("Failed to fix access mode on %s, ignoring: %s", f->path, strerror(-r));
#ifdef HAVE_ACL
if (uid <= 0)
if (uid <= SYSTEM_UID_MAX)
return;
acl = acl_get_fd(f->fd);

View File

@@ -26,3 +26,11 @@
int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
int calc_acl_mask_if_needed(acl_t *acl_p);
int search_acl_groups(char*** dst, const char* path, bool* belong);
static inline void acl_freep(acl_t *acl) {
if (!*acl)
return;
acl_free(*acl);
}

View File

@@ -31,6 +31,7 @@
#define USE(x, y) do{ (x) = (y); (y) = NULL; } while(0)
int parse_sleep_config(const char *verb, char ***_modes, char ***_states) {
_cleanup_strv_free_ char
**suspend_mode = NULL, **suspend_state = NULL,
**hibernate_mode = NULL, **hibernate_state = NULL,
@@ -44,7 +45,8 @@ int parse_sleep_config(const char *verb, char ***_modes, char ***_states) {
{ "Sleep", "HibernateState", config_parse_strv, 0, &hibernate_state },
{ "Sleep", "HybridSleepMode", config_parse_strv, 0, &hybrid_mode },
{ "Sleep", "HybridSleepState", config_parse_strv, 0, &hybrid_state },
{}};
{}
};
int r;
FILE _cleanup_fclose_ *f;

View File

@@ -135,6 +135,7 @@ static int execute(char **modes, char **states) {
}
static int help(void) {
printf("%s COMMAND\n\n"
"Suspend the system, hibernate the system, or both.\n\n"
"Commands:\n"