chiark / gitweb /
basic: split hash functions into their own header files
[elogind.git] / man / sd_machine_get_class.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of elogind.
7
8   Copyright 2014 Lennart Poettering
9
10   elogind is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   elogind is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with elogind; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_machine_get_class">
25
26   <refentryinfo>
27     <title>sd_machine_get_class</title>
28     <productname>elogind</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>Developer</contrib>
33         <firstname>Lennart</firstname>
34         <surname>Poettering</surname>
35         <email>lennart@poettering.net</email>
36       </author>
37     </authorgroup>
38   </refentryinfo>
39
40   <refmeta>
41     <refentrytitle>sd_machine_get_class</refentrytitle>
42     <manvolnum>3</manvolnum>
43   </refmeta>
44
45   <refnamediv>
46     <refname>sd_machine_get_class</refname>
47     <refname>sd_machine_get_ifindices</refname>
48     <refpurpose>Determine the class and network interface indices of a
49     locally running virtual machine or container.</refpurpose>
50   </refnamediv>
51
52   <refsynopsisdiv>
53     <funcsynopsis>
54       <funcsynopsisinfo>#include &lt;elogind/sd-login.h&gt;</funcsynopsisinfo>
55
56       <funcprototype>
57         <funcdef>int <function>sd_machine_get_class</function></funcdef>
58         <paramdef>const char* <parameter>machine</parameter></paramdef>
59         <paramdef>char **<parameter>class</parameter></paramdef>
60       </funcprototype>
61
62       <funcprototype>
63         <funcdef>int <function>sd_machine_get_ifindices</function></funcdef>
64         <paramdef>const char* <parameter>machine</parameter></paramdef>
65         <paramdef>int **<parameter>ifindices</parameter></paramdef>
66       </funcprototype>
67     </funcsynopsis>
68   </refsynopsisdiv>
69
70   <refsect1>
71     <title>Description</title>
72
73     <para><function>sd_machine_get_class()</function> may be used to
74     determine the class of a locally running virtual machine or
75     container that is registered with
76     <citerefentry><refentrytitle>elogind-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
77     The string returned is either <literal>vm</literal> or
78     <literal>container</literal>. The returned string needs to be
79     freed with the libc <citerefentry
80     project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
81     call after use.</para>
82
83     <para><function>sd_machine_get_ifindices()</function> may be used
84     to determine the numeric indices of the network interfaces on the
85     host that are pointing towards the specified locally running
86     virtual machine or container that is registered with
87     <citerefentry><refentrytitle>elogind-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
88     The returned array needs to be freed with the libc <citerefentry
89     project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
90     call after use.</para>
91   </refsect1>
92
93   <refsect1>
94     <title>Return Value</title>
95
96     <para>On success, these calls return 0 or a positive integer. On
97     failure, these calls return a negative errno-style error
98     code.</para>
99   </refsect1>
100
101   <refsect1>
102     <title>Errors</title>
103
104     <para>Returned errors may indicate the following problems:</para>
105
106     <variablelist>
107
108       <varlistentry>
109         <term><constant>-ENXIO</constant></term>
110
111         <listitem><para>The specified machine does not exist or is currently not running.</para>
112         </listitem>
113       </varlistentry>
114
115       <varlistentry>
116         <term><constant>-EINVAL</constant></term>
117
118         <listitem><para>An input parameter was invalid (out of range,
119         or NULL, where that's not accepted).</para></listitem>
120       </varlistentry>
121
122       <varlistentry>
123         <term><constant>-ENOMEM</constant></term>
124
125         <listitem><para>Memory allocation failed.</para></listitem>
126       </varlistentry>
127     </variablelist>
128   </refsect1>
129
130   <refsect1>
131     <title>Notes</title>
132
133     <para>The <function>sd_machine_get_class()</function> and
134     <function>sd_machine_get_ifindices()</function> interfaces are
135     available as a shared library, which can be compiled and linked to
136     with the
137     <constant>libelogind</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
138     file.</para>
139   </refsect1>
140
141   <refsect1>
142     <title>See Also</title>
143
144     <para>
145       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
146       <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
147       <citerefentry><refentrytitle>elogind-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
148       <citerefentry><refentrytitle>sd_pid_get_machine_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>
149     </para>
150   </refsect1>
151
152 </refentry>