]> err.no Git - systemd/commitdiff
sd-login: add new call sd_seat_can_multi_session()
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Jul 2011 21:09:09 +0000 (23:09 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Jul 2011 21:09:09 +0000 (23:09 +0200)
TODO
src/libsystemd-login.sym
src/sd-login.c
src/sd-login.h
src/test-login.c

diff --git a/TODO b/TODO
index 0a1f98d5529d3bdde6739afeb82fff13eb085a41..ba3679432bc685c8a8e6cdd42f2aafea10a29a7d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -225,8 +225,6 @@ Features:
 
 * readahead: btrfs/LVM SSD detection
 
-* add separate man page for [Install] settings
-
 * allow runtime changing of log level and target
 
 * drop cap bounding set in readahead and other services
index cd5f52c3419f62d042f76c27d5f48c56474b468d..0d51fa76e76189a9335c79d56a3a7fa48c52f057 100644 (file)
@@ -20,6 +20,7 @@ global:
         sd_login_monitor_unref;
         sd_pid_get_owner_uid;
         sd_pid_get_session;
+        sd_seat_can_multi_session;
         sd_seat_get_active;
         sd_seat_get_sessions;
         sd_session_get_seat;
index 2c5b153fba7eb5fc012c754d3bb0dbfc120606bf..d44a1fcf9c473487f5e48355f2681659a3305de1 100644 (file)
@@ -522,6 +522,36 @@ _public_ int sd_seat_get_sessions(const char *seat, char ***sessions, uid_t **ui
         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)
index c6835e123545774a4b66889344d5f517eea4ec8b..1623a7dbf612fd1bd16517e56edefa41b59f62b3 100644 (file)
@@ -82,6 +82,9 @@ int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
 /* Return sessions and users on seat */
 int sd_seat_get_sessions(const char *seat, char ***sessions, uid_t **uid, unsigned *n_uids);
 
+/* Return whether the seat is multi-session capable */
+int sd_seat_can_multi_session(const char *seat);
+
 /* Get all seats */
 int sd_get_seats(char ***seats);
 
index 21cd3a190029fe8f0bed150f3374420cf8f8c4d9..9cd9c27a587f8c86bda890ad89ec0f0f6b057c3c 100644 (file)
@@ -71,6 +71,10 @@ int main(int argc, char* argv[]) {
         assert_se(sd_session_get_seat(session, &seat) >= 0);
         printf("seat = %s\n", seat);
 
+        r = sd_seat_can_multi_session(seat);
+        assert_se(r >= 0);
+        printf("can do multi session = %s\n", yes_no(r));
+
         assert_se(sd_uid_get_state(u, &state) >= 0);
         printf("state = %s\n", state);