X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fsocket.c;h=f67370b4cb921d0d041b7d5e7b4ed991af6a2db9;hb=4543768d13946e9193b367330cb32ded4d96058a;hp=85f7f16e15360cbe4dcefc49948c9882652d1553;hpb=82a2b6bb5e4e5d294f09af778c48974a7857afb6;p=elogind.git diff --git a/src/core/socket.c b/src/core/socket.c index 85f7f16e1..f67370b4c 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -19,7 +19,6 @@ along with systemd; If not, see . ***/ -#include #include #include #include @@ -29,12 +28,9 @@ #include #include #include -#include #include "sd-event.h" #include "log.h" -#include "load-dropin.h" -#include "load-fragment.h" #include "strv.h" #include "mkdir.h" #include "path-util.h" @@ -266,7 +262,7 @@ static int socket_add_device_link(Socket *s) { if (!s->bind_to_device || streq(s->bind_to_device, "lo")) return 0; - t = strappenda("/sys/subsystem/net/devices/", s->bind_to_device); + t = strjoina("/sys/subsystem/net/devices/", s->bind_to_device); return unit_add_node_link(UNIT(s), t, false); } @@ -473,7 +469,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { assert(f); prefix = strempty(prefix); - prefix2 = strappenda(prefix, "\t"); + prefix2 = strjoina(prefix, "\t"); fprintf(f, "%sSocket State: %s\n" @@ -1326,7 +1322,7 @@ static void socket_set_state(Socket *s, SocketState state) { unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true); } -static int socket_coldplug(Unit *u) { +static int socket_coldplug(Unit *u, Hashmap *deferred_work) { Socket *s = SOCKET(u); int r; @@ -1396,7 +1392,11 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) { assert(c); assert(_pid); - unit_realize_cgroup(UNIT(s)); + (void) unit_realize_cgroup(UNIT(s)); + if (s->reset_cpu_usage) { + (void) unit_reset_cpu_usage(UNIT(s)); + s->reset_cpu_usage = false; + } r = unit_setup_exec_runtime(UNIT(s)); if (r < 0) @@ -1952,6 +1952,8 @@ static int socket_start(Unit *u) { assert(s->state == SOCKET_DEAD || s->state == SOCKET_FAILED); s->result = SOCKET_SUCCESS; + s->reset_cpu_usage = true; + socket_enter_start_pre(s); return 1; @@ -2100,7 +2102,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, LIST_FOREACH(port, p, s->ports) if (p->type == SOCKET_FIFO && - streq_ptr(p->path, value+skip)) + path_equal_or_files_same(p->path, value+skip)) break; if (p) { @@ -2119,7 +2121,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, LIST_FOREACH(port, p, s->ports) if (p->type == SOCKET_SPECIAL && - streq_ptr(p->path, value+skip)) + path_equal_or_files_same(p->path, value+skip)) break; if (p) { @@ -2138,7 +2140,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, LIST_FOREACH(port, p, s->ports) if (p->type == SOCKET_MQUEUE && - streq_ptr(p->path, value+skip)) + streq(p->path, value+skip)) break; if (p) { @@ -2603,10 +2605,6 @@ static void socket_trigger_notify(Unit *u, Unit *other) { socket_notify_service_dead(s, se->result == SERVICE_FAILURE_START_LIMIT); if (se->state == SERVICE_DEAD || - se->state == SERVICE_STOP || - se->state == SERVICE_STOP_SIGTERM || - se->state == SERVICE_STOP_SIGKILL || - se->state == SERVICE_STOP_POST || se->state == SERVICE_FINAL_SIGTERM || se->state == SERVICE_FINAL_SIGKILL || se->state == SERVICE_AUTO_RESTART)