mirror of
https://github.com/systemd/systemd
synced 2026-04-24 07:55:12 +02:00
Compare commits
6 Commits
c0da575a0e
...
5674b74c4f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5674b74c4f | ||
|
|
80b7f7118e | ||
|
|
58dd4999dc | ||
|
|
30e0343b1c | ||
|
|
acc63800bc | ||
|
|
c4db78fce6 |
@ -205,47 +205,34 @@
|
|||||||
<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
|
<listitem><para>Controls how logind shall handle the system power, reboot and sleep keys and the lid
|
||||||
system power, reboot and sleep keys and the lid switch to trigger
|
switch to trigger actions such as system power-off, reboot or suspend. Can be one of
|
||||||
actions such as system power-off, reboot or suspend. Can be one of
|
<literal>ignore</literal>, <literal>poweroff</literal>, <literal>reboot</literal>,
|
||||||
<literal>ignore</literal>,
|
<literal>halt</literal>, <literal>kexec</literal>, <literal>suspend</literal>,
|
||||||
<literal>poweroff</literal>,
|
<literal>hibernate</literal>, <literal>hybrid-sleep</literal>,
|
||||||
<literal>reboot</literal>,
|
<literal>suspend-then-hibernate</literal>, <literal>lock</literal>, and
|
||||||
<literal>halt</literal>,
|
<literal>factory-reset</literal>. If <literal>ignore</literal>, <command>systemd-logind</command>
|
||||||
<literal>kexec</literal>,
|
will never handle these keys. If <literal>lock</literal>, all running sessions will be screen-locked;
|
||||||
<literal>suspend</literal>,
|
otherwise, the specified action will be taken in the respective event. Only input devices with the
|
||||||
<literal>hibernate</literal>,
|
<literal>power-switch</literal> udev tag will be watched for key/lid switch
|
||||||
<literal>hybrid-sleep</literal>,
|
events.</para>
|
||||||
<literal>suspend-then-hibernate</literal>,
|
|
||||||
<literal>lock</literal>, and
|
<para><varname>HandlePowerKey=</varname> defaults to <literal>poweroff</literal>,
|
||||||
<literal>factory-reset</literal>.
|
<varname>HandleRebootKey=</varname> defaults to <literal>reboot</literal>,
|
||||||
If <literal>ignore</literal>, logind will never handle these
|
<varname>HandleSuspendKey=</varname> defaults to <literal>suspend</literal>,
|
||||||
keys. If <literal>lock</literal>, all running sessions will be
|
<varname>HandleHibernateKey=</varname> defaults to <literal>hibernate</literal>,
|
||||||
screen-locked; otherwise, the specified action will be taken
|
<varname>HandlePowerKeyLongPress=</varname> defaults to <literal>ignore</literal>,
|
||||||
in the respective event. Only input devices with the
|
<varname>HandleRebootKeyLongPress=</varname> defaults to <literal>poweroff</literal>,
|
||||||
<literal>power-switch</literal> udev tag will be watched for
|
<varname>HandleSuspendKeyLongPress=</varname> defaults to <literal>hibernate</literal>,
|
||||||
key/lid switch events. <varname>HandlePowerKey=</varname>
|
<varname>HandleHibernateKeyLongPress=</varname> defaults to <literal>ignore</literal>.
|
||||||
defaults to <literal>poweroff</literal>, <varname>HandleRebootKey=</varname>
|
<varname>HandleLidSwitch=</varname> defaults to <literal>suspend</literal>.
|
||||||
defaults to <literal>reboot</literal>, <varname>HandleSuspendKey=</varname>
|
<varname>HandleLidSwitchExternalPower=</varname> is completely ignored by default (for backwards
|
||||||
defaults to <literal>suspend</literal>, <varname>HandleHibernateKey=</varname>
|
compatibility) — an explicit value must be set before it will be used to determine
|
||||||
defaults to <literal>hibernate</literal>, <varname>HandlePowerKeyLongPress=</varname>
|
behaviour. <varname>HandleLidSwitchDocked=</varname> defaults to <literal>ignore</literal>. If the
|
||||||
defaults to <literal>ignore</literal>, <varname>HandleRebootKeyLongPress=</varname>
|
system is inserted in a docking station, or if more than one display is connected, the action
|
||||||
defaults to <literal>poweroff</literal>, <varname>HandleSuspendKeyLongPress=</varname>
|
specified by <varname>HandleLidSwitchDocked=</varname> occurs; if the system is on external power the
|
||||||
defaults to <literal>hibernate</literal>, <varname>HandleHibernateKeyLongPress=</varname>
|
action (if any) specified by <varname>HandleLidSwitchExternalPower=</varname> occurs; otherwise the
|
||||||
defaults to <literal>ignore</literal>.
|
<varname>HandleLidSwitch=</varname> action occurs.</para>
|
||||||
<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
|
||||||
|
|||||||
@ -194,10 +194,20 @@ 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 = '...';
|
||||||
@ -242,6 +252,16 @@ 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"/>
|
||||||
@ -418,10 +438,20 @@ 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"/>
|
||||||
|
|||||||
@ -1000,7 +1000,7 @@ int config_parse_exec(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return ignore ? 0 : -ENOEXEC;
|
return ignore ? 0 : -ENOEXEC;
|
||||||
|
|
||||||
r = unit_path_printf(u, word, &resolved);
|
r = unit_full_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",
|
||||||
|
|||||||
@ -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, "ust:r:h", options, NULL)) >= 0)
|
while ((c = getopt_long(argc, argv, "sr:h", options, NULL)) >= 0)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|||||||
@ -3378,8 +3378,13 @@ 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),
|
||||||
|
|||||||
@ -23,13 +23,16 @@
|
|||||||
#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
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
#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"
|
||||||
@ -416,6 +417,21 @@ 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, "",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user