[systemd-commits] 4 commits - man/logind.conf.xml man/systemd.mount.xml man/systemd.service.xml src/core src/login
Lennart Poettering
lennart at kemper.freedesktop.org
Wed May 30 12:44:18 PDT 2012
man/logind.conf.xml | 50 +++++++++++------
man/systemd.mount.xml | 13 ++++
man/systemd.service.xml | 112 ++++++++++++++++++++++------------------
src/core/dbus-manager.c | 5 -
src/core/dbus-service.c | 15 -----
src/login/70-power-switch.rules | 2
src/login/logind-button.c | 85 +++++++++++++++++++++---------
src/login/logind-button.h | 8 +-
src/login/logind.c | 88 +++++++++++++++++--------------
src/login/logind.conf | 6 +-
10 files changed, 223 insertions(+), 161 deletions(-)
New commits:
commit 7c0987d8129e4761d24c21bbc2e5d39731a6b7f0
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed May 30 21:43:11 2012 +0200
dbus: better don't expose options we better shouldn't exposed
NotifySocket= is hardly useful, people should use $NOTIFY_SOCKET if
anything.
RunningAs= suggests people had a choice of running user mode as PID 1 or
vice versa, so remove this too.
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 7a06ca6..e96929a 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -225,7 +225,6 @@
" <property name=\"Distribution\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Features\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Tainted\" type=\"s\" access=\"read\"/>\n" \
- " <property name=\"RunningAs\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"InitRDTimestamp\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"InitRDTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"StartupTimestamp\" type=\"t\" access=\"read\"/>\n" \
@@ -243,7 +242,6 @@
" <property name=\"ConfirmSpawn\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"ShowStatus\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"UnitPath\" type=\"as\" access=\"read\"/>\n" \
- " <property name=\"NotifySocket\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"ControlGroupHierarchy\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"DefaultControllers\" type=\"as\" access=\"read\"/>\n" \
" <property name=\"DefaultStandardOutput\" type=\"s\" access=\"read\"/>\n" \
@@ -289,7 +287,6 @@
const char bus_manager_interface[] _introspect_("Manager") = BUS_MANAGER_INTERFACE;
-static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs);
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_output, ExecOutput);
static int bus_manager_append_tainted(DBusMessageIter *i, const char *property, void *data) {
@@ -546,7 +543,6 @@ static const BusProperty bus_systemd_properties[] = {
};
static const BusProperty bus_manager_properties[] = {
- { "RunningAs", bus_manager_append_running_as, "s", offsetof(Manager, running_as) },
{ "Tainted", bus_manager_append_tainted, "s", 0 },
{ "InitRDTimestamp", bus_property_append_uint64, "t", offsetof(Manager, initrd_timestamp.realtime) },
{ "InitRDTimestampMonotonic", bus_property_append_uint64, "t", offsetof(Manager, initrd_timestamp.monotonic) },
@@ -565,7 +561,6 @@ static const BusProperty bus_manager_properties[] = {
{ "ConfirmSpawn", bus_property_append_bool, "b", offsetof(Manager, confirm_spawn) },
{ "ShowStatus", bus_property_append_bool, "b", offsetof(Manager, show_status) },
{ "UnitPath", bus_property_append_strv, "as", offsetof(Manager, lookup_paths.unit_path), true },
- { "NotifySocket", bus_property_append_string, "s", offsetof(Manager, notify_socket), true },
{ "ControlGroupHierarchy", bus_property_append_string, "s", offsetof(Manager, cgroup_hierarchy), true },
{ "DefaultControllers", bus_property_append_strv, "as", offsetof(Manager, default_controllers), true },
{ "DefaultStandardOutput", bus_manager_append_exec_output, "s", offsetof(Manager, default_std_output) },
commit c485d3ba094a0bf8d0165a4ba3eb5602cc21812a
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed May 30 21:42:07 2012 +0200
service: mark compat options as such
This moves FsckPassNo= and SysVStartPriority= into its own
"Compatibility Options" section in the man page to clarify that these
options are not useful for anything but establishing a limited amount of
compatibility.
Also stop exposing these options on the bus.
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index a1cc9db..d733f81 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -258,6 +258,18 @@
</para></listitem>
</varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Compatibility Options</title>
+
+ <para>The following option is also available in the
+ <literal>[Mount]</literal> section, but exists purely
+ for compatibility reasons and should not be used in
+ newly written mount files.</para>
+
+ <variablelist>
<varlistentry>
<term><varname>FsckPassNo=</varname></term>
@@ -268,7 +280,6 @@
for more information on this setting.
</para></listitem>
</varlistentry>
-
</variablelist>
</refsect1>
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 11f98c3..12d0b8a 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -587,29 +587,6 @@
</varlistentry>
<varlistentry>
- <term><varname>SysVStartPriority=</varname></term>
- <listitem><para>Set the SysV start
- priority to use to order this service
- in relation to SysV services lacking
- LSB headers. This option is only
- necessary to fix ordering in relation
- to legacy SysV services, that have no
- ordering information encoded in the
- script headers. As such it should only
- be used as temporary compatibility
- option, and not be used in new unit
- files. Almost always it is a better
- choice to add explicit ordering
- directives via
- <varname>After=</varname> or
- <varname>Before=</varname>,
- instead. For more details see
- <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
- used, pass an integer value in the
- range 0-99.</para></listitem>
- </varlistentry>
-
- <varlistentry>
<term><varname>KillMode=</varname></term>
<listitem><para>Specifies how
processes of this service shall be
@@ -749,33 +726,6 @@
</varlistentry>
<varlistentry>
- <term><varname>FsckPassNo=</varname></term>
- <listitem><para>Set the fsck passno
- priority to use to order this service
- in relation to other file system
- checking services. This option is only
- necessary to fix ordering in relation
- to fsck jobs automatically created for
- all <filename>/etc/fstab</filename>
- entries with a value in the fs_passno
- column > 0. As such it should only be
- used as option for fsck
- services. Almost always it is a better
- choice to add explicit ordering
- directives via
- <varname>After=</varname> or
- <varname>Before=</varname>,
- instead. For more details see
- <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
- used, pass an integer value in the
- same range as
- <filename>/etc/fstab</filename>'s
- fs_passno column. See
- <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- for details.</para></listitem>
- </varlistentry>
-
- <varlistentry>
<term><varname>StartLimitInterval=</varname></term>
<term><varname>StartLimitBurst=</varname></term>
@@ -839,6 +789,68 @@
</refsect1>
<refsect1>
+ <title>Compatibility Options</title>
+
+ <para>The following options are also available in the
+ <literal>[Service]</literal> section, but exist purely
+ for compatibility reasons and should not be used in
+ newly written service files.</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><varname>SysVStartPriority=</varname></term>
+ <listitem><para>Set the SysV start
+ priority to use to order this service
+ in relation to SysV services lacking
+ LSB headers. This option is only
+ necessary to fix ordering in relation
+ to legacy SysV services, that have no
+ ordering information encoded in the
+ script headers. As such it should only
+ be used as temporary compatibility
+ option, and not be used in new unit
+ files. Almost always it is a better
+ choice to add explicit ordering
+ directives via
+ <varname>After=</varname> or
+ <varname>Before=</varname>,
+ instead. For more details see
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
+ used, pass an integer value in the
+ range 0-99.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>FsckPassNo=</varname></term>
+ <listitem><para>Set the fsck passno
+ priority to use to order this service
+ in relation to other file system
+ checking services. This option is only
+ necessary to fix ordering in relation
+ to fsck jobs automatically created for
+ all <filename>/etc/fstab</filename>
+ entries with a value in the fs_passno
+ column > 0. As such it should only be
+ used as option for fsck
+ services. Almost always it is a better
+ choice to add explicit ordering
+ directives via
+ <varname>After=</varname> or
+ <varname>Before=</varname>,
+ instead. For more details see
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
+ used, pass an integer value in the
+ same range as
+ <filename>/etc/fstab</filename>'s
+ fs_passno column. See
+ <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 4c6d5f0..6568cd5 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -26,14 +26,6 @@
#include "dbus-service.h"
#include "dbus-common.h"
-#ifdef HAVE_SYSV_COMPAT
-#define BUS_SERVICE_SYSV_INTERFACE_FRAGMENT \
- " <property name=\"SysVStartPriority\" type=\"i\" access=\"read\"/>\n" \
- " <property name=\"SysVRunLevels\" type=\"s\" access=\"read\"/>\n"
-#else
-#define BUS_SERVICE_SYSV_INTERFACE_FRAGMENT ""
-#endif
-
#define BUS_SERVICE_INTERFACE \
" <interface name=\"org.freedesktop.systemd1.Service\">\n" \
" <property name=\"Type\" type=\"s\" access=\"read\"/>\n" \
@@ -63,9 +55,7 @@
" <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
" <property name=\"BusName\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"StatusText\" type=\"s\" access=\"read\"/>\n" \
- " <property name=\"FsckPassNo\" type=\"i\" access=\"read\"/>\n" \
" <property name=\"Result\" type=\"s\" access=\"read\"/>\n" \
- BUS_SERVICE_SYSV_INTERFACE_FRAGMENT \
" </interface>\n"
#define INTROSPECTION \
@@ -144,11 +134,6 @@ static const BusProperty bus_service_properties[] = {
{ "ControlPID", bus_property_append_pid, "u", offsetof(Service, control_pid) },
{ "BusName", bus_property_append_string, "s", offsetof(Service, bus_name), true },
{ "StatusText", bus_property_append_string, "s", offsetof(Service, status_text), true },
-#ifdef HAVE_SYSV_COMPAT
- { "SysVRunLevels", bus_property_append_string, "s", offsetof(Service, sysv_runlevels), true },
- { "SysVStartPriority", bus_property_append_int, "i", offsetof(Service, sysv_start_priority) },
-#endif
- { "FsckPassNo", bus_property_append_int, "i", offsetof(Service, fsck_passno) },
{ "Result", bus_service_append_service_result,"s", offsetof(Service, result) },
{ NULL, }
};
commit 6de0e0e500d9d534c6e4baab242fc2a146f021fa
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed May 30 21:40:32 2012 +0200
logind: rework button setting semantics
If a graphical session without full DE that handles power/suspend events
is used this can now be controlled by logind instead, optionally.
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
index 09db600..35a7d48 100644
--- a/man/logind.conf.xml
+++ b/man/logind.conf.xml
@@ -170,33 +170,47 @@
and sleep keys and the lid switch to
trigger system power-off or
suspend. Can be one of
- <literal>no</literal>,
- <literal>yes</literal> and
+ <literal>off</literal>,
+ <literal>no-session</literal>,
+ <literal>tty-session</literal>,
+ <literal>any-session</literal> and
<literal>always</literal>. If
- <literal>no</literal> logind will
+ <literal>off</literal> logind will
never handle these keys. If
- <literal>yes</literal> logind will
- handle these keys when no user is
+ <literal>no-session</literal> logind
+ will handle these keys when no user is
logged in and no inhibitor lock is
taken, and trigger a warnig beep
otherwise. If set to
+ <literal>tty-session</literal> logind
+ will handle these keys if no inhibitor
+ lock is taken, and either no user is
+ logged in or the foreground session is
+ a text login and the only one
+ existing. If
+ <literal>any-session</literal> is set
+ logind will handle these keys if no
+ inhibitor lock is taken, and either no
+ user is logged in or the foreground
+ session is the only one existing
+ (regardless whether graphical or
+ text). If set to
<literal>always</literal> logind will
- handle these keys even if a user is
- logged in or an inhibitor lock is
- taken. In all cases logind will not
- handle these keys if a graphical
- session is in the foreground under the
- assumption that the graphical session
- will handle these keys
- internally. Only input devices with
- the <literal>power-switch</literal>
- udev tag will be watched for key
+ handle these keys in any case, even if
+ one or more users are logged in or an
+ inhibitor lock is taken. Only input
+ devices with the
+ <literal>power-switch</literal> udev
+ tag will be watched for key
events. <varname>HandlePowerKey=</varname>
- and <varname>HandleSleepKey=</varname>
- default to <literal>yes</literal>,
+ defaults to
+ <literal>no-session</literal>.
+ <varname>HandleSleepKey=</varname>
+ defaults to
+ <literal>tty-session</literal>,
<varname>HandleLidSwitch=</varname>
defaults to
- <literal>no</literal>.</para></listitem>
+ <literal>off</literal>.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 48432e1..8b59c2b 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -152,20 +152,18 @@ fail:
return r;
}
-static bool has_graphical_session(Manager *m, const char *seat) {
- Seat *s;
-
- assert(m);
- assert(seat);
+static Session *button_get_session(Button *b) {
+ Seat *seat;
+ assert(b);
- s = hashmap_get(m->seats, seat);
- if (!s)
- return false;
+ if (!b->seat)
+ return NULL;
- if (!s->active)
- return false;
+ seat = hashmap_get(b->manager->seats, b->seat);
+ if (!seat)
+ return NULL;
- return s->active->type == SESSION_X11;
+ return seat->active;
}
static int button_power_off(Button *b, HandleButton handle) {
@@ -174,17 +172,38 @@ static int button_power_off(Button *b, HandleButton handle) {
assert(b);
- if (handle == HANDLE_NO)
+ if (handle == HANDLE_OFF)
return 0;
- if (handle != HANDLE_ALWAYS) {
-
+ if (handle == HANDLE_NO_SESSION) {
if (hashmap_size(b->manager->sessions) > 0) {
log_error("Refusing power-off, user is logged in.");
warn_melody();
return -EPERM;
}
+ } else if (handle == HANDLE_TTY_SESSION ||
+ handle == HANDLE_ANY_SESSION) {
+ unsigned n;
+ Session *s;
+
+ n = hashmap_size(b->manager->sessions);
+ s = button_get_session(b);
+
+ /* Silently ignore events of graphical sessions */
+ if (handle == HANDLE_TTY_SESSION &&
+ s && s->type == SESSION_X11)
+ return 0;
+
+ if (n > 1 || (n == 1 && !s)) {
+ log_error("Refusing power-off, other user is logged in.");
+ warn_melody();
+ return -EPERM;
+ }
+
+ }
+
+ if (handle != HANDLE_ALWAYS) {
if (manager_is_inhibited(b->manager, INHIBIT_SHUTDOWN, INHIBIT_BLOCK, NULL)) {
log_error("Refusing power-off, shutdown is inhibited.");
warn_melody();
@@ -210,17 +229,37 @@ static int button_suspend(Button *b, HandleButton handle) {
assert(b);
- if (handle == HANDLE_NO)
+ if (handle == HANDLE_OFF)
return 0;
- if (handle != HANDLE_ALWAYS) {
-
+ if (handle == HANDLE_NO_SESSION) {
if (hashmap_size(b->manager->sessions) > 0) {
log_error("Refusing suspend, user is logged in.");
warn_melody();
return -EPERM;
}
+ } else if (handle == HANDLE_TTY_SESSION ||
+ handle == HANDLE_ANY_SESSION) {
+ unsigned n;
+ Session *s;
+
+ n = hashmap_size(b->manager->sessions);
+ s = button_get_session(b);
+
+ /* Silently ignore events of graphical sessions */
+ if (handle == HANDLE_TTY_SESSION &&
+ s && s->type == SESSION_X11)
+ return 0;
+
+ if (n > 1 || (n == 1 && !s)) {
+ log_error("Refusing suspend, other user is logged in.");
+ warn_melody();
+ return -EPERM;
+ }
+ }
+
+ if (handle != HANDLE_ALWAYS) {
if (manager_is_inhibited(b->manager, INHIBIT_SLEEP, INHIBIT_BLOCK, NULL)) {
log_error("Refusing suspend, sleeping is inhibited.");
warn_melody();
@@ -252,12 +291,6 @@ int button_process(Button *b) {
if ((size_t) l < sizeof(ev))
return -EIO;
- /* If there's a graphical session on the seat this device
- * belongs to we ignore events, it is job of the graphical
- * session to handle the event. */
- if (has_graphical_session(b->manager, b->seat))
- return 0;
-
if (ev.type == EV_KEY && ev.value > 0) {
switch (ev.code) {
@@ -287,8 +320,10 @@ int button_process(Button *b) {
}
static const char* const handle_button_table[_HANDLE_BUTTON_MAX] = {
- [HANDLE_YES] = "yes",
- [HANDLE_NO] = "no",
+ [HANDLE_OFF] = "off",
+ [HANDLE_NO_SESSION] = "no-session",
+ [HANDLE_TTY_SESSION] = "tty-session",
+ [HANDLE_ANY_SESSION] = "any-session",
[HANDLE_ALWAYS] = "always"
};
DEFINE_STRING_TABLE_LOOKUP(handle_button, HandleButton);
diff --git a/src/login/logind-button.h b/src/login/logind-button.h
index 0378211..7518d05 100644
--- a/src/login/logind-button.h
+++ b/src/login/logind-button.h
@@ -25,9 +25,11 @@
typedef struct Button Button;
typedef enum HandleButton {
- HANDLE_NO,
- HANDLE_YES, /* only if no inhibitor is taken/no session is around */
- HANDLE_ALWAYS, /* regardless if inhibitor is taken/session is around */
+ HANDLE_OFF,
+ HANDLE_NO_SESSION, /* Only handle key when nobody is logged in; honour inhibitors */
+ HANDLE_TTY_SESSION, /* Only handle key when nobody is logged in, or the fg session is the only one and non-graphical; honour inhibitors */
+ HANDLE_ANY_SESSION, /* Only handle key when nobody is logged in, or the fg session is the only one; honour inhibtors */
+ HANDLE_ALWAYS, /* Always handle, ignore sessions; ignore inhibitors */
_HANDLE_BUTTON_MAX,
_HANDLE_BUTTON_INVALID = -1
} HandleButton;
diff --git a/src/login/logind.c b/src/login/logind.c
index 0382972..632987c 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -53,9 +53,9 @@ Manager *manager_new(void) {
m->n_autovts = 6;
m->inhibit_delay_max = 5 * USEC_PER_SEC;
- m->handle_power_key = HANDLE_YES;
- m->handle_sleep_key = HANDLE_YES;
- m->handle_lid_switch = HANDLE_NO;
+ m->handle_power_key = HANDLE_NO_SESSION;
+ m->handle_sleep_key = HANDLE_TTY_SESSION;
+ m->handle_lid_switch = HANDLE_OFF;
m->devices = hashmap_new(string_hash_func, string_compare_func);
m->seats = hashmap_new(string_hash_func, string_compare_func);
@@ -484,6 +484,11 @@ int manager_enumerate_buttons(Manager *m) {
/* Loads buttons from udev */
+ if (m->handle_power_key == HANDLE_OFF &&
+ m->handle_sleep_key == HANDLE_OFF &&
+ m->handle_lid_switch == HANDLE_OFF)
+ return 0;
+
e = udev_enumerate_new(m->udev);
if (!e) {
r = -ENOMEM;
@@ -1234,59 +1239,62 @@ static int manager_connect_udev(Manager *m) {
zero(ev);
ev.events = EPOLLIN;
ev.data.u32 = FD_SEAT_UDEV;
-
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->udev_seat_fd, &ev) < 0)
return -errno;
- m->udev_button_monitor = udev_monitor_new_from_netlink(m->udev, "udev");
- if (!m->udev_button_monitor)
- return -ENOMEM;
+ /* Don't watch keys if nobody cares */
+ if (m->handle_power_key != HANDLE_OFF ||
+ m->handle_sleep_key != HANDLE_OFF ||
+ m->handle_lid_switch != HANDLE_OFF) {
- r = udev_monitor_filter_add_match_tag(m->udev_button_monitor, "power-switch");
- if (r < 0)
- return r;
+ m->udev_button_monitor = udev_monitor_new_from_netlink(m->udev, "udev");
+ if (!m->udev_button_monitor)
+ return -ENOMEM;
- r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_button_monitor, "input", NULL);
- if (r < 0)
- return r;
+ r = udev_monitor_filter_add_match_tag(m->udev_button_monitor, "power-switch");
+ if (r < 0)
+ return r;
- r = udev_monitor_enable_receiving(m->udev_button_monitor);
- if (r < 0)
- return r;
+ r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_button_monitor, "input", NULL);
+ if (r < 0)
+ return r;
- m->udev_button_fd = udev_monitor_get_fd(m->udev_button_monitor);
+ r = udev_monitor_enable_receiving(m->udev_button_monitor);
+ if (r < 0)
+ return r;
- zero(ev);
- ev.events = EPOLLIN;
- ev.data.u32 = FD_BUTTON_UDEV;
+ m->udev_button_fd = udev_monitor_get_fd(m->udev_button_monitor);
- if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->udev_button_fd, &ev) < 0)
- return -errno;
+ zero(ev);
+ ev.events = EPOLLIN;
+ ev.data.u32 = FD_BUTTON_UDEV;
+ if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->udev_button_fd, &ev) < 0)
+ return -errno;
+ }
/* Don't bother watching VCSA devices, if nobody cares */
- if (m->n_autovts <= 0 || m->console_active_fd < 0)
- return 0;
+ if (m->n_autovts > 0 && m->console_active_fd >= 0) {
- m->udev_vcsa_monitor = udev_monitor_new_from_netlink(m->udev, "udev");
- if (!m->udev_vcsa_monitor)
- return -ENOMEM;
+ m->udev_vcsa_monitor = udev_monitor_new_from_netlink(m->udev, "udev");
+ if (!m->udev_vcsa_monitor)
+ return -ENOMEM;
- r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_vcsa_monitor, "vc", NULL);
- if (r < 0)
- return r;
-
- r = udev_monitor_enable_receiving(m->udev_vcsa_monitor);
- if (r < 0)
- return r;
+ r = udev_monitor_filter_add_match_subsystem_devtype(m->udev_vcsa_monitor, "vc", NULL);
+ if (r < 0)
+ return r;
- m->udev_vcsa_fd = udev_monitor_get_fd(m->udev_vcsa_monitor);
+ r = udev_monitor_enable_receiving(m->udev_vcsa_monitor);
+ if (r < 0)
+ return r;
- zero(ev);
- ev.events = EPOLLIN;
- ev.data.u32 = FD_VCSA_UDEV;
+ m->udev_vcsa_fd = udev_monitor_get_fd(m->udev_vcsa_monitor);
- if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->udev_vcsa_fd, &ev) < 0)
- return -errno;
+ zero(ev);
+ ev.events = EPOLLIN;
+ ev.data.u32 = FD_VCSA_UDEV;
+ if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->udev_vcsa_fd, &ev) < 0)
+ return -errno;
+ }
return 0;
}
diff --git a/src/login/logind.conf b/src/login/logind.conf
index 4f012e5..78496a0 100644
--- a/src/login/logind.conf
+++ b/src/login/logind.conf
@@ -15,6 +15,6 @@
#Controllers=
#ResetControllers=cpu
#InhibitDelayMaxSec=5
-#HandlePowerKey=yes
-#HandleSleepKey=yes
-#HandleLidSwitch=no
+#HandlePowerKey=no-session
+#HandleSleepKey=tty-session
+#HandleLidSwitch=off
commit 632c2e4123e4b4dc81792caee6220797c853d53e
Author: Tero Roponen <tero.roponen at gmail.com>
Date: Wed May 30 18:34:28 2012 +0200
login: Use the GOTO properly in udev rule
In udev rules the labels must be assigned to GOTO keys with '='.
diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
index 9095923..36fb827 100644
--- a/src/login/70-power-switch.rules
+++ b/src/login/70-power-switch.rules
@@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
-ACTION=="remove", GOTO "power_switch_end"
+ACTION=="remove", GOTO="power_switch_end"
SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch"
SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", TAG+="power-switch"
More information about the systemd-commits
mailing list