1
0
mirror of https://github.com/systemd/systemd synced 2026-04-25 00:14:54 +02:00

Compare commits

..

No commits in common. "5674b74c4f99e433fd8e7242e9f16f6ddfece94c" and "c0da575a0e94e7ecae7f5f0c72dea0be853af352" have entirely different histories.

7 changed files with 45 additions and 86 deletions

View File

@ -205,34 +205,47 @@
<term><varname>HandleLidSwitchExternalPower=</varname></term> <term><varname>HandleLidSwitchExternalPower=</varname></term>
<term><varname>HandleLidSwitchDocked=</varname></term> <term><varname>HandleLidSwitchDocked=</varname></term>
<listitem><para>Controls how logind shall handle the system power, reboot and sleep keys and the lid <listitem><para>Controls how logind shall handle the
switch to trigger actions such as system power-off, reboot or suspend. Can be one of system power, reboot and sleep keys and the lid switch to trigger
<literal>ignore</literal>, <literal>poweroff</literal>, <literal>reboot</literal>, actions such as system power-off, reboot or suspend. Can be one of
<literal>halt</literal>, <literal>kexec</literal>, <literal>suspend</literal>, <literal>ignore</literal>,
<literal>hibernate</literal>, <literal>hybrid-sleep</literal>, <literal>poweroff</literal>,
<literal>suspend-then-hibernate</literal>, <literal>lock</literal>, and <literal>reboot</literal>,
<literal>factory-reset</literal>. If <literal>ignore</literal>, <command>systemd-logind</command> <literal>halt</literal>,
will never handle these keys. If <literal>lock</literal>, all running sessions will be screen-locked; <literal>kexec</literal>,
otherwise, the specified action will be taken in the respective event. Only input devices with the <literal>suspend</literal>,
<literal>power-switch</literal> udev tag will be watched for key/lid switch <literal>hibernate</literal>,
events.</para> <literal>hybrid-sleep</literal>,
<literal>suspend-then-hibernate</literal>,
<para><varname>HandlePowerKey=</varname> defaults to <literal>poweroff</literal>, <literal>lock</literal>, and
<varname>HandleRebootKey=</varname> defaults to <literal>reboot</literal>, <literal>factory-reset</literal>.
<varname>HandleSuspendKey=</varname> defaults to <literal>suspend</literal>, If <literal>ignore</literal>, logind will never handle these
<varname>HandleHibernateKey=</varname> defaults to <literal>hibernate</literal>, keys. If <literal>lock</literal>, all running sessions will be
<varname>HandlePowerKeyLongPress=</varname> defaults to <literal>ignore</literal>, screen-locked; otherwise, the specified action will be taken
<varname>HandleRebootKeyLongPress=</varname> defaults to <literal>poweroff</literal>, in the respective event. Only input devices with the
<varname>HandleSuspendKeyLongPress=</varname> defaults to <literal>hibernate</literal>, <literal>power-switch</literal> udev tag will be watched for
<varname>HandleHibernateKeyLongPress=</varname> defaults to <literal>ignore</literal>. key/lid switch events. <varname>HandlePowerKey=</varname>
<varname>HandleLidSwitch=</varname> defaults to <literal>suspend</literal>. defaults to <literal>poweroff</literal>, <varname>HandleRebootKey=</varname>
<varname>HandleLidSwitchExternalPower=</varname> is completely ignored by default (for backwards defaults to <literal>reboot</literal>, <varname>HandleSuspendKey=</varname>
compatibility) — an explicit value must be set before it will be used to determine defaults to <literal>suspend</literal>, <varname>HandleHibernateKey=</varname>
behaviour. <varname>HandleLidSwitchDocked=</varname> defaults to <literal>ignore</literal>. If the defaults to <literal>hibernate</literal>, <varname>HandlePowerKeyLongPress=</varname>
system is inserted in a docking station, or if more than one display is connected, the action defaults to <literal>ignore</literal>, <varname>HandleRebootKeyLongPress=</varname>
specified by <varname>HandleLidSwitchDocked=</varname> occurs; if the system is on external power the defaults to <literal>poweroff</literal>, <varname>HandleSuspendKeyLongPress=</varname>
action (if any) specified by <varname>HandleLidSwitchExternalPower=</varname> occurs; otherwise the defaults to <literal>hibernate</literal>, <varname>HandleHibernateKeyLongPress=</varname>
<varname>HandleLidSwitch=</varname> action occurs.</para> defaults to <literal>ignore</literal>.
<varname>HandleLidSwitch=</varname> defaults to
<literal>suspend</literal>.
<varname>HandleLidSwitchExternalPower=</varname> is completely
ignored by default (for backwards compatibility) — an explicit
value must be set before it will be used to determine
behaviour. <varname>HandleLidSwitchDocked=</varname> defaults
to <literal>ignore</literal>. If the system is inserted in a
docking station, or if more than one display is connected, the
action specified by <varname>HandleLidSwitchDocked=</varname>
occurs; if the system is on external power the action (if any)
specified by <varname>HandleLidSwitchExternalPower=</varname>
occurs; otherwise the <varname>HandleLidSwitch=</varname>
action occurs.</para>
<para>A different application may disable logind's handling of system power and <para>A different application may disable logind's handling of system power and
sleep keys and the lid switch by taking a low-level inhibitor lock sleep keys and the lid switch by taking a low-level inhibitor lock

View File

@ -194,20 +194,10 @@ node /org/freedesktop/login1 {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandlePowerKey = '...'; readonly s HandlePowerKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandlePowerKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleRebootKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleRebootKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleSuspendKey = '...'; readonly s HandleSuspendKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleSuspendKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleHibernateKey = '...'; readonly s HandleHibernateKey = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleHibernateKeyLongPress = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleLidSwitch = '...'; readonly s HandleLidSwitch = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HandleLidSwitchExternalPower = '...'; readonly s HandleLidSwitchExternalPower = '...';
@ -252,16 +242,6 @@ node /org/freedesktop/login1 {
}; };
</programlisting> </programlisting>
<!--property HandlePowerKeyLongPress is not documented!-->
<!--property HandleRebootKey is not documented!-->
<!--property HandleRebootKeyLongPress is not documented!-->
<!--property HandleSuspendKeyLongPress is not documented!-->
<!--property HandleHibernateKeyLongPress is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit--> <!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/> <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/>
@ -438,20 +418,10 @@ node /org/freedesktop/login1 {
<variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKey"/> <variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleRebootKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleRebootKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKey"/> <variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKey"/> <variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKey"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKeyLongPress"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitch"/> <variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitch"/>
<variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchExternalPower"/> <variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchExternalPower"/>

View File

@ -1000,7 +1000,7 @@ int config_parse_exec(
if (r < 0) if (r < 0)
return ignore ? 0 : -ENOEXEC; return ignore ? 0 : -ENOEXEC;
r = unit_full_printf(u, word, &resolved); r = unit_path_printf(u, word, &resolved);
if (r < 0) { if (r < 0) {
log_syntax(unit, ignore ? LOG_WARNING : LOG_ERR, filename, line, r, log_syntax(unit, ignore ? LOG_WARNING : LOG_ERR, filename, line, r,
"Failed to resolve unit specifiers in %s%s: %m", "Failed to resolve unit specifiers in %s%s: %m",

View File

@ -73,7 +73,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0); assert(argc >= 0);
assert(argv); assert(argv);
while ((c = getopt_long(argc, argv, "sr:h", options, NULL)) >= 0) while ((c = getopt_long(argc, argv, "ust:r:h", options, NULL)) >= 0)
switch (c) { switch (c) {
case 'h': case 'h':

View File

@ -3378,13 +3378,8 @@ static const sd_bus_vtable manager_vtable[] = {
SD_BUS_PROPERTY("InhibitDelayMaxUSec", "t", NULL, offsetof(Manager, inhibit_delay_max), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("InhibitDelayMaxUSec", "t", NULL, offsetof(Manager, inhibit_delay_max), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("UserStopDelayUSec", "t", NULL, offsetof(Manager, user_stop_delay), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("UserStopDelayUSec", "t", NULL, offsetof(Manager, user_stop_delay), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandlePowerKey", "s", property_get_handle_action, offsetof(Manager, handle_power_key), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HandlePowerKey", "s", property_get_handle_action, offsetof(Manager, handle_power_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandlePowerKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_power_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleRebootKey", "s", property_get_handle_action, offsetof(Manager, handle_reboot_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleRebootKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_reboot_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleSuspendKey", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HandleSuspendKey", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleSuspendKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleHibernateKey", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HandleHibernateKey", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleHibernateKeyLongPress", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key_long_press), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleLidSwitch", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HandleLidSwitch", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleLidSwitchExternalPower", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_ep), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HandleLidSwitchExternalPower", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_ep), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HandleLidSwitchDocked", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_docked), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HandleLidSwitchDocked", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_docked), SD_BUS_VTABLE_PROPERTY_CONST),

View File

@ -23,16 +23,13 @@
#InhibitDelayMaxSec=5 #InhibitDelayMaxSec=5
#UserStopDelaySec=10 #UserStopDelaySec=10
#HandlePowerKey=poweroff #HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend #HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate #HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
#HandleLidSwitch=suspend #HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend #HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore #HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#PowerKeyIgnoreInhibited=no #PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no #SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no #HibernateKeyIgnoreInhibited=no

View File

@ -10,7 +10,6 @@
#include "capability-util.h" #include "capability-util.h"
#include "conf-parser.h" #include "conf-parser.h"
#include "fd-util.h" #include "fd-util.h"
#include "fileio.h"
#include "format-util.h" #include "format-util.h"
#include "fs-util.h" #include "fs-util.h"
#include "hashmap.h" #include "hashmap.h"
@ -417,21 +416,6 @@ TEST(config_parse_exec) {
assert_se(r == 0); assert_se(r == 0);
assert_se(c1->command_next == NULL); assert_se(c1->command_next == NULL);
log_info("/* long arg */"); /* See issue #22957. */
char x[LONG_LINE_MAX-100], *y;
y = mempcpy(x, "/bin/echo ", STRLEN("/bin/echo "));
memset(y, 'x', sizeof(x) - STRLEN("/bin/echo ") - 1);
x[sizeof(x) - 1] = '\0';
r = config_parse_exec(NULL, "fake", 5, "section", 1,
"LValue", 0, x,
&c, u);
assert_se(r >= 0);
c1 = c1->command_next;
check_execcommand(c1,
"/bin/echo", NULL, y, NULL, false);
log_info("/* empty argument, reset */"); log_info("/* empty argument, reset */");
r = config_parse_exec(NULL, "fake", 4, "section", 1, r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "", "LValue", 0, "",