Compare commits

..

No commits in common. "0306d1598d618c8418bb6b960a526cbdf3aede61" and "85b6a8110d21defb3d6cddace09ee21db4eb9766" have entirely different histories.

8 changed files with 21 additions and 20 deletions

View File

@ -4072,13 +4072,13 @@ int manager_start_unit(Manager *manager, const char *unit, sd_bus_error *error,
return strdup_job(reply, job);
}
int manager_stop_unit(Manager *manager, const char *unit, const char *job_mode, sd_bus_error *error, char **ret_job) {
int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
int r;
assert(manager);
assert(unit);
assert(ret_job);
assert(job);
r = bus_call_method(
manager->bus,
@ -4086,12 +4086,12 @@ int manager_stop_unit(Manager *manager, const char *unit, const char *job_mode,
"StopUnit",
error,
&reply,
"ss", unit, job_mode ?: "fail");
"ss", unit, "fail");
if (r < 0) {
if (sd_bus_error_has_names(error, BUS_ERROR_NO_SUCH_UNIT,
BUS_ERROR_LOAD_FAILED)) {
*ret_job = NULL;
*job = NULL;
sd_bus_error_free(error);
return 0;
}
@ -4099,7 +4099,7 @@ int manager_stop_unit(Manager *manager, const char *unit, const char *job_mode,
return r;
}
return strdup_job(reply, ret_job);
return strdup_job(reply, job);
}
int manager_abandon_scope(Manager *manager, const char *scope, sd_bus_error *ret_error) {

View File

@ -25,7 +25,7 @@ int manager_send_changed(Manager *manager, const char *property, ...) _sentinel_
int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, char **wants, char **after, const char *requires_mounts_for, sd_bus_message *more_properties, 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, const char *job_mode, 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);
int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, sd_bus_error *error);
int manager_unit_is_active(Manager *manager, const char *unit, sd_bus_error *error);

View File

@ -152,7 +152,7 @@ int bus_seat_method_terminate(sd_bus_message *message, void *userdata, sd_bus_er
if (r == 0)
return 1; /* Will call us back */
r = seat_stop_sessions(s, /* force = */ true);
r = seat_stop_sessions(s, true);
if (r < 0)
return r;

View File

@ -178,7 +178,7 @@ int bus_session_method_terminate(sd_bus_message *message, void *userdata, sd_bus
if (r == 0)
return 1; /* Will call us back */
r = session_stop(s, /* force = */ true);
r = session_stop(s, true);
if (r < 0)
return r;

View File

@ -735,9 +735,10 @@ int session_start(Session *s, sd_bus_message *properties, sd_bus_error *error) {
/* Send signals */
session_send_signal(s, true);
user_send_changed(s->user, "Display", NULL);
if (s->seat && s->seat->active == s)
seat_send_changed(s->seat, "ActiveSession", NULL);
if (s->seat) {
if (s->seat->active == s)
seat_send_changed(s->seat, "ActiveSession", NULL);
}
return 0;
}
@ -768,7 +769,7 @@ static int session_stop_scope(Session *s, bool force) {
(s->user->user_record->kill_processes > 0 ||
manager_shall_kill(s->manager, s->user->user_record->user_name)))) {
r = manager_stop_unit(s->manager, s->scope, force ? "replace" : "fail", &error, &s->scope_job);
r = manager_stop_unit(s->manager, s->scope, &error, &s->scope_job);
if (r < 0) {
if (force)
return log_error_errno(r, "Failed to stop session scope: %s", bus_error_message(&error, r));
@ -881,7 +882,7 @@ static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *us
assert(es);
assert(s);
session_stop(s, /* force = */ false);
session_stop(s, false);
return 0;
}
@ -1053,7 +1054,7 @@ static int session_dispatch_fifo(sd_event_source *es, int fd, uint32_t revents,
/* EOF on the FIFO means the session died abnormally. */
session_remove_fifo(s);
session_stop(s, /* force = */ false);
session_stop(s, false);
return 1;
}

View File

@ -216,7 +216,7 @@ int bus_user_method_terminate(sd_bus_message *message, void *userdata, sd_bus_er
if (r == 0)
return 1; /* Will call us back */
r = user_stop(u, /* force */ true);
r = user_stop(u, true);
if (r < 0)
return r;

View File

@ -475,7 +475,7 @@ int user_start(User *u) {
return 0;
}
static void user_stop_service(User *u, bool force) {
static void user_stop_service(User *u) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
@ -487,7 +487,7 @@ static void user_stop_service(User *u, bool force) {
u->service_job = mfree(u->service_job);
r = manager_stop_unit(u->manager, u->service, force ? "replace" : "fail", &error, &u->service_job);
r = manager_stop_unit(u->manager, u->service, &error, &u->service_job);
if (r < 0)
log_warning_errno(r, "Failed to stop user service '%s', ignoring: %s", u->service, bus_error_message(&error, r));
}
@ -518,7 +518,7 @@ int user_stop(User *u, bool force) {
r = k;
}
user_stop_service(u, force);
user_stop_service(u);
u->stopping = true;

View File

@ -912,7 +912,7 @@ static void manager_gc(Manager *m, bool drop_not_started) {
seat->in_gc_queue = false;
if (seat_may_gc(seat, drop_not_started)) {
seat_stop(seat, /* force = */ false);
seat_stop(seat, false);
seat_free(seat);
}
}
@ -924,7 +924,7 @@ static void manager_gc(Manager *m, bool drop_not_started) {
/* First, if we are not closing yet, initiate stopping */
if (session_may_gc(session, drop_not_started) &&
session_get_state(session) != SESSION_CLOSING)
(void) session_stop(session, /* force = */ false);
(void) session_stop(session, false);
/* Normally, this should make the session referenced
* again, if it doesn't then let's get rid of it