return r;
}
+
+int seat_send_signal(Seat *s, bool new_seat) {
+ DBusMessage *m;
+ int r = -ENOMEM;
+ char *p = NULL;
+
+ assert(s);
+
+ m = dbus_message_new_signal("/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ new_seat ? "SeatNew" : "SeatRemoved");
+
+ if (!m)
+ return -ENOMEM;
+
+ p = seat_bus_path(s);
+ if (!p)
+ goto finish;
+
+ if (!dbus_message_append_args(
+ m,
+ DBUS_TYPE_STRING, &s->id,
+ DBUS_TYPE_OBJECT_PATH, &p,
+ DBUS_TYPE_INVALID))
+ goto finish;
+
+ if (!dbus_connection_send(s->manager->bus, m, NULL))
+ goto finish;
+
+ r = 0;
+
+finish:
+ dbus_message_unref(m);
+ free(p);
+
+ return r;
+}
s->started = true;
+ seat_send_signal(s, true);
+
return 0;
}
log_info("Removed seat %s.", s->id);
+ seat_send_signal(s, false);
+
seat_stop_sessions(s);
unlink(s->state_file);
extern const DBusObjectPathVTable bus_seat_vtable;
+int seat_send_signal(Seat *s, bool new_seat);
+
#endif
return r;
}
+
+int session_send_signal(Session *s, bool new_session) {
+ DBusMessage *m;
+ int r = -ENOMEM;
+ char *p = NULL;
+
+ assert(s);
+
+ m = dbus_message_new_signal("/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ new_session ? "SessionNew" : "SessionRemoved");
+
+ if (!m)
+ return -ENOMEM;
+
+ p = session_bus_path(s);
+ if (!p)
+ goto finish;
+
+ if (!dbus_message_append_args(
+ m,
+ DBUS_TYPE_STRING, &s->id,
+ DBUS_TYPE_OBJECT_PATH, &p,
+ DBUS_TYPE_INVALID))
+ goto finish;
+
+ if (!dbus_connection_send(s->manager->bus, m, NULL))
+ goto finish;
+
+ r = 0;
+
+finish:
+ dbus_message_unref(m);
+ free(p);
+
+ return r;
+}
dual_timestamp_get(&s->timestamp);
+ session_send_signal(s, true);
+
return 0;
}
assert(s);
+ session_send_signal(s, false);
+
/* Kill cgroup */
k = session_kill_cgroup(s);
if (k < 0)
extern const DBusObjectPathVTable bus_session_vtable;
+int session_send_signal(Session *s, bool new_session);
+
const char* session_type_to_string(SessionType t);
SessionType session_type_from_string(const char *s);
return s;
}
+
+int user_send_signal(User *u, bool new_user) {
+ DBusMessage *m;
+ int r = -ENOMEM;
+ char *p = NULL;
+ uint32_t uid;
+
+ assert(u);
+
+ m = dbus_message_new_signal("/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ new_user ? "UserNew" : "UserRemoved");
+
+ if (!m)
+ return -ENOMEM;
+
+ p = user_bus_path(u);
+ if (!p)
+ goto finish;
+
+ uid = u->uid;
+
+ if (!dbus_message_append_args(
+ m,
+ DBUS_TYPE_UINT32, &uid,
+ DBUS_TYPE_OBJECT_PATH, &p,
+ DBUS_TYPE_INVALID))
+ goto finish;
+
+ if (!dbus_connection_send(u->manager->bus, m, NULL))
+ goto finish;
+
+ r = 0;
+
+finish:
+ dbus_message_unref(m);
+ free(p);
+
+ return r;
+}
dual_timestamp_get(&u->timestamp);
+ user_send_signal(u, true);
+
return 0;
}
r = k;
}
+ user_send_signal(u, false);
+
/* Kill systemd */
k = user_stop_service(u);
if (k < 0)
extern const DBusObjectPathVTable bus_user_vtable;
+int user_send_signal(User *u, bool new_user);
+
const char* user_state_to_string(UserState s);
UserState user_state_from_string(const char *s);