]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket: hookup handoff timestamps with processes forked off by socket units
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Apr 2024 07:47:29 +0000 (09:47 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 Apr 2024 11:40:41 +0000 (13:40 +0200)
src/core/socket.c

index 4c8428d1a9a36bd0fdf05ae1939096d3ca75f3e1..41147d4bf74e0211f17988c01141b6fe3954049a 100644 (file)
@@ -3378,6 +3378,22 @@ static void socket_trigger_notify(Unit *u, Unit *other) {
                 socket_set_state(s, SOCKET_RUNNING);
 }
 
+static void socket_handoff_timestamp(
+                Unit *u,
+                const struct ucred *ucred,
+                const dual_timestamp *ts) {
+
+        Socket *s = ASSERT_PTR(SOCKET(u));
+
+        assert(ucred);
+        assert(ts);
+
+        if (s->control_pid.pid == ucred->pid && s->control_command) {
+                exec_status_handoff(&s->control_command->exec_status, ucred, ts);
+                unit_add_to_dbus_queue(u);
+        }
+}
+
 static int socket_get_timeout(Unit *u, usec_t *timeout) {
         Socket *s = ASSERT_PTR(SOCKET(u));
         usec_t t;
@@ -3580,6 +3596,8 @@ const UnitVTable socket_vtable = {
 
         .reset_failed = socket_reset_failed,
 
+        .notify_handoff_timestamp = socket_handoff_timestamp,
+
         .control_pid = socket_control_pid,
 
         .bus_set_property = bus_socket_set_property,