Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C
systemd
session-class-service.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File session-class-service.patch of Package systemd
From: Andrei Borzenkov <arvidjaar@gmail.com> Subject: [PATCH] add login session class "service" to avoid killing session processes <patch description> --- src/login/logind-dbus.c | 7 +++++++ src/login/logind-session.c | 6 ++++-- src/login/logind-session.h | 1 + src/login/logind.h | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 8ea653f..a0a0313 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2245,6 +2245,7 @@ int manager_start_scope( const char *slice, const char *description, const char *after, const char *after2, + const char *killmode, sd_bus_error *error, char **job) { @@ -2297,6 +2298,12 @@ int manager_start_scope( return r; } + if (!isempty(killmode)) { + r = sd_bus_message_append(m, "(sv)", "KillMode", "s", killmode); + if (r < 0) + return r; + } + /* cgroup empty notification is not available in containers * currently. To make this less problematic, let's shorten the * stop timeout for sessions, so that we don't wait diff --git a/src/login/logind-session.c b/src/login/logind-session.c index ea1831d..9798d2d 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -497,6 +497,7 @@ static int session_start_scope(Session *s) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_free_ char *description = NULL; char *scope, *job = NULL; + char *killmode = s->class == SESSION_SERVICE ? "none" : "control-group"; description = strjoin("Session ", s->id, " of user ", s->user->name, NULL); if (!description) @@ -506,7 +507,7 @@ static int session_start_scope(Session *s) { 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); + r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-sessions.service", killmode, &error, &job); if (r < 0) { log_error("Failed to start session scope %s: %s %s", scope, bus_error_message(&error, r), error.name); @@ -1179,7 +1180,8 @@ static const char* const session_class_table[_SESSION_CLASS_MAX] = { [SESSION_USER] = "user", [SESSION_GREETER] = "greeter", [SESSION_LOCK_SCREEN] = "lock-screen", - [SESSION_BACKGROUND] = "background" + [SESSION_BACKGROUND] = "background", + [SESSION_SERVICE] = "service", }; DEFINE_STRING_TABLE_LOOKUP(session_class, SessionClass); diff --git a/src/login/logind-session.h b/src/login/logind-session.h index a007fb5..6f83a14 100644 --- a/src/login/logind-session.h +++ b/src/login/logind-session.h @@ -46,6 +46,7 @@ typedef enum SessionClass { SESSION_GREETER, SESSION_LOCK_SCREEN, SESSION_BACKGROUND, + SESSION_SERVICE, _SESSION_CLASS_MAX, _SESSION_CLASS_INVALID = -1 } SessionClass; diff --git a/src/login/logind.h b/src/login/logind.h index 2f76572..63e06ea 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -176,7 +176,7 @@ int manager_send_changed(Manager *manager, const char *property, ...) _sentinel_ int manager_dispatch_delayed(Manager *manager); -int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, const char *after, const char *after2, sd_bus_error *error, char **job); +int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, const char *after, const char *after2, const char *killmode, sd_bus_error *error, char **job); int manager_start_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *error); -- tg: (6ad9bb7..) bnc/906900 (depends on: master)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor