mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 14:40:31 +00:00
core: introduce unit_unwatch_pidref_done() helper function
No functional change, just refactoring.
This commit is contained in:
@@ -218,12 +218,7 @@ static int mount_arm_timer(Mount *m, bool relative, usec_t usec) {
|
||||
|
||||
static void mount_unwatch_control_pid(Mount *m) {
|
||||
assert(m);
|
||||
|
||||
if (!pidref_is_set(&m->control_pid))
|
||||
return;
|
||||
|
||||
unit_unwatch_pidref(UNIT(m), &m->control_pid);
|
||||
pidref_done(&m->control_pid);
|
||||
unit_unwatch_pidref_done(UNIT(m), &m->control_pid);
|
||||
}
|
||||
|
||||
static void mount_parameters_done(MountParameters *p) {
|
||||
|
||||
@@ -152,22 +152,12 @@ static void service_init(Unit *u) {
|
||||
|
||||
static void service_unwatch_control_pid(Service *s) {
|
||||
assert(s);
|
||||
|
||||
if (!pidref_is_set(&s->control_pid))
|
||||
return;
|
||||
|
||||
unit_unwatch_pidref(UNIT(s), &s->control_pid);
|
||||
pidref_done(&s->control_pid);
|
||||
unit_unwatch_pidref_done(UNIT(s), &s->control_pid);
|
||||
}
|
||||
|
||||
static void service_unwatch_main_pid(Service *s) {
|
||||
assert(s);
|
||||
|
||||
if (!pidref_is_set(&s->main_pid))
|
||||
return;
|
||||
|
||||
unit_unwatch_pidref(UNIT(s), &s->main_pid);
|
||||
pidref_done(&s->main_pid);
|
||||
unit_unwatch_pidref_done(UNIT(s), &s->main_pid);
|
||||
}
|
||||
|
||||
static void service_unwatch_pid_file(Service *s) {
|
||||
|
||||
@@ -108,12 +108,7 @@ static void socket_init(Unit *u) {
|
||||
|
||||
static void socket_unwatch_control_pid(Socket *s) {
|
||||
assert(s);
|
||||
|
||||
if (!pidref_is_set(&s->control_pid))
|
||||
return;
|
||||
|
||||
unit_unwatch_pidref(UNIT(s), &s->control_pid);
|
||||
pidref_done(&s->control_pid);
|
||||
unit_unwatch_pidref_done(UNIT(s), &s->control_pid);
|
||||
}
|
||||
|
||||
static void socket_cleanup_fd_list(SocketPort *p) {
|
||||
|
||||
@@ -152,12 +152,7 @@ static void swap_init(Unit *u) {
|
||||
|
||||
static void swap_unwatch_control_pid(Swap *s) {
|
||||
assert(s);
|
||||
|
||||
if (!pidref_is_set(&s->control_pid))
|
||||
return;
|
||||
|
||||
unit_unwatch_pidref(UNIT(s), &s->control_pid);
|
||||
pidref_done(&s->control_pid);
|
||||
unit_unwatch_pidref_done(UNIT(s), &s->control_pid);
|
||||
}
|
||||
|
||||
static void swap_done(Unit *u) {
|
||||
|
||||
@@ -2934,6 +2934,16 @@ void unit_unwatch_all_pids(Unit *u) {
|
||||
u->pids = set_free(u->pids);
|
||||
}
|
||||
|
||||
void unit_unwatch_pidref_done(Unit *u, PidRef *pidref) {
|
||||
assert(u);
|
||||
|
||||
if (!pidref_is_set(pidref))
|
||||
return;
|
||||
|
||||
unit_unwatch_pidref(u, pidref);
|
||||
pidref_done(pidref);
|
||||
}
|
||||
|
||||
static void unit_tidy_watch_pids(Unit *u) {
|
||||
PidRef *except1, *except2, *e;
|
||||
|
||||
|
||||
@@ -936,6 +936,7 @@ int unit_watch_pid(Unit *u, pid_t pid, bool exclusive);
|
||||
void unit_unwatch_pidref(Unit *u, const PidRef *pid);
|
||||
void unit_unwatch_pid(Unit *u, pid_t pid);
|
||||
void unit_unwatch_all_pids(Unit *u);
|
||||
void unit_unwatch_pidref_done(Unit *u, PidRef *pidref);
|
||||
|
||||
int unit_enqueue_rewatch_pids(Unit *u);
|
||||
void unit_dequeue_rewatch_pids(Unit *u);
|
||||
|
||||
Reference in New Issue
Block a user