1SD_GET_SEATS(3) sd_get_seats SD_GET_SEATS(3)
2
3
4
6 sd_get_seats, sd_get_sessions, sd_get_uids, sd_get_machine_names -
7 Determine available seats, sessions, logged in users and virtual
8 machines/containers
9
11 #include <systemd/sd-login.h>
12
13 int sd_get_seats(char ***seats);
14
15 int sd_get_sessions(char ***sessions);
16
17 int sd_get_uids(uid_t **users);
18
19 int sd_get_machine_names(char ***machines);
20
22 sd_get_seats() may be used to determine all currently available local
23 seats. Returns the number of seat identifiers and if the input pointer
24 is non-NULL, a NULL-terminated array of seat identifiers is stored at
25 the address. The returned array and all strings it references need to
26 be freed with the libc free(3) call after use. Note that instead of an
27 empty array NULL may be returned and should be considered equivalent to
28 an empty array.
29
30 Similarly, sd_get_sessions() may be used to determine all current login
31 sessions.
32
33 Similarly, sd_get_uids() may be used to determine all Unix users who
34 currently have login sessions.
35
36 Similarly, sd_get_machine_names() may be used to determine all current
37 virtual machines and containers on the system.
38
39 Note that the returned lists are not sorted and in an undefined order.
40
42 On success, sd_get_seats(), sd_get_sessions(), sd_get_uids() and
43 sd_get_machine_names() return the number of entries in the arrays. On
44 failure, these calls return a negative errno-style error code.
45
46 Errors
47 Returned errors may indicate the following problems:
48
49 -ENOMEM
50 Memory allocation failed.
51
53 These APIs are implemented as a shared library, which can be compiled
54 and linked to with the libsystemd pkg-config(1) file.
55
57 systemd(1), sd-login(3), sd_session_get_seat(3)
58
59
60
61systemd 253 SD_GET_SEATS(3)