a->result = AUTOMOUNT_SUCCESS;
automount_enter_waiting(a);
- return 0;
+ return 1;
}
static int automount_stop(Unit *u) {
assert(a->state == AUTOMOUNT_WAITING || a->state == AUTOMOUNT_RUNNING);
automount_enter_dead(a, AUTOMOUNT_SUCCESS);
- return 0;
+ return 1;
}
static int automount_serialize(Unit *u, FILE *f, FDSet *fds) {
n->result = BUSNAME_SUCCESS;
busname_enter_making(n);
- return 0;
+ return 1;
}
static int busname_stop(Unit *u) {
assert(IN_SET(n->state, BUSNAME_REGISTERED, BUSNAME_LISTENING, BUSNAME_RUNNING));
busname_enter_dead(n, BUSNAME_SUCCESS);
- return 0;
+ return 1;
}
static int busname_serialize(Unit *u, FILE *f, FDSet *fds) {
m->reload_result = MOUNT_SUCCESS;
mount_enter_mounting(m);
- return 0;
+ return 1;
}
static int mount_stop(Unit *u) {
m->state == MOUNT_REMOUNTING_SIGKILL);
mount_enter_unmounting(m);
- return 0;
+ return 1;
}
static int mount_reload(Unit *u) {
p->result = PATH_SUCCESS;
path_enter_waiting(p, true, true);
- return 0;
+ return 1;
}
static int path_stop(Unit *u) {
assert(p->state == PATH_WAITING || p->state == PATH_RUNNING);
path_enter_dead(p, PATH_SUCCESS);
- return 0;
+ return 1;
}
static int path_serialize(Unit *u, FILE *f, FDSet *fds) {
s->result = SCOPE_SUCCESS;
scope_set_state(s, SCOPE_RUNNING);
- return 0;
+ return 1;
}
static int scope_stop(Unit *u) {
s->state == SCOPE_ABANDONED);
scope_enter_signal(s, SCOPE_STOP_SIGTERM, SCOPE_SUCCESS);
- return 0;
+ return 1;
}
static void scope_reset_failed(Unit *u) {
s->notify_state = NOTIFY_UNKNOWN;
service_enter_start_pre(s);
- return 0;
+ return 1;
}
static int service_stop(Unit *u) {
s->state == SERVICE_EXITED);
service_enter_stop(s, SERVICE_SUCCESS);
- return 0;
+ return 1;
}
static int service_reload(Unit *u) {
unit_realize_cgroup(u);
slice_set_state(t, SLICE_ACTIVE);
- return 0;
+ return 1;
}
static int slice_stop(Unit *u) {
* unit_notify() will do that for us anyway. */
slice_set_state(t, SLICE_DEAD);
- return 0;
+ return 1;
}
static int slice_kill(Unit *u, KillWho who, int signo, sd_bus_error *error) {
if (s->cleanup)
unit_add_to_cleanup_queue(u);
- return 0;
+ return 1;
}
static int snapshot_stop(Unit *u) {
assert(s->state == SNAPSHOT_ACTIVE);
snapshot_set_state(s, SNAPSHOT_DEAD);
- return 0;
+ return 1;
}
static int snapshot_serialize(Unit *u, FILE *f, FDSet *fds) {
s->result = SOCKET_SUCCESS;
socket_enter_start_pre(s);
- return 0;
+ return 1;
}
static int socket_stop(Unit *u) {
assert(s->state == SOCKET_LISTENING || s->state == SOCKET_RUNNING);
socket_enter_stop_pre(s, SOCKET_SUCCESS);
- return 0;
+ return 1;
}
static int socket_serialize(Unit *u, FILE *f, FDSet *fds) {
s->result = SWAP_SUCCESS;
swap_enter_activating(s);
- return 0;
+ return 1;
}
static int swap_stop(Unit *u) {
return -EPERM;
swap_enter_deactivating(s);
- return 0;
+ return 1;
}
static int swap_serialize(Unit *u, FILE *f, FDSet *fds) {
assert(t->state == TARGET_DEAD);
target_set_state(t, TARGET_ACTIVE);
- return 0;
+ return 1;
}
static int target_stop(Unit *u) {
assert(t->state == TARGET_ACTIVE);
target_set_state(t, TARGET_DEAD);
- return 0;
+ return 1;
}
static int target_serialize(Unit *u, FILE *f, FDSet *fds) {
t->result = TIMER_SUCCESS;
timer_enter_waiting(t, true);
- return 0;
+ return 1;
}
static int timer_stop(Unit *u) {
assert(t->state == TIMER_WAITING || t->state == TIMER_RUNNING || t->state == TIMER_ELAPSED);
timer_enter_dead(t, TIMER_SUCCESS);
- return 0;
+ return 1;
}
static int timer_serialize(Unit *u, FILE *f, FDSet *fds) {
int unit_start(Unit *u) {
UnitActiveState state;
Unit *following;
+ int r;
assert(u);
return unit_start(following);
}
- unit_status_log_starting_stopping_reloading(u, JOB_START);
- unit_status_print_starting_stopping(u, JOB_START);
-
if (UNIT_VTABLE(u)->supported && !UNIT_VTABLE(u)->supported(u->manager))
return -ENOTSUP;
unit_add_to_dbus_queue(u);
- return UNIT_VTABLE(u)->start(u);
+ r = UNIT_VTABLE(u)->start(u);
+ if (r <= 0)
+ return r;
+
+ /* Log if the start function actually did something */
+ unit_status_log_starting_stopping_reloading(u, JOB_START);
+ unit_status_print_starting_stopping(u, JOB_START);
+ return r;
}
bool unit_can_start(Unit *u) {
int unit_stop(Unit *u) {
UnitActiveState state;
Unit *following;
+ int r;
assert(u);
return unit_stop(following);
}
- unit_status_log_starting_stopping_reloading(u, JOB_STOP);
- unit_status_print_starting_stopping(u, JOB_STOP);
-
if (!UNIT_VTABLE(u)->stop)
return -EBADR;
unit_add_to_dbus_queue(u);
- return UNIT_VTABLE(u)->stop(u);
+ r = UNIT_VTABLE(u)->stop(u);
+ if (r <= 0)
+ return r;
+
+ unit_status_log_starting_stopping_reloading(u, JOB_STOP);
+ unit_status_print_starting_stopping(u, JOB_STOP);
+ return r;
}
/* Errors:
int unit_reload(Unit *u) {
UnitActiveState state;
Unit *following;
+ int r;
assert(u);
return unit_reload(following);
}
- unit_status_log_starting_stopping_reloading(u, JOB_RELOAD);
-
unit_add_to_dbus_queue(u);
- return UNIT_VTABLE(u)->reload(u);
+
+ r = UNIT_VTABLE(u)->reload(u);
+ if (r <= 0)
+ return r;
+
+ unit_status_log_starting_stopping_reloading(u, JOB_RELOAD);
+ return r;
}
bool unit_can_reload(Unit *u) {