]>
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 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2014 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | --> | |
23 | ||
24 | <refentry id="sd_machine_get_class"> | |
25 | ||
798d3a52 ZJS |
26 | <refentryinfo> |
27 | <title>sd_machine_get_class</title> | |
28 | <productname>systemd</productname> | |
29 | ||
30 | <authorgroup> | |
31 | <author> | |
32 | <contrib>Developer</contrib> | |
33 | <firstname>Lennart</firstname> | |
34 | <surname>Poettering</surname> | |
35 | <email>lennart@poettering.net</email> | |
36 | </author> | |
37 | </authorgroup> | |
38 | </refentryinfo> | |
39 | ||
40 | <refmeta> | |
41 | <refentrytitle>sd_machine_get_class</refentrytitle> | |
42 | <manvolnum>3</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>sd_machine_get_class</refname> | |
47 | <refname>sd_machine_get_ifindices</refname> | |
48 | <refpurpose>Determine the class and network interface indices of a | |
49 | locally running virtual machine or container.</refpurpose> | |
50 | </refnamediv> | |
51 | ||
52 | <refsynopsisdiv> | |
53 | <funcsynopsis> | |
54 | <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo> | |
55 | ||
56 | <funcprototype> | |
57 | <funcdef>int <function>sd_machine_get_class</function></funcdef> | |
58 | <paramdef>const char* <parameter>machine</parameter></paramdef> | |
59 | <paramdef>char *<parameter>class</parameter></paramdef> | |
60 | </funcprototype> | |
61 | ||
62 | <funcprototype> | |
63 | <funcdef>int <function>sd_machine_get_ifindices</function></funcdef> | |
64 | <paramdef>const char* <parameter>machine</parameter></paramdef> | |
65 | <paramdef>int **<parameter>ifindices</parameter></paramdef> | |
66 | </funcprototype> | |
67 | </funcsynopsis> | |
68 | </refsynopsisdiv> | |
69 | ||
70 | <refsect1> | |
71 | <title>Description</title> | |
72 | ||
73 | <para><function>sd_machine_get_class()</function> may be used to | |
74 | determine the class of a locally running virtual machine or | |
75 | container that is registered with | |
76 | <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
77 | The string returned is either <literal>vm</literal> or | |
78 | <literal>container</literal>. The returned string needs to be | |
79 | freed with the libc <citerefentry | |
80 | project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
81 | call after use.</para> | |
82 | ||
83 | <para><function>sd_machine_get_ifindices()</function> may be used | |
84 | to determine the numeric indices of the network interfaces on the | |
85 | host that are pointing towards the specified locally running | |
86 | virtual machine or container that is registered with | |
87 | <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
88 | The returned array needs to be freed with the libc <citerefentry | |
89 | project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
90 | call after use.</para> | |
91 | </refsect1> | |
92 | ||
93 | <refsect1> | |
94 | <title>Return Value</title> | |
95 | ||
96 | <para>On success, these calls return 0 or a positive integer. On | |
97 | failure, these calls return a negative errno-style error | |
98 | code.</para> | |
99 | </refsect1> | |
100 | ||
101 | <refsect1> | |
102 | <title>Notes</title> | |
103 | ||
104 | <para>The <function>sd_machine_get_class()</function> and | |
105 | <function>sd_machine_get_ifindices()</function> interfaces are | |
106 | available as a shared library, which can be compiled and linked to | |
107 | with the | |
108 | <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
109 | file.</para> | |
110 | </refsect1> | |
111 | ||
112 | <refsect1> | |
113 | <title>See Also</title> | |
114 | ||
115 | <para> | |
116 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
117 | <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
118 | <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
119 | <citerefentry><refentrytitle>sd_pid_get_machine_name</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
120 | </para> | |
121 | </refsect1> | |
5c8da647 LP |
122 | |
123 | </refentry> |