diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-02-15 17:47:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-15 17:47:37 +0100 |
commit | a94ab7acfd852c77775498796af180d6f36f3ba3 (patch) | |
tree | 57af490a41a1ad2be6bc6ad8582fa7663b826046 /src/core/service.c | |
parent | 476f65f98a60b070bfec85842f220f0d37819f7f (diff) | |
parent | 554ce41f619f0a03b5fc777af4b923ff68fe13d4 (diff) | |
download | systemd-a94ab7acfd852c77775498796af180d6f36f3ba3.tar.gz |
Merge pull request #8175 from keszybz/gc-cleanup
Garbage collection cleanup
Diffstat (limited to 'src/core/service.c')
-rw-r--r-- | src/core/service.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/service.c b/src/core/service.c index ab4626f51b..f2d4333719 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2683,7 +2683,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value, if (r < 0) log_unit_debug_errno(u, r, "Failed to load accept-socket unit: %s", value); else { - unit_ref_set(&s->accept_socket, socket); + unit_ref_set(&s->accept_socket, u, socket); SOCKET(socket)->n_connections++; } @@ -2832,20 +2832,20 @@ static const char *service_sub_state_to_string(Unit *u) { return service_state_to_string(SERVICE(u)->state); } -static bool service_check_gc(Unit *u) { +static bool service_may_gc(Unit *u) { Service *s = SERVICE(u); assert(s); /* Never clean up services that still have a process around, even if the service is formally dead. Note that - * unit_check_gc() already checked our cgroup for us, we just check our two additional PIDs, too, in case they + * unit_may_gc() already checked our cgroup for us, we just check our two additional PIDs, too, in case they * have moved outside of the cgroup. */ if (main_pid_good(s) > 0 || control_pid_good(s) > 0) - return true; + return false; - return false; + return true; } static int service_retry_pid_file(Service *s) { @@ -3769,7 +3769,7 @@ int service_set_socket_fd(Service *s, int fd, Socket *sock, bool selinux_context s->socket_fd = fd; s->socket_fd_selinux_context_net = selinux_context_net; - unit_ref_set(&s->accept_socket, UNIT(sock)); + unit_ref_set(&s->accept_socket, UNIT(s), UNIT(sock)); return 0; } @@ -3936,7 +3936,7 @@ const UnitVTable service_vtable = { .will_restart = service_will_restart, - .check_gc = service_check_gc, + .may_gc = service_may_gc, .sigchld_event = service_sigchld_event, |