1SD_MACHINE_GET_CLASS(3) sd_machine_get_class SD_MACHINE_GET_CLASS(3)
2
3
4
6 sd_machine_get_class, sd_machine_get_ifindices - Determine the class
7 and network interface indices of a locally running virtual machine or
8 container.
9
11 #include <systemd/sd-login.h>
12
13 int sd_machine_get_class(const char* machine, char *class);
14
15 int sd_machine_get_ifindices(const char* machine, int **ifindices);
16
18 sd_machine_get_class() may be used to determine the class of a locally
19 running virtual machine or container that is registered with systemd-
20 machined.service(8). The string returned is either "vm" or "container".
21 The returned string needs to be freed with the libc free(3) call after
22 use.
23
24 sd_machine_get_ifindices() may be used to determine the numeric indices
25 of the network interfaces on the host that are pointing towards the
26 specified locally running virtual machine or container that is
27 registered with systemd-machined.service(8). The returned array needs
28 to be freed with the libc free(3) call after use.
29
31 On success, these calls return 0 or a positive integer. On failure,
32 these calls return a negative errno-style error code.
33
35 The sd_machine_get_class() and sd_machine_get_ifindices() interfaces
36 are available as a shared library, which can be compiled and linked to
37 with the libsystemd pkg-config(1) file.
38
40 systemd(1), sd-login(3), systemd-machined.service(8),
41 sd_pid_get_machine_name(3)
42
43
44
45systemd 219 SD_MACHINE_GET_CLASS(3)