1SD_GET_SEATS(3)                  sd_get_seats                  SD_GET_SEATS(3)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

NOTES

53       Functions described here are available as a shared library, which can
54       be compiled against and linked to with the libsystemd pkg-config(1)
55       file.
56
57       The code described here uses getenv(3), which is declared to be not
58       multi-thread-safe. This means that the code calling the functions
59       described here must not call setenv(3) from a parallel thread. It is
60       recommended to only do calls to setenv() from an early phase of the
61       program when no other threads have been started.
62

SEE ALSO

64       systemd(1), sd-login(3), sd_session_get_seat(3)
65
66
67
68systemd 254                                                    SD_GET_SEATS(3)
Impressum