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