return r;
}
+_public_ int sd_session_get_state(const char *session, char **state) {
+ char *p, *s = NULL;
+ int r;
+
+ if (!state)
+ return -EINVAL;
+
+ r = file_of_session(session, &p);
+ if (r < 0)
+ return r;
+
+ r = parse_env_file(p, NEWLINE, "STATE", &s, NULL);
+ free(p);
+
+ if (r < 0) {
+ free(s);
+ return r;
+ } else if (!s)
+ return -EIO;
+
+ *state = s;
+ return 0;
+}
+
_public_ int sd_session_get_uid(const char *session, uid_t *uid) {
int r;
char *p, *s = NULL;
return r;
}
-_public_ int sd_seat_can_multi_session(const char *seat) {
+static int seat_get_can(const char *seat, const char *variable) {
char *p, *s = NULL;
int r;
return r;
r = parse_env_file(p, NEWLINE,
- "CAN_MULTI_SESSION", &s,
+ variable, &s,
NULL);
free(p);
return r;
}
+_public_ int sd_seat_can_multi_session(const char *seat) {
+ return seat_get_can(seat, "CAN_MULTI_SESSION");
+}
+
+_public_ int sd_seat_can_tty(const char *seat) {
+ return seat_get_can(seat, "CAN_TTY");
+}
+
+_public_ int sd_seat_can_graphical(const char *seat) {
+ return seat_get_can(seat, "CAN_GRAPHICAL");
+}
+
_public_ int sd_get_seats(char ***seats) {
return get_files_in_directory("/run/systemd/seats/", seats);
}