|
NAME | SYNOPSIS | DESCRIPTION | NOTES | SEE ALSO | NOTES | COLOPHON |
|
SD-LOGIN(3) sd-login SD-LOGIN(3)
sd-login - APIs for tracking logins
#include <systemd/sd-login.h>
pkg-config --cflags --libs libsystemd
sd-login.h provides APIs to introspect and monitor seat, login
session and user status information on the local system.
See Multi-Seat on Linux[1] for an introduction into multi-seat
support on Linux, the background for this set of APIs.
Note that these APIs only allow purely passive access and monitoring
of seats, sessions and users. To actively make changes to the seat
configuration, terminate login sessions, or switch session on a seat
you need to utilize the D-Bus API of systemd-logind, instead.
These functions synchronously access data in /proc, /sys/fs/cgroup
and /run. All of these are virtual file systems, hence the runtime
cost of the accesses is relatively cheap.
It is possible (and often a very good choice) to mix calls to the
synchronous interface of sd-login.h with the asynchronous D-Bus
interface of systemd-logind. However, if this is done you need to
think a bit about possible races since the stream of events from
D-Bus and from sd-login.h interfaces such as the login monitor are
asynchronous and not ordered against each other.
If the functions return string arrays, these are generally NULL
terminated and need to be freed by the caller with the libc free(3)
call after use, including the strings referenced therein. Similarly,
individual strings returned need to be freed, as well.
As a special exception, instead of an empty string array NULL may be
returned, which should be treated equivalent to an empty string
array.
See sd_pid_get_session(3), sd_uid_get_state(3),
sd_session_is_active(3), sd_seat_get_active(3), sd_get_seats(3),
sd_login_monitor_new(3) for more information about the functions
implemented.
These APIs are implemented as a shared library, which can be compiled
and linked to with the libsystemd pkg-config(1) file.
systemd(1), sd_pid_get_session(3), sd_uid_get_state(3),
sd_session_is_active(3), sd_seat_get_active(3), sd_get_seats(3),
sd_login_monitor_new(3), sd-daemon(3), pkg-config(1)
1. Multi-Seat on Linux
https://www.freedesktop.org/wiki/Software/systemd/multiseat
This page is part of the systemd (systemd system and service manager)
project. Information about the project can be found at
⟨http://www.freedesktop.org/wiki/Software/systemd⟩. If you have a bug
report for this manual page, see
⟨http://www.freedesktop.org/wiki/Software/systemd/#bugreports⟩. This
page was obtained from the project's upstream Git repository
⟨https://github.com/systemd/systemd.git⟩ on 2018-02-02. (At that
time, the date of the most recent commit that was found in the repos‐
itory was 2018-02-02.) If you discover any rendering problems in
this HTML version of the page, or you believe there is a better or
more up-to-date source for the page, or you have corrections or
improvements to the information in this COLOPHON (which is not part
of the original manual page), send a mail to man-pages@man7.org
systemd 234 SD-LOGIN(3)
Pages that refer to this page: sd_get_seats(3), sd_login_monitor_new(3), sd_machine_get_class(3), sd_pid_get_session(3), sd_seat_get_active(3), sd_session_is_active(3), sd_uid_get_state(3), systemd.directives(7), systemd.index(7)