1SD_SEAT_GET_ACTIVE(3) sd_seat_get_active SD_SEAT_GET_ACTIVE(3)
2
3
4
6 sd_seat_get_active, sd_seat_get_sessions, sd_seat_can_multi_session,
7 sd_seat_can_tty, sd_seat_can_graphical - Determine state of a specific
8 seat
9
11 #include <systemd/sd-login.h>
12
13 int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
14
15 int sd_seat_get_sessions(const char *seat, char ***sessions,
16 uid_t **uid, unsigned int *n_uids);
17
18 int sd_seat_can_multi_session(const char *seat);
19
20 int sd_seat_can_tty(const char *seat);
21
22 int sd_seat_can_graphical(const char *seat);
23
25 sd_seat_get_active() may be used to determine which session is
26 currently active on a seat, if there is any. Returns the session
27 identifier and the user identifier of the Unix user the session is
28 belonging to. Either the session or the user identifier parameter can
29 be passed NULL, in case only one of the parameters shall be queried.
30 The returned string needs to be freed with the libc free(3) call after
31 use.
32
33 sd_seat_get_sessions() may be used to determine all sessions on the
34 specified seat. Returns two arrays, one (NULL terminated) with the
35 session identifiers of the sessions and one with the user identifiers
36 of the Unix users the sessions belong to. An additional parameter may
37 be used to return the number of entries in the latter array. The two
38 arrays and the latter parameter may be passed as NULL in case these
39 values need not to be determined. The arrays and the strings referenced
40 by them need to be freed with the libc free(3) call after use. Note
41 that instead of an empty array NULL may be returned and should be
42 considered equivalent to an empty array.
43
44 sd_seat_can_multi_session() may be used to determine whether a specific
45 seat is capable of multi-session, i.e. allows multiple login sessions
46 in parallel (with only one being active at a time).
47
48 sd_seat_can_tty() may be used to determine whether a specific seat
49 provides TTY functionality, i.e. is useful as a text console.
50
51 sd_seat_can_graphical() may be used to determine whether a specific
52 seat provides graphics functionality, i.e. is useful as a graphics
53 display.
54
55 If the seat parameter of any of these functions is passed as NULL, the
56 operation is executed for the seat of the session of the calling
57 process, if there is any.
58
60 On success, sd_seat_get_active() returns 0 or a positive integer. On
61 success, sd_seat_get_sessions() returns the number of entries in the
62 session identifier array. If the test succeeds,
63 sd_seat_can_multi_session, sd_seat_can_tty and sd_seat_can_graphical
64 return a positive integer, if it fails 0. On failure, these calls
65 return a negative errno-style error code.
66
68 The sd_seat_get_active(), sd_seat_get_sessions(),
69 sd_seat_can_multi_session(), sd_seat_can_tty() and
70 sd_seat_can_grapical() interfaces are available as a shared library,
71 which can be compiled and linked to with the libsystemd pkg-config(1)
72 file.
73
75 systemd(1), sd-login(3), sd_session_get_seat(3)
76
77
78
79systemd 219 SD_SEAT_GET_ACTIVE(3)