man-pages/man3/sd_seat_get_active.3.html
2021-03-31 01:06:50 +01:00

187 lines
5.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD_SEAT_GET_ACTIVE</TITLE>
</HEAD><BODY>
<H1>SD_SEAT_GET_ACTIVE</H1>
Section: sd_seat_get_active (3)<BR>Updated: <BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sd_seat_get_active, sd_seat_get_sessions, sd_seat_can_multi_session, sd_seat_can_tty, sd_seat_can_graphical - Determine state of a specific seat
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>
</B><PRE>
#include &lt;<A HREF="file:///usr/include/systemd/sd-login.h">systemd/sd-login.h</A>&gt;
</PRE>
<DL COMPACT>
<DT id="1">
<B>int sd_seat_get_active(const&nbsp;char&nbsp;*</B><I>seat</I><B>, char&nbsp;**</B><I>session</I><B>, uid_t&nbsp;*</B><I>uid</I><B>);</B>
<DT id="2">
<B>int sd_seat_get_sessions(const&nbsp;char&nbsp;*</B><I>seat</I><B>, char&nbsp;***</B><I>sessions</I><B>, uid_t&nbsp;**</B><I>uid</I><B>, unsigned&nbsp;int&nbsp;*</B><I>n_uids</I><B>);</B>
<DT id="3">
<B>int sd_seat_can_multi_session(const&nbsp;char&nbsp;*</B><I>seat</I><B>);</B>
<DT id="4">
<B>int sd_seat_can_tty(const&nbsp;char&nbsp;*</B><I>seat</I><B>);</B>
<DT id="5">
<B>int sd_seat_can_graphical(const&nbsp;char&nbsp;*</B><I>seat</I><B>);</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>sd_seat_get_active()</B>
<DD>may be used to determine which session is currently active on a seat, if there is any. Returns the session identifier and the user identifier of the Unix user the session is belonging to. Either the session or the user identifier parameter can be passed
<B>NULL</B>, in case only one of the parameters shall be queried. The returned string needs to be freed with the libc
<B><A HREF="/cgi-bin/man/man2html?3+free">free</A></B>(3)
call after use.
<P>
<B>sd_seat_get_sessions()</B>
may be used to determine all sessions on the specified seat. Returns two arrays, one (<B>NULL</B>
terminated) with the session identifiers of the sessions and one with the user identifiers of the Unix users the sessions belong to. An additional parameter may be used to return the number of entries in the latter array. This value is the same the return value, if the latter is nonnegative. The two arrays and the last parameter may be passed as
<B>NULL</B>
in case these values need not to be determined. The arrays and the strings referenced by them need to be freed with the libc
<B><A HREF="/cgi-bin/man/man2html?3+free">free</A></B>(3)
call after use. Note that instead of an empty array
<B>NULL</B>
may be returned and should be considered equivalent to an empty array.
<P>
<B>sd_seat_can_multi_session()</B>
may be used to determine whether a specific seat is capable of multi-session, i.e. allows multiple login sessions in parallel (with only one being active at a time).
<P>
<B>sd_seat_can_tty()</B>
may be used to determine whether a specific seat provides TTY functionality, i.e. is useful as a text console.
<P>
<B>sd_seat_can_graphical()</B>
may be used to determine whether a specific seat provides graphics functionality, i.e. is useful as a graphics display.
<P>
If the
<I>seat</I>
parameter of any of these functions is passed as
<B>NULL</B>, the operation is executed for the seat of the session of the calling process, if there is any.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<P>
On success,
<B>sd_seat_get_active()</B>
returns 0 or a positive integer. On success,
<B>sd_seat_get_sessions()</B>
returns the number of entries in the session identifier array. If the test succeeds,
<B>sd_seat_can_multi_session</B>,
<B>sd_seat_can_tty</B>
and
<B>sd_seat_can_graphical</B>
return a positive integer, if it fails 0. On failure, these calls return a negative errno-style error code.
<A NAME="lbAF">&nbsp;</A>
<H3>Errors</H3>
<P>
Returned errors may indicate the following problems:
<P>
<B>-ENODATA</B>
<DL COMPACT><DT id="6"><DD>
The given field is not specified for the described seat.
</DL>
<P>
<B>-ENXIO</B>
<DL COMPACT><DT id="7"><DD>
The specified seat is unknown.
</DL>
<P>
<B>-EINVAL</B>
<DL COMPACT><DT id="8"><DD>
An input parameter was invalid (out of range, or
<B>NULL</B>, where that is not accepted).
</DL>
<P>
<B>-ENOMEM</B>
<DL COMPACT><DT id="9"><DD>
Memory allocation failed.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
<P>
These APIs are implemented as a shared library, which can be compiled and linked to with the
<B>libsystemd</B>&nbsp;<B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
file.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?3+sd-login">sd-login</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_session_get_seat">sd_session_get_seat</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="10"><A HREF="#lbAB">NAME</A><DD>
<DT id="11"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="12"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="13"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DL>
<DT id="14"><A HREF="#lbAF">Errors</A><DD>
</DL>
<DT id="15"><A HREF="#lbAG">NOTES</A><DD>
<DT id="16"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:55 GMT, March 31, 2021
</BODY>
</HTML>