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