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