sd_machine_get_class.xml revision 798d3a524ea57aaf40cb53858aaa45ec702f012d
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering<?xml version='1.0'?> <!--*-nxml-*-->
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering<!--
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering This file is part of systemd.
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering Copyright 2014 Lennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering systemd is free software; you can redistribute it and/or modify it
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering under the terms of the GNU Lesser General Public License as published by
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering (at your option) any later version.
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering systemd is distributed in the hope that it will be useful, but
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering Lesser General Public License for more details.
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering You should have received a copy of the GNU Lesser General Public License
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering-->
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering<refentry id="sd_machine_get_class">
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering <refentryinfo>
40ca29a1370379d43e44c0ed425eecc7218dcbcaLennart Poettering <title>sd_machine_get_class</title>
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering <productname>systemd</productname>
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering <authorgroup>
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering <author>
4de33e7f3238a6fe616e61139ab87e221572e5e5Lennart Poettering <contrib>Developer</contrib>
4bcc8c3cb57733de6eeb2528a194501fade11e6bZbigniew Jędrzejewski-Szmek <firstname>Lennart</firstname>
94676f3e9352cbf1f72e0a512ee0d2ed83ff676dLennart Poettering <surname>Poettering</surname>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <email>lennart@poettering.net</email>
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering </author>
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering </authorgroup>
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering </refentryinfo>
6577c7cea72f19185ad999c223bcf663c010dc6fLennart Poettering
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering <refmeta>
9f2e86af0600e99cff00d1c92f9bb8d38f29896aLennart Poettering <refentrytitle>sd_machine_get_class</refentrytitle>
c221420be8744bb0f8b8a8145efc1f247f1aa801Lennart Poettering <manvolnum>3</manvolnum>
a6c0353b9268d5b780fb7ff05a10cb5031446e5dLennart Poettering </refmeta>
d21ed1ead18d16d35c30299a69d3366847f8a039Lennart Poettering
1ac67edb7c4d31a287fa98c0b554ae98bd34e71bLennart Poettering <refnamediv>
d21ed1ead18d16d35c30299a69d3366847f8a039Lennart Poettering <refname>sd_machine_get_class</refname>
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering <refname>sd_machine_get_ifindices</refname>
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering <refpurpose>Determine the class and network interface indices of a
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering locally running virtual machine or container.</refpurpose>
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering </refnamediv>
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering <refsynopsisdiv>
df31a6c0fe07805cb50045fbe91c2a6e7e430562Lennart Poettering <funcsynopsis>
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering <funcsynopsisinfo>#include &lt;systemd/sd-login.h&gt;</funcsynopsisinfo>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <funcprototype>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <funcdef>int <function>sd_machine_get_class</function></funcdef>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <paramdef>const char* <parameter>machine</parameter></paramdef>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <paramdef>char *<parameter>class</parameter></paramdef>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </funcprototype>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
095dc59660c3dde782f32fe5a52b577f7700578bLennart Poettering <funcprototype>
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering <funcdef>int <function>sd_machine_get_ifindices</function></funcdef>
601185b43da638b1c74153deae01dbd518680889Zbigniew Jędrzejewski-Szmek <paramdef>const char* <parameter>machine</parameter></paramdef>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <paramdef>int **<parameter>ifindices</parameter></paramdef>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </funcprototype>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </funcsynopsis>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </refsynopsisdiv>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <refsect1>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <title>Description</title>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <para><function>sd_machine_get_class()</function> may be used to
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho determine the class of a locally running virtual machine or
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho container that is registered with
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho The string returned is either <literal>vm</literal> or
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <literal>container</literal>. The returned string needs to be
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho freed with the libc <citerefentry
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho call after use.</para>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <para><function>sd_machine_get_ifindices()</function> may be used
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho to determine the numeric indices of the network interfaces on the
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering host that are pointing towards the specified locally running
095dc59660c3dde782f32fe5a52b577f7700578bLennart Poettering virtual machine or container that is registered with
095dc59660c3dde782f32fe5a52b577f7700578bLennart Poettering <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho The returned array needs to be freed with the libc <citerefentry
b57b06258e0b1894edb6d1fc52a80b3c33164892Zbigniew Jędrzejewski-Szmek project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
b57b06258e0b1894edb6d1fc52a80b3c33164892Zbigniew Jędrzejewski-Szmek call after use.</para>
b57b06258e0b1894edb6d1fc52a80b3c33164892Zbigniew Jędrzejewski-Szmek </refsect1>
b57b06258e0b1894edb6d1fc52a80b3c33164892Zbigniew Jędrzejewski-Szmek
b57b06258e0b1894edb6d1fc52a80b3c33164892Zbigniew Jędrzejewski-Szmek <refsect1>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <title>Return Value</title>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering <para>On success, these calls return 0 or a positive integer. On
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering failure, these calls return a negative errno-style error
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering code.</para>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </refsect1>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <refsect1>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <title>Notes</title>
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering <para>The <function>sd_machine_get_class()</function> and
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering <function>sd_machine_get_ifindices()</function> interfaces are
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering available as a shared library, which can be compiled and linked to
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering with the
66b1e746055b9c56fd72c0451a4cfb2b06cf3f20Lennart Poettering <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering file.</para>
9f2e86af0600e99cff00d1c92f9bb8d38f29896aLennart Poettering </refsect1>
c221420be8744bb0f8b8a8145efc1f247f1aa801Lennart Poettering
a6c0353b9268d5b780fb7ff05a10cb5031446e5dLennart Poettering <refsect1>
a6c0353b9268d5b780fb7ff05a10cb5031446e5dLennart Poettering <title>See Also</title>
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering <para>
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
c7040b5d1c2c148f12b6a5eef3dfce1661805131Lennart Poettering <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering <citerefentry><refentrytitle>sd_pid_get_machine_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </para>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho </refsect1>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho</refentry>
4c213d6cf416917c61f82d8bee795b8f3a4c5372WaLyong Cho