mirror of
https://github.com/systemd/systemd.git
synced 2024-12-12 03:33:44 +08:00
Merge pull request #1512 from evverx/systemd-run-syslog-properties
systemd-run can launch units with SyslogIdentifier and SyslogLevelPrefix
This commit is contained in:
commit
2c882b8bfa
@ -83,7 +83,7 @@ _systemd_run() {
|
||||
LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE=
|
||||
LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices=
|
||||
PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory=
|
||||
TTYPath='
|
||||
TTYPath= SyslogIdentifier= SyslogLevelPrefix='
|
||||
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
return 0
|
||||
|
@ -856,7 +856,32 @@ int bus_exec_context_set_transient_property(
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else if (streq(name, "SyslogIdentifier")) {
|
||||
const char *id;
|
||||
|
||||
r = sd_bus_message_read(message, "s", &id);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (mode != UNIT_CHECK) {
|
||||
|
||||
if (isempty(id)) {
|
||||
c->syslog_identifier = mfree(c->syslog_identifier);
|
||||
} else {
|
||||
char *t;
|
||||
|
||||
t = strdup(id);
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
||||
free(c->syslog_identifier);
|
||||
c->syslog_identifier = t;
|
||||
}
|
||||
|
||||
unit_write_drop_in_private_format(u, mode, name, "SyslogIdentifier=%s\n", id);
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else if (streq(name, "Nice")) {
|
||||
int n;
|
||||
|
||||
@ -998,7 +1023,7 @@ int bus_exec_context_set_transient_property(
|
||||
} else if (STR_IN_SET(name,
|
||||
"IgnoreSIGPIPE", "TTYVHangup", "TTYReset",
|
||||
"PrivateTmp", "PrivateDevices", "PrivateNetwork",
|
||||
"NoNewPrivileges")) {
|
||||
"NoNewPrivileges", "SyslogLevelPrefix")) {
|
||||
int b;
|
||||
|
||||
r = sd_bus_message_read(message, "b", &b);
|
||||
@ -1020,6 +1045,8 @@ int bus_exec_context_set_transient_property(
|
||||
c->private_network = b;
|
||||
else if (streq(name, "NoNewPrivileges"))
|
||||
c->no_new_privileges = b;
|
||||
else if (streq(name, "SyslogLevelPrefix"))
|
||||
c->syslog_level_prefix = b;
|
||||
|
||||
unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, yes_no(b));
|
||||
}
|
||||
|
@ -1426,7 +1426,8 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
|
||||
"CPUAccounting", "MemoryAccounting", "BlockIOAccounting", "TasksAccounting",
|
||||
"SendSIGHUP", "SendSIGKILL", "WakeSystem", "DefaultDependencies",
|
||||
"IgnoreSIGPIPE", "TTYVHangup", "TTYReset", "RemainAfterExit",
|
||||
"PrivateTmp", "PrivateDevices", "PrivateNetwork", "NoNewPrivileges")) {
|
||||
"PrivateTmp", "PrivateDevices", "PrivateNetwork", "NoNewPrivileges",
|
||||
"SyslogLevelPrefix")) {
|
||||
|
||||
r = parse_boolean(eq);
|
||||
if (r < 0) {
|
||||
@ -1493,7 +1494,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
|
||||
"UtmpIdentifier", "UtmpMode", "PAMName", "TTYPath",
|
||||
"StandardInput", "StandardOutput", "StandardError",
|
||||
"Description", "Slice", "Type", "WorkingDirectory",
|
||||
"RootDirectory"))
|
||||
"RootDirectory", "SyslogIdentifier"))
|
||||
r = sd_bus_message_append(m, "v", "s", eq);
|
||||
|
||||
else if (streq(field, "DeviceAllow")) {
|
||||
|
Loading…
Reference in New Issue
Block a user