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">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright 2014 Lennart Poettering
11 <refentry id="sd_machine_get_class" xmlns:xi="http://www.w3.org/2001/XInclude">
14 <title>sd_machine_get_class</title>
15 <productname>elogind</productname>
19 <contrib>Developer</contrib>
20 <firstname>Lennart</firstname>
21 <surname>Poettering</surname>
22 <email>lennart@poettering.net</email>
28 <refentrytitle>sd_machine_get_class</refentrytitle>
29 <manvolnum>3</manvolnum>
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>
41 <funcsynopsisinfo>#include <elogind/sd-login.h></funcsynopsisinfo>
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>
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>
58 <title>Description</title>
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>
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>
81 <title>Return Value</title>
83 <para>On success, these calls return 0 or a positive integer. On
84 failure, these calls return a negative errno-style error
91 <para>Returned errors may indicate the following problems:</para>
96 <term><constant>-ENXIO</constant></term>
98 <listitem><para>The specified machine does not exist or is currently not running.</para>
103 <term><constant>-EINVAL</constant></term>
105 <listitem><para>An input parameter was invalid (out of range,
106 or NULL, where that is not accepted).</para></listitem>
110 <term><constant>-ENOMEM</constant></term>
112 <listitem><para>Memory allocation failed.</para></listitem>
117 <xi:include href="libelogind-pkgconfig.xml" />
120 <title>See Also</title>
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>,
127 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
129 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd_pid_get_machine_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>