]>
Commit | Line | Data |
---|---|---|
5c8da647 | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
5c8da647 | 5 | |
7d6b2723 | 6 | <refentry id="sd_machine_get_class" xmlns:xi="http://www.w3.org/2001/XInclude"> |
5c8da647 | 7 | |
798d3a52 ZJS |
8 | <refentryinfo> |
9 | <title>sd_machine_get_class</title> | |
10 | <productname>systemd</productname> | |
798d3a52 ZJS |
11 | </refentryinfo> |
12 | ||
13 | <refmeta> | |
14 | <refentrytitle>sd_machine_get_class</refentrytitle> | |
15 | <manvolnum>3</manvolnum> | |
16 | </refmeta> | |
17 | ||
18 | <refnamediv> | |
19 | <refname>sd_machine_get_class</refname> | |
20 | <refname>sd_machine_get_ifindices</refname> | |
21 | <refpurpose>Determine the class and network interface indices of a | |
22 | locally running virtual machine or container.</refpurpose> | |
23 | </refnamediv> | |
24 | ||
25 | <refsynopsisdiv> | |
26 | <funcsynopsis> | |
27 | <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo> | |
28 | ||
29 | <funcprototype> | |
30 | <funcdef>int <function>sd_machine_get_class</function></funcdef> | |
31 | <paramdef>const char* <parameter>machine</parameter></paramdef> | |
707b66c6 | 32 | <paramdef>char **<parameter>class</parameter></paramdef> |
798d3a52 ZJS |
33 | </funcprototype> |
34 | ||
35 | <funcprototype> | |
36 | <funcdef>int <function>sd_machine_get_ifindices</function></funcdef> | |
37 | <paramdef>const char* <parameter>machine</parameter></paramdef> | |
38 | <paramdef>int **<parameter>ifindices</parameter></paramdef> | |
39 | </funcprototype> | |
40 | </funcsynopsis> | |
41 | </refsynopsisdiv> | |
42 | ||
43 | <refsect1> | |
44 | <title>Description</title> | |
45 | ||
46 | <para><function>sd_machine_get_class()</function> may be used to | |
47 | determine the class of a locally running virtual machine or | |
48 | container that is registered with | |
49 | <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
50 | The string returned is either <literal>vm</literal> or | |
51 | <literal>container</literal>. The returned string needs to be | |
52 | freed with the libc <citerefentry | |
53 | project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
54 | call after use.</para> | |
55 | ||
56 | <para><function>sd_machine_get_ifindices()</function> may be used | |
57 | to determine the numeric indices of the network interfaces on the | |
58 | host that are pointing towards the specified locally running | |
59 | virtual machine or container that is registered with | |
60 | <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
61 | The returned array needs to be freed with the libc <citerefentry | |
62 | project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
63 | call after use.</para> | |
64 | </refsect1> | |
65 | ||
66 | <refsect1> | |
67 | <title>Return Value</title> | |
68 | ||
b1de39de ZJS |
69 | <para>On success, these calls return 0 or a positive integer. On failure, these calls return a negative |
70 | errno-style error code.</para> | |
798d3a52 | 71 | |
b1de39de ZJS |
72 | <refsect2> |
73 | <title>Errors</title> | |
707b66c6 | 74 | |
b1de39de | 75 | <para>Returned errors may indicate the following problems:</para> |
707b66c6 | 76 | |
b1de39de | 77 | <variablelist> |
707b66c6 | 78 | |
b1de39de ZJS |
79 | <varlistentry> |
80 | <term><constant>-ENXIO</constant></term> | |
707b66c6 | 81 | |
b1de39de ZJS |
82 | <listitem><para>The specified machine does not exist or is currently not running.</para> |
83 | </listitem> | |
84 | </varlistentry> | |
707b66c6 | 85 | |
b1de39de ZJS |
86 | <varlistentry> |
87 | <term><constant>-EINVAL</constant></term> | |
707b66c6 | 88 | |
b1de39de ZJS |
89 | <listitem><para>An input parameter was invalid (out of range, or <constant>NULL</constant>, where |
90 | that is not accepted).</para></listitem> | |
91 | </varlistentry> | |
707b66c6 | 92 | |
b1de39de ZJS |
93 | <varlistentry> |
94 | <term><constant>-ENOMEM</constant></term> | |
707b66c6 | 95 | |
b1de39de ZJS |
96 | <listitem><para>Memory allocation failed.</para></listitem> |
97 | </varlistentry> | |
98 | </variablelist> | |
99 | </refsect2> | |
707b66c6 LP |
100 | </refsect1> |
101 | ||
7d6b2723 | 102 | <xi:include href="libsystemd-pkgconfig.xml" /> |
798d3a52 ZJS |
103 | |
104 | <refsect1> | |
105 | <title>See Also</title> | |
106 | ||
107 | <para> | |
108 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
109 | <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
110 | <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
111 | <citerefentry><refentrytitle>sd_pid_get_machine_name</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
112 | </para> | |
113 | </refsect1> | |
5c8da647 LP |
114 | |
115 | </refentry> |