sd_machine_get_class.xml revision 798d3a524ea57aaf40cb53858aaa45ec702f012d
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 This file is part of systemd.
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering Copyright 2014 Lennart 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 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 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/>.
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering <refentryinfo>
c2756a68401102786be343712c0c35acbd73d28dLennart Poettering </authorgroup>
6c12b52e19640747e96f89d85422941a23dc6b29Lennart Poettering </refentryinfo>
9f2e86af0600e99cff00d1c92f9bb8d38f29896aLennart Poettering <refentrytitle>sd_machine_get_class</refentrytitle>
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 <refsynopsisdiv>
df31a6c0fe07805cb50045fbe91c2a6e7e430562Lennart Poettering <funcsynopsis>
9b15b7846d4de01bb5d9700a24077787e984e8abLennart Poettering <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
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>
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 <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 <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>
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 <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
66b1e746055b9c56fd72c0451a4cfb2b06cf3f20Lennart Poettering <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
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>