From 253ee27a0c7a410d27d490bb79ea97caed6a2b68 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 23 Jul 2011 04:15:38 +0200 Subject: manager: add log control via RT signals --- TODO | 32 +++++++------------------------- man/systemd.xml | 38 ++++++++++++++++++++++++++++++++++++++ src/manager.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index 62bea4109d..82bc9950a6 100644 --- a/TODO +++ b/TODO @@ -36,7 +36,7 @@ Features: * logind: non-local X11 server handling -* logind: use sysfs path in device hash table instead of syname, as soon as fb driver is fixed +* logind: use sysfs path in device hash table instead of sysname, as soon as fb driver is fixed * possibly apply systemd-sysctl per network device subtrees on hotplug @@ -59,7 +59,9 @@ Features: * readahead: check whether a btrfs volume includes ssd by checking mount flag "ssd" -* support sd_notify() style notificatio when reload is finished (RELOADED=1) +* support sd_notify() style notification when reload is finished (RELOADED=1) + +* support sf_notify() style notification when shutting down, to make auto-exit bus services work * verify that the AF_UNIX sockets of a service in the fs still exist when we start a service in order to avoid confusion when a user @@ -68,8 +70,6 @@ Features: * Make it possible to set the keymap independently from the font on the kernel cmdline. Right now setting one resets also the other. -* add dbus call to convert snapshot into target - * move nss-myhostname into systemd * figure out a standard place to configure timezone name, inform myllynen@redhat.com @@ -84,14 +84,8 @@ Features: * allow list of paths in config_parse_condition_path() -* introduce dbus calls for enabling/disabling a service - -* support notifications for services being enabled/disabled - * show enablement status in systemctl status -* consider services with any kind of link in /etc/systemd/system enabled - * teach systemctl to enable unit files in arbitrary directories * In systemctl make sure both is-enabled and is-active print a string, or neither. @@ -101,6 +95,8 @@ Features: systemctl unmask Also support --temp to make this temporary by placing mask links in /run. +* perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable" + * add support for /bin/mount -s * GC unreferenced jobs (such as .device jobs) @@ -120,8 +116,8 @@ Features: * write blog stories about: - enabling dbus services - status update - - /etc/sysconfig and /etc/default - how to make changes to sysctl and sysfs attributes + - remote access * allow port=0 in .socket units @@ -189,12 +185,8 @@ Features: * make sure timeouts are applied to Type=oneshot services. -* detect LXC environment - * investigate whether the gnome pty helper should be moved into systemd, to provide cgroup support. -* perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable" - * need a way to apply mount options of api vfs from systemd unit files (or some other modern source?) instead of fstab? @@ -218,16 +210,6 @@ Features: * systemd --user - get PR_SET_ANCHOR merged: http://lkml.org/lkml/2010/2/2/165 -* add VT tracking: - - provide CK functionality - - start getty only when actual vt switch happens (same model as - socket on-demand activation). allocate the next free tty and - start a getty there. this way, pressing alt-f[1-12] will switch - through running X and getty sessions, and any unallocated - activated tty will start a new getty. the hardcoding of - getty[1-6] will entirely go away. - - http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbc92a3455577ab17615cbcb91826399061bd789 - * implicitly import "defaults" settings file into all types * port over to LISTEN_FDS/LISTEN_PID: diff --git a/man/systemd.xml b/man/systemd.xml index 142c1d6a05..5129fbb050 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -800,6 +800,44 @@ on the kernel command line. + + + SIGRTMIN+22 + SIGRTMIN+23 + + Sets the log level to + debug + (resp. info on + SIGRTMIN+32), as + controlled via + systemd.log_level=debug + (resp. systemd.log_level=info + on SIGRTMIN+23) on + the kernel command + line. + + + + SIGRTMIN+27 + SIGRTMIN+28 + SIGRTMIN+29 + + Sets the log level to + console + (resp. kmsg on + SIGRTMIN+28; + resp.syslog-or-kmsg + on SIGRTMIN+29), as + controlled via + systemd.log_target=console + (resp. systemd.log_target=kmsg + on SIGRTMIN+28; + resp + systemd.log_target=syslog-or-kmsg + on SIGRTMIN+29) on + the kernel command + line. + diff --git a/src/manager.c b/src/manager.c index c1242ae8b3..cdd618e148 100644 --- a/src/manager.c +++ b/src/manager.c @@ -186,6 +186,11 @@ static int manager_setup_signals(Manager *m) { SIGRTMIN+16, /* systemd: Immediate kexec */ SIGRTMIN+20, /* systemd: enable status messages */ SIGRTMIN+21, /* systemd: disable status messages */ + SIGRTMIN+22, /* systemd: set log level to LOG_DEBUG */ + SIGRTMIN+23, /* systemd: set log level to LOG_INFO */ + SIGRTMIN+27, /* systemd: set log target to console */ + SIGRTMIN+28, /* systemd: set log target to kmsg */ + SIGRTMIN+29, /* systemd: set log target to syslog-or-kmsg */ -1); assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); @@ -2200,6 +2205,7 @@ static int manager_process_signal_fd(Manager *m) { break; default: { + /* Starting SIGRTMIN+0 */ static const char * const target_table[] = { [0] = SPECIAL_DEFAULT_TARGET, @@ -2244,6 +2250,31 @@ static int manager_process_signal_fd(Manager *m) { m->show_status = false; break; + case 22: + log_set_max_level(LOG_DEBUG); + log_notice("Setting log level to debug."); + break; + + case 23: + log_set_max_level(LOG_INFO); + log_notice("Setting log level to info."); + break; + + case 27: + log_set_target(LOG_TARGET_CONSOLE); + log_notice("Setting log target to console."); + break; + + case 28: + log_set_target(LOG_TARGET_KMSG); + log_notice("Setting log target to kmsg."); + break; + + case 29: + log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_notice("Setting log target to syslog-or-kmsg."); + break; + default: log_warning("Got unhandled signal <%s>.", strna(signal_to_string(sfsi.ssi_signo))); } -- cgit v1.2.3-54-g00ecf