swap: hook up with handoff timestamps
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Apr 2024 08:13:55 +0000 (10:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 Apr 2024 11:40:41 +0000 (13:40 +0200)
src/core/swap.c

index 3d2026072870503837b519950a2364d35c2cf5ea..222241c9da20e22431f9656c19ebd848aec68c40 100644 (file)
@@ -1422,6 +1422,22 @@ static void swap_reset_failed(Unit *u) {
         s->clean_result = SWAP_SUCCESS;
 }
 
+static void swap_handoff_timestamp(
+                Unit *u,
+                const struct ucred *ucred,
+                const dual_timestamp *ts) {
+
+        Swap *s = ASSERT_PTR(SWAP(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 swap_get_timeout(Unit *u, usec_t *timeout) {
         Swap *s = ASSERT_PTR(SWAP(u));
         usec_t t;
@@ -1608,6 +1624,8 @@ const UnitVTable swap_vtable = {
 
         .reset_failed = swap_reset_failed,
 
+        .notify_handoff_timestamp = swap_handoff_timestamp,
+
         .control_pid = swap_control_pid,
 
         .bus_set_property = bus_swap_set_property,