Description : Adding to send new system signal for user session done.
authorwchang kim <wchang.kim@samsung.com>
Tue, 15 Nov 2016 02:29:15 +0000 (11:29 +0900)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 26 Jan 2024 16:49:49 +0000 (17:49 +0100)
When user-session is done, systemd will send new system signal for user-session done.

interface=org.freedesktop.systemd1.Manager,member=UserSessionStartupFinished
UserSessionStartupFinished(t user_id)

Change-Id: I2ee9a2f232c22428894217fc2a519ec9c017fb2c
Signed-off-by: Woochang Kim <wchang.kim@samsung.com>
src/core/dbus-manager.c
src/core/dbus-manager.h
src/core/manager.c

index d05968b..932028b 100644 (file)
@@ -2230,6 +2230,35 @@ static int send_finished(sd_bus *bus, void *userdata) {
         return sd_bus_send(bus, message, NULL);
 }
 
+static int send_user_finished_to_system(sd_bus *bus, uid_t user_id) {
+        _cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
+        int r;
+
+        assert(bus);
+
+        r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "UserSessionStartupFinished");
+        if (r < 0)
+                return r;
+
+        r = sd_bus_message_append(message, "t", user_id);
+        if (r < 0)
+                return r;
+
+        return sd_bus_send(bus, message, NULL);
+}
+
+void bus_manager_send_user_finished_to_system(Manager *m, uid_t user_id)
+{
+        int r;
+
+        r = send_user_finished_to_system(m->system_bus, user_id);
+
+        if (r < 0)
+                log_debug_errno(r, "Failed to send user-session finished signal: %m");
+
+        return;
+}
+
 void bus_manager_send_finished(
                 Manager *m,
                 usec_t firmware_usec,
index 36a2e94..cffb4aa 100644 (file)
@@ -23,6 +23,7 @@
 
 extern const sd_bus_vtable bus_manager_vtable[];
 
+void bus_manager_send_user_finished_to_system(Manager *m, uid_t user_id);
 void bus_manager_send_finished(Manager *m, usec_t firmware_usec, usec_t loader_usec, usec_t kernel_usec, usec_t initrd_usec, usec_t userspace_usec, usec_t total_usec);
 void bus_manager_send_reloading(Manager *m, bool active);
 void bus_manager_send_change_signal(Manager *m);
index 8cce909..719e6da 100644 (file)
@@ -2792,6 +2792,7 @@ static void manager_notify_finished(Manager *m) {
                            LOG_MESSAGE("Startup finished in %s.",
                                        format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)),
                            NULL);
+                bus_manager_send_user_finished_to_system(m, getuid());
         }
 
         bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);