return idle_hint;
}
-bool seat_check_gc(Seat *s, bool drop_not_started) {
+bool seat_may_gc(Seat *s, bool drop_not_started) {
assert(s);
if (drop_not_started && !s->started)
- return false;
+ return true;
if (seat_is_seat0(s))
- return true;
+ return false;
- return seat_has_master_device(s);
+ return !seat_has_master_device(s);
}
void seat_add_to_gc_queue(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);
+bool seat_may_gc(Seat *s, bool drop_not_started);
void seat_add_to_gc_queue(Seat *s);
bool seat_name_is_valid(const char *name);
}
}
-bool session_check_gc(Session *s, bool drop_not_started) {
+bool session_may_gc(Session *s, bool drop_not_started) {
assert(s);
if (drop_not_started && !s->started)
- return false;
+ return true;
if (!s->user)
- return false;
+ return true;
if (s->fifo_fd >= 0) {
if (pipe_eof(s->fifo_fd) <= 0)
- return true;
+ return false;
}
#if 0 /// elogind supports neither scopes nor jobs
if (s->scope_job && manager_job_is_active(s->manager, s->scope_job))
- return true;
+ return false;
if (s->scope && manager_unit_is_active(s->manager, s->scope))
- return true;
#endif // 0
+ return false;
- return false;
+ return true;
}
void session_add_to_gc_queue(Session *s) {
Session *session_new(Manager *m, const char *id);
void session_free(Session *s);
void session_set_user(Session *s, User *u);
-bool session_check_gc(Session *s, bool drop_not_started);
+bool session_may_gc(Session *s, bool drop_not_started);
void session_add_to_gc_queue(Session *s);
int session_activate(Session *s);
bool session_is_active(Session *s);
return access(p, F_OK) >= 0;
}
-bool user_check_gc(User *u, bool drop_not_started) {
+bool user_may_gc(User *u, bool drop_not_started) {
assert(u);
if (drop_not_started && !u->started)
- return false;
+ return true;
if (u->sessions)
- return true;
+ return false;
if (user_check_linger_file(u) > 0)
- return true;
+ return false;
#if 0 /// elogind neither supports service nor slice jobs
if (u->slice_job && manager_job_is_active(u->manager, u->slice_job))
- return true;
+ return false;
if (u->service_job && manager_job_is_active(u->manager, u->service_job))
- return true;
#endif // 0
+ return false;
- return false;
+ return true;
}
void user_add_to_gc_queue(User *u) {
DEFINE_TRIVIAL_CLEANUP_FUNC(User *, user_free);
-bool user_check_gc(User *u, bool drop_not_started);
+bool user_may_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, bool force);
LIST_REMOVE(gc_queue, m->seat_gc_queue, seat);
seat->in_gc_queue = false;
- if (!seat_check_gc(seat, drop_not_started)) {
+ if (seat_may_gc(seat, drop_not_started)) {
seat_stop(seat, false);
seat_free(seat);
}
session->in_gc_queue = false;
/* First, if we are not closing yet, initiate stopping */
- if (!session_check_gc(session, drop_not_started) &&
+ if (session_may_gc(session, drop_not_started) &&
session_get_state(session) != SESSION_CLOSING)
session_stop(session, false);
/* Normally, this should make the session referenced
* again, if it doesn't then let's get rid of it
* immediately */
- if (!session_check_gc(session, drop_not_started)) {
+ if (session_may_gc(session, drop_not_started)) {
session_finalize(session);
session_free(session);
}
user->in_gc_queue = false;
/* First step: queue stop jobs */
- if (!user_check_gc(user, drop_not_started))
+ if (user_may_gc(user, drop_not_started))
user_stop(user, false);
/* Second step: finalize user */
- if (!user_check_gc(user, drop_not_started)) {
+ if (user_may_gc(user, drop_not_started)) {
user_finalize(user);
user_free(user);
}