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
@@ -247,10 +247,6 @@ static int slice_stop(Unit *u) {
return 1;
}
static int slice_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 slice_serialize(Unit *u, FILE *f, FDSet *fds) {
Slice *s = SLICE(u);
@@ -436,8 +432,6 @@ const UnitVTable slice_vtable = {
.start = slice_start,
.stop = slice_stop,
.kill = slice_kill,
.freeze = slice_freeze,
.thaw = slice_thaw,
.can_freeze = slice_can_freeze,