1SD_SEAT_GET_ACTIVE(3)         sd_seat_get_active         SD_SEAT_GET_ACTIVE(3)
2
3
4

NAME

6       sd_seat_get_active, sd_seat_get_sessions, sd_seat_can_tty,
7       sd_seat_can_graphical - Determine state of a specific seat
8

SYNOPSIS

10       #include <systemd/sd-login.h>
11
12       int sd_seat_get_active(const char *seat, char **session, uid_t *uid);
13
14       int sd_seat_get_sessions(const char *seat, char ***ret_sessions,
15                                uid_t **ret_uids, unsigned int *ret_n_uids);
16
17       int sd_seat_can_tty(const char *seat);
18
19       int sd_seat_can_graphical(const char *seat);
20

DESCRIPTION

22       sd_seat_get_active() may be used to determine which session is
23       currently active on a seat, if there is any. Returns the session
24       identifier and the user identifier of the Unix user the session is
25       belonging to. Either the session or the user identifier parameter can
26       be passed NULL, in case only one of the parameters shall be queried.
27       The returned string needs to be freed with the libc free(3) call after
28       use.
29
30       sd_seat_get_sessions() may be used to determine all sessions on the
31       specified seat. Returns two arrays, one (NULL terminated) with the
32       session identifiers of the sessions and one with the user identifiers
33       of the Unix users the sessions belong to. An additional parameter may
34       be used to return the number of entries in the latter array. This value
35       is the same as the return value if the return value is nonnegative. The
36       output parameters may be passed as NULL in case these output values are
37       not needed. The arrays and the strings referenced by them need to be
38       freed with the libc free(3) call after use. Note that instead of an
39       empty array NULL may be returned and should be considered equivalent to
40       an empty array.
41
42       sd_seat_can_tty() may be used to determine whether a specific seat
43       provides TTY functionality, i.e. is useful as a text console.
44
45       sd_seat_can_graphical() may be used to determine whether a specific
46       seat provides graphics functionality, i.e. is useful as a graphics
47       display.
48
49       If the seat parameter of any of these functions is passed as NULL, the
50       operation is executed for the seat of the session of the calling
51       process, if there is any.
52

RETURN VALUE

54       On success, sd_seat_get_active() returns 0 or a positive integer. On
55       success, sd_seat_get_sessions() returns the number of entries in the
56       session identifier array. If the test succeeds, sd_seat_can_tty() and
57       sd_seat_can_graphical() return a positive integer, if it fails 0. On
58       failure, these calls return a negative errno-style error code.
59
60   Errors
61       Returned errors may indicate the following problems:
62
63       -ENODATA
64           The given field is not specified for the described seat.
65
66       -ENXIO
67           The specified seat is unknown.
68
69       -EINVAL
70           An input parameter was invalid (out of range, or NULL, where that
71           is not accepted).
72
73       -ENOMEM
74           Memory allocation failed.
75

NOTES

77       These APIs are implemented as a shared library, which can be compiled
78       and linked to with the libsystemd pkg-config(1) file.
79

HISTORY

81       In the past, sd_seat_can_multi_session() was used to check whether the
82       seat supports multiple sessions. All seats support that now, so that
83       function has been deprecated and always returns true.
84

SEE ALSO

86       systemd(1), sd-login(3), sd_session_get_seat(3)
87
88
89
90systemd 249                                              SD_SEAT_GET_ACTIVE(3)
Impressum