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