1SD-LOGIN(3) sd-login SD-LOGIN(3)
2
3
4
6 sd-login - APIs for tracking logins
7
9 #include <systemd/sd-login.h>
10
11 pkg-config --cflags --libs libsystemd
12
14 sd-login.h provides APIs to introspect and monitor seat, login session
15 and user status information on the local system.
16
17 See Multi-Seat on Linux[1] for an introduction into multi-seat support
18 on Linux, the background for this set of APIs.
19
20 Note that these APIs only allow purely passive access and monitoring of
21 seats, sessions and users. To actively make changes to the seat
22 configuration, terminate login sessions, or switch session on a seat
23 you need to utilize the D-Bus API of systemd-logind, instead.
24
25 These functions synchronously access data in /proc, /sys/fs/cgroup and
26 /run. All of these are virtual file systems, hence the runtime cost of
27 the accesses is relatively cheap.
28
29 It is possible (and often a very good choice) to mix calls to the
30 synchronous interface of sd-login.h with the asynchronous D-Bus
31 interface of systemd-logind. However, if this is done you need to think
32 a bit about possible races since the stream of events from D-Bus and
33 from sd-login.h interfaces such as the login monitor are asynchronous
34 and not ordered against each other.
35
36 If the functions return string arrays, these are generally NULL
37 terminated and need to be freed by the caller with the libc free(3)
38 call after use, including the strings referenced therein. Similarly,
39 individual strings returned need to be freed, as well.
40
41 As a special exception, instead of an empty string array NULL may be
42 returned, which should be treated equivalent to an empty string array.
43
44 See sd_pid_get_session(3), sd_uid_get_state(3),
45 sd_session_is_active(3), sd_seat_get_active(3), sd_get_seats(3),
46 sd_login_monitor_new(3) for more information about the functions
47 implemented.
48
50 These APIs are implemented as a shared library, which can be compiled
51 and linked to with the libsystemd pkg-config(1) file.
52
54 systemd(1), sd_pid_get_session(3), sd_uid_get_state(3),
55 sd_session_is_active(3), sd_seat_get_active(3), sd_get_seats(3),
56 sd_login_monitor_new(3), sd-daemon(3), sd-readahead(3), pkg-config(1)
57
59 1. Multi-Seat on Linux
60 http://www.freedesktop.org/wiki/Software/systemd/multiseat
61
62
63
64systemd 219 SD-LOGIN(3)