if (!session)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_SESSION, "No session '%s' known", name);
- r = session_stop(session);
+ r = session_stop(session, true);
if (r < 0)
return r;
if (!user)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
- r = user_stop(user);
+ r = user_stop(user, true);
if (r < 0)
return r;
if (!seat)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_SEAT, "No seat '%s' known", name);
- r = seat_stop_sessions(seat);
+ r = seat_stop_sessions(seat, true);
if (r < 0)
return r;
assert(message);
assert(s);
- r = seat_stop_sessions(s);
+ r = seat_stop_sessions(s, true);
if (r < 0)
return r;
return 0;
}
-int seat_stop(Seat *s) {
+int seat_stop(Seat *s, bool force) {
int r = 0;
assert(s);
"MESSAGE=Removed seat %s.", s->id,
NULL);
- seat_stop_sessions(s);
+ seat_stop_sessions(s, force);
unlink(s->state_file);
seat_add_to_gc_queue(s);
return r;
}
-int seat_stop_sessions(Seat *s) {
+int seat_stop_sessions(Seat *s, bool force) {
Session *session;
int r = 0, k;
assert(s);
LIST_FOREACH(sessions_by_seat, session, s->sessions) {
- k = session_stop(session);
+ k = session_stop(session, force);
if (k < 0)
r = k;
}
int seat_get_idle_hint(Seat *s, dual_timestamp *t);
int seat_start(Seat *s);
-int seat_stop(Seat *s);
-int seat_stop_sessions(Seat *s);
+int seat_stop(Seat *s, bool force);
+int seat_stop_sessions(Seat *s, bool force);
bool seat_check_gc(Seat *s, bool drop_not_started);
void seat_add_to_gc_queue(Seat *s);
assert(message);
assert(s);
- r = session_stop(s);
+ r = session_stop(s, true);
if (r < 0)
return r;
return 0;
}
-static int session_stop_scope(Session *s) {
+static int session_stop_scope(Session *s, bool force) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
char *job;
int r;
if (!s->scope)
return 0;
- if (manager_shall_kill(s->manager, s->user->name)) {
+ if (force || manager_shall_kill(s->manager, s->user->name)) {
r = manager_stop_unit(s->manager, s->scope, &error, &job);
if (r < 0) {
log_error("Failed to stop session scope: %s", bus_error_message(&error, r));
return 0;
}
-int session_stop(Session *s) {
+int session_stop(Session *s, bool force) {
int r;
assert(s);
session_remove_fifo(s);
/* Kill cgroup */
- r = session_stop_scope(s);
+ r = session_stop_scope(s, force);
s->stopping = true;
assert(es);
assert(s);
- session_stop(s);
+ session_stop(s, false);
return 0;
}
/* EOF on the FIFO means the session died abnormally. */
session_remove_fifo(s);
- session_stop(s);
+ session_stop(s, false);
return 1;
}
void session_set_idle_hint(Session *s, bool b);
int session_create_fifo(Session *s);
int session_start(Session *s);
-int session_stop(Session *s);
+int session_stop(Session *s, bool force);
int session_finalize(Session *s);
void session_release(Session *s);
int session_save(Session *s);
assert(message);
assert(u);
- r = user_stop(u);
+ r = user_stop(u, true);
if (r < 0)
return r;
return r;
}
-int user_stop(User *u) {
+int user_stop(User *u, bool force) {
Session *s;
int r = 0, k;
assert(u);
LIST_FOREACH(sessions_by_user, s, u->sessions) {
- k = session_stop(s);
+ k = session_stop(s, force);
if (k < 0)
r = k;
}
bool user_check_gc(User *u, bool drop_not_started);
void user_add_to_gc_queue(User *u);
int user_start(User *u);
-int user_stop(User *u);
+int user_stop(User *u, bool force);
int user_finalize(User *u);
UserState user_get_state(User *u);
int user_get_idle_hint(User *u, dual_timestamp *t);
seat->in_gc_queue = false;
if (!seat_check_gc(seat, drop_not_started)) {
- seat_stop(seat);
+ seat_stop(seat, false);
seat_free(seat);
}
}
/* First, if we are not closing yet, initiate stopping */
if (!session_check_gc(session, drop_not_started) &&
session_get_state(session) != SESSION_CLOSING)
- session_stop(session);
+ session_stop(session, false);
/* Normally, this should make the session busy again,
* if it doesn't then let's get rid of it
if (!user_check_gc(user, drop_not_started) &&
user_get_state(user) != USER_CLOSING)
- user_stop(user);
+ user_stop(user, false);
if (!user_check_gc(user, drop_not_started)) {
user_finalize(user);