chiark / gitweb /
d3a67bbc300eb50b23b659f9d7abd20ea9b78495
[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   SPDX-License-Identifier: LGPL-2.1+
7
8   Copyright 2014 Lennart Poettering
9 -->
10
11 <refentry id="sd_machine_get_class" xmlns:xi="http://www.w3.org/2001/XInclude">
12
13   <refentryinfo>
14     <title>sd_machine_get_class</title>
15     <productname>elogind</productname>
16
17     <authorgroup>
18       <author>
19         <contrib>Developer</contrib>
20         <firstname>Lennart</firstname>
21         <surname>Poettering</surname>
22         <email>lennart@poettering.net</email>
23       </author>
24     </authorgroup>
25   </refentryinfo>
26
27   <refmeta>
28     <refentrytitle>sd_machine_get_class</refentrytitle>
29     <manvolnum>3</manvolnum>
30   </refmeta>
31
32   <refnamediv>
33     <refname>sd_machine_get_class</refname>
34     <refname>sd_machine_get_ifindices</refname>
35     <refpurpose>Determine the class and network interface indices of a
36     locally running virtual machine or container.</refpurpose>
37   </refnamediv>
38
39   <refsynopsisdiv>
40     <funcsynopsis>
41       <funcsynopsisinfo>#include &lt;elogind/sd-login.h&gt;</funcsynopsisinfo>
42
43       <funcprototype>
44         <funcdef>int <function>sd_machine_get_class</function></funcdef>
45         <paramdef>const char* <parameter>machine</parameter></paramdef>
46         <paramdef>char **<parameter>class</parameter></paramdef>
47       </funcprototype>
48
49       <funcprototype>
50         <funcdef>int <function>sd_machine_get_ifindices</function></funcdef>
51         <paramdef>const char* <parameter>machine</parameter></paramdef>
52         <paramdef>int **<parameter>ifindices</parameter></paramdef>
53       </funcprototype>
54     </funcsynopsis>
55   </refsynopsisdiv>
56
57   <refsect1>
58     <title>Description</title>
59
60     <para><function>sd_machine_get_class()</function> may be used to
61     determine the class of a locally running virtual machine or
62     container that is registered with
63     <citerefentry><refentrytitle>elogind-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
64     The string returned is either <literal>vm</literal> or
65     <literal>container</literal>. The returned string needs to be
66     freed with the libc <citerefentry
67     project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
68     call after use.</para>
69
70     <para><function>sd_machine_get_ifindices()</function> may be used
71     to determine the numeric indices of the network interfaces on the
72     host that are pointing towards the specified locally running
73     virtual machine or container that is registered with
74     <citerefentry><refentrytitle>elogind-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
75     The returned array needs to be freed with the libc <citerefentry
76     project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
77     call after use.</para>
78   </refsect1>
79
80   <refsect1>
81     <title>Return Value</title>
82
83     <para>On success, these calls return 0 or a positive integer. On
84     failure, these calls return a negative errno-style error
85     code.</para>
86   </refsect1>
87
88   <refsect1>
89     <title>Errors</title>
90
91     <para>Returned errors may indicate the following problems:</para>
92
93     <variablelist>
94
95       <varlistentry>
96         <term><constant>-ENXIO</constant></term>
97
98         <listitem><para>The specified machine does not exist or is currently not running.</para>
99         </listitem>
100       </varlistentry>
101
102       <varlistentry>
103         <term><constant>-EINVAL</constant></term>
104
105         <listitem><para>An input parameter was invalid (out of range,
106         or NULL, where that is not accepted).</para></listitem>
107       </varlistentry>
108
109       <varlistentry>
110         <term><constant>-ENOMEM</constant></term>
111
112         <listitem><para>Memory allocation failed.</para></listitem>
113       </varlistentry>
114     </variablelist>
115   </refsect1>
116
117   <xi:include href="libelogind-pkgconfig.xml" />
118
119   <refsect1>
120     <title>See Also</title>
121
122     <para>
123       <!-- 0 /// elogind is in section 8
124       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
125       <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
126       --><!-- else -->
127       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
128       <!-- // 0 -->
129       <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
130       <citerefentry><refentrytitle>sd_pid_get_machine_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>
131     </para>
132   </refsect1>
133
134 </refentry>