summaryrefslogtreecommitdiff
path: root/src/login/logind-session.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-13 18:25:02 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-13 19:50:52 +0100
commit90558f315844ec35e3fd4f1a19ac38c8721c9354 (patch)
treea38c891b0bf69186e342015e04722fe6f07a4286 /src/login/logind-session.c
parent38599489e49e840291516488a3ef1b4a56198c58 (diff)
logind: add a new UserTasksMax= setting to logind.conf
This new setting configures the TasksMax= field for the slice objects we create for each user. This alters logind to create the slice unit as transient unit explicitly instead of relying on implicit generation of slice units by simply starting them. This also enables us to set a friendly description for slice units that way.
Diffstat (limited to 'src/login/logind-session.c')
-rw-r--r--src/login/logind-session.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index ef3d46f3fb..6c4ada29fb 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -516,21 +516,28 @@ static int session_start_scope(Session *s) {
if (!s->scope) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_free_ char *description = NULL;
char *scope, *job = NULL;
-
- description = strjoin("Session ", s->id, " of user ", s->user->name, NULL);
- if (!description)
- return log_oom();
+ const char *description;
scope = strjoin("session-", s->id, ".scope", NULL);
if (!scope)
return log_oom();
- r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-sessions.service", &error, &job);
+ description = strjoina("Session ", s->id, " of user ", s->user->name, NULL);
+
+ r = manager_start_scope(
+ s->manager,
+ scope,
+ s->leader,
+ s->user->slice,
+ description,
+ "systemd-logind.service",
+ "systemd-user-sessions.service",
+ (uint64_t) -1, /* disable TasksMax= for the scope, rely on the slice setting for it */
+ &error,
+ &job);
if (r < 0) {
- log_error("Failed to start session scope %s: %s %s",
- scope, bus_error_message(&error, r), error.name);
+ log_error_errno(r, "Failed to start session scope %s: %s", scope, bus_error_message(&error, r));
free(scope);
return r;
} else {
@@ -542,7 +549,7 @@ static int session_start_scope(Session *s) {
}
if (s->scope)
- hashmap_put(s->manager->session_units, s->scope, s);
+ (void) hashmap_put(s->manager->session_units, s->scope, s);
return 0;
}