[systemd-commits] 4 commits - Makefile.am src/71-seat.rules src/logind.c src/logind-dbus.c src/logind.h src/logind-seat.c src/logind-session.c src/logind-user.c
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Jun 28 16:49:46 PDT 2011
Makefile.am | 4 ++-
src/71-seat.rules | 2 -
src/logind-dbus.c | 1
src/logind-seat.c | 3 ++
src/logind-session.c | 13 +++++++++++
src/logind-user.c | 4 +++
src/logind.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++-----
src/logind.h | 3 +-
8 files changed, 78 insertions(+), 8 deletions(-)
New commits:
commit ac2dcbb2155fa421b826cfd45ec98d4237b1c9fe
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jun 29 01:49:21 2011 +0200
logind: udev no longer ignores subsystem matches on monitors when used in conjunction with tags
diff --git a/src/logind.c b/src/logind.c
index fd17d80..94cb6cd 100644
--- a/src/logind.c
+++ b/src/logind.c
@@ -264,11 +264,6 @@ int manager_process_seat_device(Manager *m, struct udev_device *d) {
assert(m);
- /* FIXME: drop this check as soon as libudev's enum support
- * honours tags and subsystem matches at the same time */
- if (!streq_ptr(udev_device_get_subsystem(d), "graphics"))
- return 0;
-
if (streq_ptr(udev_device_get_action(d), "remove")) {
/* FIXME: use syspath instead of sysname here, as soon as fb driver is fixed */
commit 1c9a2c1047a6387e0f22801c72760d0d282960d5
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jun 29 01:48:59 2011 +0200
logind: be a bit more rigid with seat names
diff --git a/src/logind-seat.c b/src/logind-seat.c
index 1bc0570..b8f1f60 100644
--- a/src/logind-seat.c
+++ b/src/logind-seat.c
@@ -492,5 +492,8 @@ bool seat_name_is_valid(const char *name) {
if (!seat_name_valid_char(*p))
return false;
+ if (strlen(name) > 255)
+ return false;
+
return true;
}
diff --git a/src/logind.h b/src/logind.h
index 97cfc90..8da409b 100644
--- a/src/logind.h
+++ b/src/logind.h
@@ -45,6 +45,7 @@
* use device_has_tag() as soon as it is available
* trigger based on libudev if available
* enumerate recursively with libudev when triggering
+ * use sysfs in device hash table, not sysname, when fb driver is fixed
*
* non-local X11 server
* reboot/shutdown halt management
commit ab2a782ab73d641a5077873f0dadf1f40de496e2
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jun 29 01:48:30 2011 +0200
logind: fix udev rule to generate valid tags, as a temporary fix until udev gains a native feature for this
diff --git a/src/71-seat.rules b/src/71-seat.rules
index c564bac..af174f9 100644
--- a/src/71-seat.rules
+++ b/src/71-seat.rules
@@ -16,6 +16,6 @@ SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", TAG+="seat"
SUBSYSTEM=="usb", ATTR{idVendor}=="2230", ATTR{idProduct}=="0001", ENV{ID_AUTOSEAT}="1"
TAG=="seat", ENV{ID_PATH}=="", IMPORT{program}="path_id %p"
-TAG=="seat", ENV{ID_FOR_SEAT}=="", ENV{ID_PATH}!="", ENV{ID_FOR_SEAT}="$env{SUBSYSTEM}-$env{ID_PATH}"
+TAG=="seat", ENV{ID_FOR_SEAT}=="", ENV{ID_PATH}!="", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | /bin/sed -e s/[:.]/_/g'", ENV{ID_FOR_SEAT}="$env{SUBSYSTEM}-$result"
LABEL="seat_end"
commit 193197e85ccc5622abd9653dcd939712334d3ea3
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jun 29 01:47:55 2011 +0200
logind: parse configuration file
diff --git a/Makefile.am b/Makefile.am
index 3d6951a..c288ad4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -197,7 +197,9 @@ pamlib_LTLIBRARIES = \
endif
dist_pkgsysconf_DATA = \
- src/system.conf
+ src/system.conf \
+ src/user.conf \
+ src/systemd-logind.conf
dist_dbuspolicy_DATA = \
src/org.freedesktop.systemd1.conf \
diff --git a/src/logind-dbus.c b/src/logind-dbus.c
index ff500f3..69e6b18 100644
--- a/src/logind-dbus.c
+++ b/src/logind-dbus.c
@@ -641,6 +641,7 @@ static DBusHandlerResult manager_message_handler(
const BusProperty properties[] = {
{ "org.freedesktop.login1.Manager", "ControlGroupHierarchy", bus_property_append_string, "s", m->cgroup_path },
{ "org.freedesktop.login1.Manager", "Controllers", bus_property_append_strv, "as", m->controllers },
+ { "org.freedesktop.login1.Manager", "ResetControllers", bus_property_append_strv, "as", m->reset_controllers },
{ "org.freedesktop.login1.Manager", "NAutoVTs", bus_property_append_unsigned, "u", &m->n_autovts },
{ "org.freedesktop.login1.Manager", "KillOnlyUsers", bus_property_append_strv, "as", m->kill_only_users },
{ "org.freedesktop.login1.Manager", "KillExcludeUsers", bus_property_append_strv, "as", m->kill_exclude_users },
diff --git a/src/logind-session.c b/src/logind-session.c
index 7671850..088e956 100644
--- a/src/logind-session.c
+++ b/src/logind-session.c
@@ -473,6 +473,7 @@ static int session_create_cgroup(Session *s) {
STRV_FOREACH(k, s->manager->controllers) {
if (strv_contains(s->reset_controllers, *k) ||
+ strv_contains(s->manager->reset_controllers, *k) ||
strv_contains(s->controllers, *k))
continue;
@@ -489,6 +490,18 @@ static int session_create_cgroup(Session *s) {
log_warning("Failed to reset controller %s: %s", *k, strerror(-r));
}
+
+ STRV_FOREACH(k, s->manager->reset_controllers) {
+
+ if (strv_contains(s->reset_controllers, *k) ||
+ strv_contains(s->controllers, *k))
+ continue;
+
+ r = cg_attach(*k, "/", s->leader);
+ if (r < 0)
+ log_warning("Failed to reset controller %s: %s", *k, strerror(-r));
+
+ }
}
hashmap_put(s->manager->cgroups, s->cgroup_path, s);
diff --git a/src/logind-user.c b/src/logind-user.c
index 4335bf6..3076ed1 100644
--- a/src/logind-user.c
+++ b/src/logind-user.c
@@ -246,6 +246,10 @@ static int user_create_cgroup(User *u) {
u->cgroup_path = p;
STRV_FOREACH(k, u->manager->controllers) {
+
+ if (strv_contains(u->manager->reset_controllers, *k))
+ continue;
+
r = cg_create(*k, p);
if (r < 0)
log_warning("Failed to create cgroup %s:%s: %s", *k, p, strerror(-r));
diff --git a/src/logind.c b/src/logind.c
index d38d7d5..fd17d80 100644
--- a/src/logind.c
+++ b/src/logind.c
@@ -32,6 +32,8 @@
#include "logind.h"
#include "dbus-common.h"
#include "dbus-loop.h"
+#include "strv.h"
+#include "conf-parser.h"
Manager *manager_new(void) {
Manager *m;
@@ -124,6 +126,11 @@ void manager_free(Manager *m) {
if (m->epoll_fd >= 0)
close_nointr_nofail(m->epoll_fd);
+ strv_free(m->controllers);
+ strv_free(m->reset_controllers);
+ strv_free(m->kill_only_users);
+ strv_free(m->kill_exclude_users);
+
free(m->cgroup_path);
free(m);
}
@@ -1144,6 +1151,48 @@ int manager_run(Manager *m) {
return 0;
}
+static int manager_parse_config_file(Manager *m) {
+
+ const ConfigItem items[] = {
+ { "NAutoVTs", config_parse_unsigned, 0, &m->n_autovts, "Login" },
+ { "KillUserProcesses", config_parse_bool, 0, &m->kill_user_processes, "Login" },
+ { "KilOnlyUsers", config_parse_strv, 0, &m->kill_only_users, "Login" },
+ { "KillExcludeUsers", config_parse_strv, 0, &m->kill_exclude_users, "Login" },
+ { "Controllers", config_parse_strv, 0, &m->controllers, "Login" },
+ { "ResetControllers", config_parse_strv, 0, &m->reset_controllers, "Login" },
+ { NULL, NULL, 0, NULL, NULL }
+ };
+
+ static const char * const sections[] = {
+ "Login",
+ NULL
+ };
+
+ FILE *f;
+ const char *fn;
+ int r;
+
+ assert(m);
+
+ fn = "/etc/systemd/systemd-logind.conf";
+ f = fopen(fn, "re");
+ if (!f) {
+ if (errno == ENOENT)
+ return 0;
+
+ log_warning("Failed to open configuration file %s: %m", fn);
+ return -errno;
+ }
+
+ r = config_parse(fn, f, sections, items, false, NULL);
+ if (r < 0)
+ log_warning("Failed to parse configuration file: %s", strerror(-r));
+
+ fclose(f);
+
+ return r;
+}
+
int main(int argc, char *argv[]) {
Manager *m = NULL;
int r;
@@ -1167,6 +1216,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ manager_parse_config_file(m);
+
r = manager_startup(m);
if (r < 0) {
log_error("Failed to fully start up daemon: %s", strerror(-r));
diff --git a/src/logind.h b/src/logind.h
index 9b9f38b..97cfc90 100644
--- a/src/logind.h
+++ b/src/logind.h
@@ -84,7 +84,7 @@ struct Manager {
Seat *vtconsole;
char *cgroup_path;
- char **controllers;
+ char **controllers, **reset_controllers;
char **kill_only_users, **kill_exclude_users;
More information about the systemd-commits
mailing list