_public_ int sd_session_get_uid(const char *session, uid_t *uid) {
int r;
char *p, *s = NULL;
- unsigned long ul;
if (!session)
return -EINVAL;
if (!s)
return -EIO;
- r = safe_atolu(s, &ul);
+ r = parse_uid(s, uid);
free(s);
- if (r < 0)
- return r;
-
- *uid = (uid_t) ul;
- return 0;
+ return r;
}
_public_ int sd_session_get_seat(const char *session, char **seat) {
return 0;
}
+_public_ int sd_seat_can_multi_session(const char *seat) {
+ char *p, *s = NULL;
+ int r;
+
+ if (!seat)
+ return -EINVAL;
+
+ p = strappend("/run/systemd/seats/", seat);
+ if (!p)
+ return -ENOMEM;
+
+ r = parse_env_file(p, NEWLINE,
+ "IS_VTCONSOLE", &s,
+ NULL);
+ free(p);
+
+ if (r < 0) {
+ free(s);
+ return r;
+ }
+
+ if (s) {
+ r = parse_boolean(s);
+ free(s);
+ } else
+ r = 0;
+
+ return r;
+}
+
_public_ int sd_get_seats(char ***seats) {
if (!seats)
}
_public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) {
- const char *path;
int fd, k;
bool good = false;