sd_get_seats.xml revision 56ba3c78ae35065064c4289a0c8e22a81256af20
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher<?xml version='1.0'?> <!--*-nxml-*-->
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher<!--
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher This file is part of systemd.
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher Copyright 2010 Lennart Poettering
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher systemd is free software; you can redistribute it and/or modify it
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher under the terms of the GNU Lesser General Public License as published by
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher the Free Software Foundation; either version 2.1 of the License, or
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher (at your option) any later version.
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher systemd is distributed in the hope that it will be useful, but
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher WITHOUT ANY WARRANTY; without even the implied warranty of
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher Lesser General Public License for more details.
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher You should have received a copy of the GNU Lesser General Public License
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher along with systemd; If not, see <http://www.gnu.org/licenses/>.
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher-->
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher<refentry id="sd_get_seats" conditional='HAVE_PAM'>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refentryinfo>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <title>sd_get_seats</title>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <productname>systemd</productname>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <authorgroup>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <author>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <contrib>Developer</contrib>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <firstname>Lennart</firstname>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <surname>Poettering</surname>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <email>lennart@poettering.net</email>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </author>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </authorgroup>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refentryinfo>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refmeta>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refentrytitle>sd_get_seats</refentrytitle>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <manvolnum>3</manvolnum>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refmeta>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refnamediv>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refname>sd_get_seats</refname>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refname>sd_get_sessions</refname>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refname>sd_get_uids</refname>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refpurpose>Determine available seats, sessions and logged in users</refpurpose>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refnamediv>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refsynopsisdiv>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcsynopsis>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcsynopsisinfo>#include &lt;systemd/sd-login.h&gt;</funcsynopsisinfo>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcprototype>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcdef>int <function>sd_get_seats</function></funcdef>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <paramdef>char*** <parameter>seats</parameter></paramdef>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </funcprototype>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcprototype>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcdef>int <function>sd_get_sessions</function></funcdef>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <paramdef>char*** <parameter>sessions</parameter></paramdef>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </funcprototype>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcprototype>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <funcdef>int <function>sd_get_uids</function></funcdef>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <paramdef>char*** <parameter>sessions</parameter></paramdef>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </funcprototype>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </funcsynopsis>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refsynopsisdiv>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <title>Description</title>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para><function>sd_get_seats()</function> may be used
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher to determine all currently available local
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher seats. Returns a NULL terminated array of seat
8a1738f9379a1b8fb5c95c3df649e014ff5a1434Jan Zeleny identifiers. The returned array and all strings it
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher references need to be freed with the libc
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher call after use. Note that instead of an empty array
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher NULL may be returned and should be considered
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher equivalent to an empty array.</para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para>Similar, <function>sd_get_sessions()</function> may
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher be used to determine all current login sessions.</para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para>Similar, <function>sd_get_uids()</function> may
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher be used to determine all Unix users who currently have login sessions.</para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para>Note that the returned lists are not sorted and in an undefined order.</para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <title>Return Value</title>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para>On success <function>sd_get_seats()</function>,
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <function>sd_get_sessions()</function> and
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <function>sd_get_uids()</function> return the number
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher of entries in the arrays. On failure, these calls
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher return a negative errno-style error code.</para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <title>Notes</title>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para>The <function>sd_get_seats()</function>,
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <function>sd_get_sessions()</function> and
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <function>sd_get_uids()</function> interfaces
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher are available as shared library, which can be compiled
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher and linked to with the
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <literal>libsystemd-login</literal>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher file.</para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <title>See Also</title>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </para>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher </refsect1>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher</refentry>
e134a6af42102c8d865e82bf89e0b8c5a40fb5faStephen Gallagher