core: port unit_main_pid() + unit_control_pid() to PidRef and drop unit_kill_common()

This ports over unit_main_pid() + unit_control_pid() to return PidRef*
pointers (which also means the underlying UnitVTable function pointers
are changed accordingly).

This then uses te functions to simplify the unit_kill() call, by
avoiding the kill() vtable indirection and instead just suing
unit_main_pid() and unit_control_pid() directly.
This commit is contained in:
Lennart Poettering
2023-09-18 19:08:09 +02:00
parent a0d1659c23
commit 37eb258e91
11 changed files with 60 additions and 133 deletions
-6
View File
@@ -533,10 +533,6 @@ static void scope_reset_failed(Unit *u) {
s->result = SCOPE_SUCCESS;
}
static int scope_kill(Unit *u, KillWho who, int signo, int code, int value, sd_bus_error *error) {
return unit_kill_common(u, who, signo, code, value, -1, -1, error);
}
static int scope_get_timeout(Unit *u, usec_t *timeout) {
Scope *s = SCOPE(u);
usec_t t;
@@ -830,8 +826,6 @@ const UnitVTable scope_vtable = {
.start = scope_start,
.stop = scope_stop,
.kill = scope_kill,
.freeze = unit_freeze_vtable_common,
.thaw = unit_thaw_vtable_common,