mirror of
https://github.com/systemd/systemd.git
synced 2024-12-31 21:18:09 +03:00
Add config and kernel commandline option to use short identifiers
No functional change, just docs and configuration and parsing. v2: - change ShortIdentifiers=yes|no to StatusUnitFormat=name|description.
This commit is contained in:
parent
c1d95b713a
commit
36cf45078c
@ -59,6 +59,7 @@
|
||||
<term><varname>systemd.confirm_spawn</varname></term>
|
||||
<term><varname>systemd.service_watchdogs</varname></term>
|
||||
<term><varname>systemd.show_status</varname></term>
|
||||
<term><varname>systemd.status_unit_format=</varname></term>
|
||||
<term><varname>systemd.log_target=</varname></term>
|
||||
<term><varname>systemd.log_level=</varname></term>
|
||||
<term><varname>systemd.log_location=</varname></term>
|
||||
|
@ -244,6 +244,16 @@
|
||||
understood too.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>StatusUnitFormat=</varname></term>
|
||||
|
||||
<listitem><para>Takes either <option>name</option> or <option>description</option> as the value. If
|
||||
<option>name</option>, the system manager will use unit names in status messages, instead of the
|
||||
longer and more informative descriptions set with <varname>Description=</varname>, see
|
||||
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>DefaultTimerAccuracySec=</varname></term>
|
||||
|
||||
|
@ -1027,6 +1027,16 @@
|
||||
configuration file option.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>systemd.status_unit_format=</varname></term>
|
||||
|
||||
<listitem><para>Takes either <option>name</option> or <option>description</option> as the value. If
|
||||
<option>name</option>, the system manager will use unit names in status messages. If specified,
|
||||
overrides the system manager configuration file option <option>StatusUnitFormat=</option>, see
|
||||
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>systemd.log_target=</varname></term>
|
||||
<term><varname>systemd.log_level=</varname></term>
|
||||
|
@ -185,6 +185,7 @@ if pamconfdir == ''
|
||||
endif
|
||||
|
||||
memory_accounting_default = get_option('memory-accounting-default')
|
||||
status_unit_format_default = get_option('status-unit-format-default')
|
||||
|
||||
conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
|
||||
conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
|
||||
@ -238,6 +239,7 @@ conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysc
|
||||
conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
|
||||
conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
|
||||
conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
|
||||
conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
|
||||
|
||||
substs.set('prefix', prefixdir)
|
||||
substs.set('rootprefix', rootprefixdir)
|
||||
@ -278,6 +280,7 @@ substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
|
||||
substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
|
||||
substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
|
||||
substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
|
||||
substs.set('STATUS_UNIT_FORMAT_DEFAULT', status_unit_format_default)
|
||||
substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
|
||||
substs.set('BUILD_ROOT', meson.current_build_dir())
|
||||
|
||||
|
@ -163,6 +163,9 @@ option('default-hierarchy', type : 'combo',
|
||||
option('default-net-naming-scheme', type : 'combo',
|
||||
choices : ['latest', 'v238', 'v239', 'v240'],
|
||||
description : 'default net.naming-scheme= value')
|
||||
option('status-unit-format-default', type : 'combo',
|
||||
choices : ['description', 'name'],
|
||||
description : 'use unit name or description in messages by default')
|
||||
option('time-epoch', type : 'integer', value : '-1',
|
||||
description : 'time epoch for time clients')
|
||||
option('system-uid-max', type : 'integer', value : '-1',
|
||||
|
130
src/core/main.c
130
src/core/main.c
@ -107,6 +107,7 @@ static bool arg_crash_shell;
|
||||
static bool arg_crash_reboot;
|
||||
static char *arg_confirm_spawn;
|
||||
static ShowStatus arg_show_status;
|
||||
static StatusUnitFormat arg_status_unit_format;
|
||||
static bool arg_switched_root;
|
||||
static PagerFlags arg_pager_flags;
|
||||
static bool arg_service_watchdogs;
|
||||
@ -398,6 +399,17 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||
} else
|
||||
arg_show_status = SHOW_STATUS_YES;
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "systemd.status_unit_format")) {
|
||||
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
return 0;
|
||||
|
||||
r = status_unit_format_from_string(value);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse %s=%s, ignoring: %m", key, value);
|
||||
else
|
||||
arg_status_unit_format = r;
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "systemd.default_standard_output")) {
|
||||
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
@ -520,69 +532,71 @@ DEFINE_SETTER(config_parse_level2, log_set_max_level_from_string, "log level");
|
||||
DEFINE_SETTER(config_parse_target, log_set_target_from_string, "target");
|
||||
DEFINE_SETTER(config_parse_color, log_show_color_from_string, "color" );
|
||||
DEFINE_SETTER(config_parse_location, log_show_location_from_string, "location");
|
||||
DEFINE_SETTER(config_parse_status_unit_format, status_unit_format_from_string, "value");
|
||||
|
||||
static int parse_config_file(void) {
|
||||
|
||||
const ConfigTableItem items[] = {
|
||||
{ "Manager", "LogLevel", config_parse_level2, 0, NULL },
|
||||
{ "Manager", "LogTarget", config_parse_target, 0, NULL },
|
||||
{ "Manager", "LogColor", config_parse_color, 0, NULL },
|
||||
{ "Manager", "LogLocation", config_parse_location, 0, NULL },
|
||||
{ "Manager", "DumpCore", config_parse_bool, 0, &arg_dump_core },
|
||||
{ "Manager", "CrashChVT", /* legacy */ config_parse_crash_chvt, 0, &arg_crash_chvt },
|
||||
{ "Manager", "CrashChangeVT", config_parse_crash_chvt, 0, &arg_crash_chvt },
|
||||
{ "Manager", "CrashShell", config_parse_bool, 0, &arg_crash_shell },
|
||||
{ "Manager", "CrashReboot", config_parse_bool, 0, &arg_crash_reboot },
|
||||
{ "Manager", "ShowStatus", config_parse_show_status, 0, &arg_show_status },
|
||||
{ "Manager", "CPUAffinity", config_parse_cpu_affinity2, 0, &arg_cpu_affinity },
|
||||
{ "Manager", "NUMAPolicy", config_parse_numa_policy, 0, &arg_numa_policy.type },
|
||||
{ "Manager", "NUMAMask", config_parse_numa_mask, 0, &arg_numa_policy },
|
||||
{ "Manager", "JoinControllers", config_parse_warn_compat, DISABLED_CONFIGURATION, NULL },
|
||||
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
|
||||
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
|
||||
{ "Manager", "WatchdogDevice", config_parse_path, 0, &arg_watchdog_device },
|
||||
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
|
||||
{ "Manager", "NoNewPrivileges", config_parse_bool, 0, &arg_no_new_privs },
|
||||
{ "Manager", "LogLevel", config_parse_level2, 0, NULL },
|
||||
{ "Manager", "LogTarget", config_parse_target, 0, NULL },
|
||||
{ "Manager", "LogColor", config_parse_color, 0, NULL },
|
||||
{ "Manager", "LogLocation", config_parse_location, 0, NULL },
|
||||
{ "Manager", "DumpCore", config_parse_bool, 0, &arg_dump_core },
|
||||
{ "Manager", "CrashChVT", /* legacy */ config_parse_crash_chvt, 0, &arg_crash_chvt },
|
||||
{ "Manager", "CrashChangeVT", config_parse_crash_chvt, 0, &arg_crash_chvt },
|
||||
{ "Manager", "CrashShell", config_parse_bool, 0, &arg_crash_shell },
|
||||
{ "Manager", "CrashReboot", config_parse_bool, 0, &arg_crash_reboot },
|
||||
{ "Manager", "ShowStatus", config_parse_show_status, 0, &arg_show_status },
|
||||
{ "Manager", "StatusUnitFormat", config_parse_status_unit_format, 0, &arg_status_unit_format },
|
||||
{ "Manager", "CPUAffinity", config_parse_cpu_affinity2, 0, &arg_cpu_affinity },
|
||||
{ "Manager", "NUMAPolicy", config_parse_numa_policy, 0, &arg_numa_policy.type },
|
||||
{ "Manager", "NUMAMask", config_parse_numa_mask, 0, &arg_numa_policy },
|
||||
{ "Manager", "JoinControllers", config_parse_warn_compat, DISABLED_CONFIGURATION, NULL },
|
||||
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
|
||||
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
|
||||
{ "Manager", "WatchdogDevice", config_parse_path, 0, &arg_watchdog_device },
|
||||
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
|
||||
{ "Manager", "NoNewPrivileges", config_parse_bool, 0, &arg_no_new_privs },
|
||||
#if HAVE_SECCOMP
|
||||
{ "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs },
|
||||
{ "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs },
|
||||
#endif
|
||||
{ "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec },
|
||||
{ "Manager", "DefaultTimerAccuracySec", config_parse_sec, 0, &arg_default_timer_accuracy_usec },
|
||||
{ "Manager", "DefaultStandardOutput", config_parse_output_restricted,0, &arg_default_std_output },
|
||||
{ "Manager", "DefaultStandardError", config_parse_output_restricted,0, &arg_default_std_error },
|
||||
{ "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec },
|
||||
{ "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec },
|
||||
{ "Manager", "DefaultTimeoutAbortSec", config_parse_timeout_abort, 0, &arg_default_timeout_abort_set },
|
||||
{ "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec },
|
||||
{ "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval }, /* obsolete alias */
|
||||
{ "Manager", "DefaultStartLimitIntervalSec",config_parse_sec, 0, &arg_default_start_limit_interval },
|
||||
{ "Manager", "DefaultStartLimitBurst", config_parse_unsigned, 0, &arg_default_start_limit_burst },
|
||||
{ "Manager", "DefaultEnvironment", config_parse_environ, 0, &arg_default_environment },
|
||||
{ "Manager", "DefaultLimitCPU", config_parse_rlimit, RLIMIT_CPU, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitFSIZE", config_parse_rlimit, RLIMIT_FSIZE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitDATA", config_parse_rlimit, RLIMIT_DATA, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitSTACK", config_parse_rlimit, RLIMIT_STACK, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitCORE", config_parse_rlimit, RLIMIT_CORE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitRSS", config_parse_rlimit, RLIMIT_RSS, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitNOFILE", config_parse_rlimit, RLIMIT_NOFILE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitAS", config_parse_rlimit, RLIMIT_AS, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitNPROC", config_parse_rlimit, RLIMIT_NPROC, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitMEMLOCK", config_parse_rlimit, RLIMIT_MEMLOCK, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitLOCKS", config_parse_rlimit, RLIMIT_LOCKS, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitSIGPENDING", config_parse_rlimit, RLIMIT_SIGPENDING, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitMSGQUEUE", config_parse_rlimit, RLIMIT_MSGQUEUE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitNICE", config_parse_rlimit, RLIMIT_NICE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitRTPRIO", config_parse_rlimit, RLIMIT_RTPRIO, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitRTTIME", config_parse_rlimit, RLIMIT_RTTIME, arg_default_rlimit },
|
||||
{ "Manager", "DefaultCPUAccounting", config_parse_tristate, 0, &arg_default_cpu_accounting },
|
||||
{ "Manager", "DefaultIOAccounting", config_parse_bool, 0, &arg_default_io_accounting },
|
||||
{ "Manager", "DefaultIPAccounting", config_parse_bool, 0, &arg_default_ip_accounting },
|
||||
{ "Manager", "DefaultBlockIOAccounting", config_parse_bool, 0, &arg_default_blockio_accounting },
|
||||
{ "Manager", "DefaultMemoryAccounting", config_parse_bool, 0, &arg_default_memory_accounting },
|
||||
{ "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting },
|
||||
{ "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max },
|
||||
{ "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action },
|
||||
{ "Manager", "DefaultOOMPolicy", config_parse_oom_policy, 0, &arg_default_oom_policy },
|
||||
{ "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec },
|
||||
{ "Manager", "DefaultTimerAccuracySec", config_parse_sec, 0, &arg_default_timer_accuracy_usec },
|
||||
{ "Manager", "DefaultStandardOutput", config_parse_output_restricted, 0, &arg_default_std_output },
|
||||
{ "Manager", "DefaultStandardError", config_parse_output_restricted, 0, &arg_default_std_error },
|
||||
{ "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec },
|
||||
{ "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec },
|
||||
{ "Manager", "DefaultTimeoutAbortSec", config_parse_timeout_abort, 0, &arg_default_timeout_abort_set },
|
||||
{ "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec },
|
||||
{ "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval }, /* obsolete alias */
|
||||
{ "Manager", "DefaultStartLimitIntervalSec", config_parse_sec, 0, &arg_default_start_limit_interval },
|
||||
{ "Manager", "DefaultStartLimitBurst", config_parse_unsigned, 0, &arg_default_start_limit_burst },
|
||||
{ "Manager", "DefaultEnvironment", config_parse_environ, 0, &arg_default_environment },
|
||||
{ "Manager", "DefaultLimitCPU", config_parse_rlimit, RLIMIT_CPU, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitFSIZE", config_parse_rlimit, RLIMIT_FSIZE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitDATA", config_parse_rlimit, RLIMIT_DATA, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitSTACK", config_parse_rlimit, RLIMIT_STACK, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitCORE", config_parse_rlimit, RLIMIT_CORE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitRSS", config_parse_rlimit, RLIMIT_RSS, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitNOFILE", config_parse_rlimit, RLIMIT_NOFILE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitAS", config_parse_rlimit, RLIMIT_AS, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitNPROC", config_parse_rlimit, RLIMIT_NPROC, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitMEMLOCK", config_parse_rlimit, RLIMIT_MEMLOCK, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitLOCKS", config_parse_rlimit, RLIMIT_LOCKS, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitSIGPENDING", config_parse_rlimit, RLIMIT_SIGPENDING, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitMSGQUEUE", config_parse_rlimit, RLIMIT_MSGQUEUE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitNICE", config_parse_rlimit, RLIMIT_NICE, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitRTPRIO", config_parse_rlimit, RLIMIT_RTPRIO, arg_default_rlimit },
|
||||
{ "Manager", "DefaultLimitRTTIME", config_parse_rlimit, RLIMIT_RTTIME, arg_default_rlimit },
|
||||
{ "Manager", "DefaultCPUAccounting", config_parse_tristate, 0, &arg_default_cpu_accounting },
|
||||
{ "Manager", "DefaultIOAccounting", config_parse_bool, 0, &arg_default_io_accounting },
|
||||
{ "Manager", "DefaultIPAccounting", config_parse_bool, 0, &arg_default_ip_accounting },
|
||||
{ "Manager", "DefaultBlockIOAccounting", config_parse_bool, 0, &arg_default_blockio_accounting },
|
||||
{ "Manager", "DefaultMemoryAccounting", config_parse_bool, 0, &arg_default_memory_accounting },
|
||||
{ "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting },
|
||||
{ "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max },
|
||||
{ "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action },
|
||||
{ "Manager", "DefaultOOMPolicy", config_parse_oom_policy, 0, &arg_default_oom_policy },
|
||||
{}
|
||||
};
|
||||
|
||||
@ -662,6 +676,7 @@ static void set_manager_settings(Manager *m) {
|
||||
m->cad_burst_action = arg_cad_burst_action;
|
||||
|
||||
manager_set_show_status(m, arg_show_status);
|
||||
m->status_unit_format = arg_status_unit_format;
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
@ -2061,6 +2076,7 @@ static void reset_arguments(void) {
|
||||
arg_crash_reboot = false;
|
||||
arg_confirm_spawn = mfree(arg_confirm_spawn);
|
||||
arg_show_status = _SHOW_STATUS_INVALID;
|
||||
arg_status_unit_format = STATUS_UNIT_FORMAT_DEFAULT;
|
||||
arg_switched_root = false;
|
||||
arg_pager_flags = 0;
|
||||
arg_service_watchdogs = true;
|
||||
|
@ -734,6 +734,8 @@ int manager_new(UnitFileScope scope, ManagerTestRunFlags test_run_flags, Manager
|
||||
.unit_file_scope = scope,
|
||||
.objective = _MANAGER_OBJECTIVE_INVALID,
|
||||
|
||||
.status_unit_format = STATUS_UNIT_FORMAT_DEFAULT,
|
||||
|
||||
.default_timer_accuracy_usec = USEC_PER_MINUTE,
|
||||
.default_memory_accounting = MEMORY_ACCOUNTING_DEFAULT,
|
||||
.default_tasks_accounting = true,
|
||||
|
@ -323,6 +323,7 @@ struct Manager {
|
||||
uint8_t return_value;
|
||||
|
||||
ShowStatus show_status;
|
||||
StatusUnitFormat status_unit_format;
|
||||
char *confirm_spawn;
|
||||
bool no_console_output;
|
||||
bool service_watchdogs;
|
||||
|
@ -178,6 +178,7 @@ systemd_sources = files('main.c')
|
||||
|
||||
in_files = [['macros.systemd', rpmmacrosdir],
|
||||
['system.conf', pkgsysconfdir],
|
||||
['user.conf', pkgsysconfdir],
|
||||
['systemd.pc', pkgconfigdatadir],
|
||||
['triggers.systemd', '']]
|
||||
|
||||
@ -204,9 +205,6 @@ policy = configure_file(
|
||||
install_data(policy,
|
||||
install_dir : polkitpolicydir)
|
||||
|
||||
install_data('user.conf',
|
||||
install_dir : pkgsysconfdir)
|
||||
|
||||
meson.add_install_script('sh', '-c', mkdir_p.format(systemshutdowndir))
|
||||
meson.add_install_script('sh', '-c', mkdir_p.format(systemsleepdir))
|
||||
meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir))
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include "util.h"
|
||||
|
||||
static const char* const show_status_table[_SHOW_STATUS_MAX] = {
|
||||
[SHOW_STATUS_NO] = "no",
|
||||
[SHOW_STATUS_AUTO] = "auto",
|
||||
[SHOW_STATUS_NO] = "no",
|
||||
[SHOW_STATUS_AUTO] = "auto",
|
||||
[SHOW_STATUS_TEMPORARY] = "temporary",
|
||||
[SHOW_STATUS_YES] = "yes",
|
||||
[SHOW_STATUS_YES] = "yes",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(show_status, ShowStatus, SHOW_STATUS_YES);
|
||||
@ -118,3 +118,10 @@ int status_printf(const char *status, ShowStatusFlags flags, const char *format,
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static const char* const status_unit_format_table[_STATUS_UNIT_FORMAT_MAX] = {
|
||||
[STATUS_UNIT_FORMAT_NAME] = "name",
|
||||
[STATUS_UNIT_FORMAT_DESCRIPTION] = "description",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(status_unit_format, StatusUnitFormat);
|
||||
|
@ -21,9 +21,19 @@ typedef enum ShowStatusFlags {
|
||||
SHOW_STATUS_EPHEMERAL = 1 << 1,
|
||||
} ShowStatusFlags;
|
||||
|
||||
typedef enum StatusUnitFormat {
|
||||
STATUS_UNIT_FORMAT_NAME,
|
||||
STATUS_UNIT_FORMAT_DESCRIPTION,
|
||||
_STATUS_UNIT_FORMAT_MAX,
|
||||
_STATUS_UNIT_FORMAT_INVALID = -1,
|
||||
} StatusUnitFormat;
|
||||
|
||||
ShowStatus show_status_from_string(const char *v) _const_;
|
||||
const char* show_status_to_string(ShowStatus s) _pure_;
|
||||
int parse_show_status(const char *v, ShowStatus *ret);
|
||||
|
||||
StatusUnitFormat status_unit_format_from_string(const char *v) _const_;
|
||||
const char* status_unit_format_to_string(StatusUnitFormat s) _pure_;
|
||||
|
||||
int status_vprintf(const char *status, ShowStatusFlags flags, const char *format, va_list ap) _printf_(3,0);
|
||||
int status_printf(const char *status, ShowStatusFlags flags, const char *format, ...) _printf_(3,4);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#NoNewPrivileges=no
|
||||
#SystemCallArchitectures=
|
||||
#TimerSlackNSec=
|
||||
#StatusUnitFormat=@STATUS_UNIT_FORMAT_DEFAULT@
|
||||
#DefaultTimerAccuracySec=1min
|
||||
#DefaultStandardOutput=journal
|
||||
#DefaultStandardError=inherit
|
||||
|
@ -17,6 +17,7 @@
|
||||
#LogLocation=no
|
||||
#SystemCallArchitectures=
|
||||
#TimerSlackNSec=
|
||||
#StatusUnitFormat=@STATUS_UNIT_FORMAT_DEFAULT@
|
||||
#DefaultTimerAccuracySec=1min
|
||||
#DefaultStandardOutput=inherit
|
||||
#DefaultStandardError=inherit
|
Loading…
Reference in New Issue
Block a user