else :; \
fi
-sc_prohibit_HAVE_MBRTOWC:
- @prohibit='\bHAVE_MBRTOWC\b' \
+sc_prohibit_WITH_MBRTOWC:
+ @prohibit='\bWITH_MBRTOWC\b' \
halt="do not use $$prohibit; it is always defined" \
$(_sc_search_regexp)
sc_prohibit_defined_have_decl_tests:
- @prohibit='(#[ ]*ifn?def|\<defined)\>[ (]+HAVE_DECL_' \
- halt='HAVE_DECL macros are always defined' \
+ @prohibit='(#[ ]*ifn?def|\<defined)\>[ (]+WITH_DECL_' \
+ halt='WITH_DECL macros are always defined' \
$(_sc_search_regexp)
# ==================================================================
rm -f $@-1 $@-2; \
fi
-# #if HAVE_... will evaluate to false for any non numeric string.
+# #if WITH_... will evaluate to false for any non numeric string.
# That would be flagged by using -Wundef, however gnulib currently
# tests many undefined macros, and so we can't enable that option.
# So at least preclude common boolean strings as macro values.
::
- #if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
+ #if defined(WITH_POSIX_FALLOCATE) && !defined(WITH_FALLOCATE)
# define fallocate(a, ignored, b, c) posix_fallocate(a, b, c)
#endif
add_project_arguments(supported_cc_flags, language: 'c')
if cc.has_argument('-Wsuggest-attribute=format')
- conf.set('HAVE_SUGGEST_ATTRIBUTE_FORMAT', 1)
+ conf.set('WITH_SUGGEST_ATTRIBUTE_FORMAT', 1)
endif
# used in tests
foreach function : functions
if cc.has_function(function)
- conf.set('HAVE_@0@'.format(function.to_upper()), 1)
+ conf.set('WITH_@0@'.format(function.to_upper()), 1)
endif
endforeach
foreach name : headers
if cc.has_header(name)
- conf.set('HAVE_@0@'.format(name.underscorify().to_upper()), 1)
+ conf.set('WITH_@0@'.format(name.underscorify().to_upper()), 1)
endif
endforeach
foreach symbol : symbols
if cc.has_header_symbol(symbol[0], symbol[1], args: '-D_GNU_SOURCE', prefix: symbol.get(2, ''))
- conf.set('HAVE_DECL_@0@'.format(symbol[1].to_upper()), 1)
+ conf.set('WITH_DECL_@0@'.format(symbol[1].to_upper()), 1)
endif
endforeach
if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD', prefix: brd_required_headers) and
cc.has_header_symbol('net/if_bridgevar.h', 'BRDGADD', prefix: brd_required_headers) and
cc.has_header_symbol('net/if_bridgevar.h', 'BRDGDEL', prefix: brd_required_headers))
- conf.set('HAVE_BSD_BRIDGE_MGMT', 1)
+ conf.set('WITH_BSD_BRIDGE_MGMT', 1)
endif
# Check for BSD CPU affinity availability
if cc.has_header_symbol('sys/cpuset.h', 'cpuset_getaffinity')
- conf.set('HAVE_BSD_CPU_AFFINITY', 1)
+ conf.set('WITH_BSD_CPU_AFFINITY', 1)
endif
# whether Mach clock routines are available
if (cc.has_header_symbol('mach/clock.h', 'clock_serv_t') and
cc.has_header_symbol('mach/clock.h', 'host_get_clock_service') and
cc.has_header_symbol('mach/clock.h', 'clock_get_time'))
- conf.set('HAVE_MACH_CLOCK_ROUTINES', 1)
+ conf.set('WITH_MACH_CLOCK_ROUTINES', 1)
endif
foreach type : types
if cc.has_type(type[0], prefix: type[1])
name = type[0].underscorify().to_upper()
- conf.set('HAVE_@0@'.format(name), 1)
+ conf.set('WITH_@0@'.format(name), 1)
endif
endforeach
if cc.has_member(member[0], member[1], prefix: member[2])
type = member[0].underscorify().to_upper()
member = member[1].underscorify().to_upper()
- conf.set('HAVE_@0@_@1@'.format(type, member), 1)
+ conf.set('WITH_@0@_@1@'.format(type, member), 1)
endif
endforeach
if host_machine.system() == 'linux' and cc.has_header('sys/acl.h')
acl_dep = cc.find_library('acl', required: false)
- conf.set('HAVE_SYS_ACL_H', 1)
+ conf.set('WITH_SYS_ACL_H', 1)
else
acl_dep = dependency('', required: false)
endif
attr_dep = cc.find_library('attr', required: get_option('attr'))
if attr_dep.found()
- conf.set('HAVE_LIBATTR', 1)
+ conf.set('WITH_LIBATTR', 1)
endif
audit_dep = cc.find_library('audit', required: get_option('audit'))
function = 'dbus_watch_get_unix_fd'
if cc.has_function(function, dependencies: dbus_dep)
- conf.set('HAVE_@0@'.format(function.to_upper()), 1)
+ conf.set('WITH_@0@'.format(function.to_upper()), 1)
endif
type = 'DBusBasicValue'
if cc.has_type(type, dependencies: dbus_dep, prefix: '#include <dbus/dbus.h>')
- conf.set('HAVE_@0@'.format(type.to_upper()), 1)
+ conf.set('WITH_@0@'.format(type.to_upper()), 1)
endif
endif
if not cc.has_header('dlfcn.h')
error('Unable to find dlfcn.h')
endif
- conf.set('HAVE_DLFCN_H', 1)
+ conf.set('WITH_DLFCN_H', 1)
endif
fuse_version = '2.8.6'
libnl_dep = declare_dependency(
dependencies: [ libnl_dep, libnl_route_dep ],
)
- conf.set('HAVE_LIBNL', 1)
+ conf.set('WITH_LIBNL', 1)
endif
else
libnl_dep = dependency('', required: false)
endif
endif
if libpcap_dep.found()
- conf.set('HAVE_LIBPCAP', 1)
+ conf.set('WITH_LIBPCAP', 1)
endif
libssh_version = '0.7'
conf.set('WITH_MACVTAP', 1)
if cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_PASSTHRU')
- conf.set('HAVE_DECL_MACVLAN_MODE_PASSTHRU', 1)
+ conf.set('WITH_DECL_MACVLAN_MODE_PASSTHRU', 1)
endif
endif
endif
if cc.has_header('libintl.h')
- conf.set('HAVE_LIBINTL_H', 1)
+ conf.set('WITH_LIBINTL_H', 1)
elif get_option('nls').enabled()
error('libintl.h is required to build libvirt')
endif
conf.set('WITH_NUMACTL', 1)
if cc.has_function('numa_bitmask_isbitset', dependencies: [ numactl_dep ])
- conf.set('HAVE_NUMA_BITMASK_ISBITSET', 1)
+ conf.set('WITH_NUMA_BITMASK_ISBITSET', 1)
endif
endif
endif
if rbd_dep.found() and rados_dep.found()
if cc.has_function('rbd_list2', dependencies: rbd_dep)
- conf.set('HAVE_RBD_LIST2', 1)
+ conf.set('WITH_RBD_LIST2', 1)
endif
rbd_dep = declare_dependency(dependencies: [ rbd_dep, rados_dep ])
conf.set('WITH_SANLOCK', 1)
# check for sanlock_strerror introduced in sanlock-3.5.0
if cc.has_function('sanlock_strerror', dependencies: sanlock_dep)
- conf.set('HAVE_SANLOCK_STRERROR', 1)
+ conf.set('WITH_SANLOCK_STRERROR', 1)
endif
endif
endif
error('You must have firewalld support enabled to enable firewalld_zone')
endif
-if conf.has('WITH_MACVTAP') and not conf.has('HAVE_LIBNL')
+if conf.has('WITH_MACVTAP') and not conf.has('WITH_LIBNL')
error('libnl3-devel is required for macvtap support')
endif
# If building with libxl, use the libxl utility header and lib too
if cc.has_header('libxlutil.h')
- conf.set('HAVE_LIBXLUTIL_H', 1)
+ conf.set('WITH_LIBXLUTIL_H', 1)
endif
xl_util_dep = cc.find_library('xlutil')
# Check if Xen has support for PVH
if cc.has_header_symbol('libxl.h', 'LIBXL_DOMAIN_TYPE_PVH')
- conf.set('HAVE_XEN_PVH', 1)
+ conf.set('WITH_XEN_PVH', 1)
endif
conf.set('WITH_LIBXL', 1)
'''
if cc.compiles(lxc_support_code, name: 'lxc support', args: '-D_GNU_SOURCE')
conf.set('WITH_LXC', 1)
- conf.set('HAVE_DECL_LO_FLAGS_AUTOCLEAR', 1)
+ conf.set('WITH_DECL_LO_FLAGS_AUTOCLEAR', 1)
elif get_option('driver_lxc').enabled()
error('Required kernel features for LXC were not found')
endif
}
'''
if cc.compiles(lxc_get_free_code)
- conf.set('HAVE_DECL_LOOP_CTL_GET_FREE', 1)
+ conf.set('WITH_DECL_LOOP_CTL_GET_FREE', 1)
endif
elif get_option('driver_lxc').enabled()
error('linux and remote_driver are required for LXC')
driver_modules_flags = []
if conf.has('WITH_LIBVIRTD')
- if not conf.has('HAVE_DLFCN_H') or not dlopen_dep.found()
+ if not conf.has('WITH_DLFCN_H') or not dlopen_dep.found()
error('You must have dlfcn.h / dlopen() support to build driver modules')
endif
driver_modules_flags = libvirt_export_dynamic
conf.set('WITH_NSS', 1)
if cc.has_type('struct gaih_addrtuple', prefix: '#include <nss.h>')
- conf.set('HAVE_STRUCT_GAIH_ADDRTUPLE', 1)
+ conf.set('WITH_STRUCT_GAIH_ADDRTUPLE', 1)
endif
if (cc.has_type('ns_mtab', prefix: '#include <nsswitch.h>') and
if not get_option('numad').disabled() and numactl_dep.found()
numad_prog = find_program('numad', required: get_option('numad'), dirs: libvirt_sbin_path)
if numad_prog.found()
- conf.set('HAVE_NUMAD', 1)
+ conf.set('WITH_NUMAD', 1)
conf.set_quoted('NUMAD', numad_prog.path())
endif
elif get_option('numad').enabled()
'Use -Werror': cc_flags.contains('-Werror'),
'Warning Flags': supported_cc_flags,
'DTrace': conf.has('WITH_DTRACE_PROBES'),
- 'numad': conf.has('HAVE_NUMAD'),
+ 'numad': conf.has('WITH_NUMAD'),
'Init script': init_script,
'Char device locks': chrdev_lock_files,
'Loader/NVRAM': loader_res,
virLogSetFromEnv();
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
if (!bindtextdomain(PACKAGE, LOCALEDIR))
goto error;
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
if (!VIR_CLASS_NEW(remoteAdminPriv, virClassForObjectLockable()))
goto error;
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#if HAVE_NET_ETHERNET_H
+#if WITH_NET_ETHERNET_H
# include <net/ethernet.h>
#endif
#include <unistd.h>
#include <config.h>
#if defined(__aarch64__)
-# if defined(HAVE_ASM_HWCAP_H)
+# if defined(WITH_ASM_HWCAP_H)
# include <asm/hwcap.h>
# endif
# include <sys/auxv.h>
int cpu_feature_index = 0;
size_t i;
-# if defined(HAVE_GETAUXVAL)
+# if defined(WITH_GETAUXVAL)
if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("CPUID registers unavailable"));
/* parse the corresponding vendor_id bits */
data->vendor_id = (cpuid >> 24) & 0xff;
-# if defined(HAVE_GETAUXVAL)
+# if defined(WITH_GETAUXVAL)
hwcaps = getauxval(AT_HWCAP);
-# elif defined(HAVE_ELF_AUX_INFO)
+# elif defined(WITH_ELF_AUX_INFO)
elf_aux_info(AT_HWCAP, &hwcaps, sizeof(u_long));
# else
# error No routines to retrieve a value from the auxiliary vector
/* The library itself needs to know enum sizes. */
#define VIR_ENUM_SENTINELS
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
# define DEFAULT_TEXT_DOMAIN PACKAGE
# include <libintl.h>
# define _(str) dgettext(PACKAGE, str)
-#else /* HAVE_LIBINTL_H */
+#else /* WITH_LIBINTL_H */
# define _(str) str
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
#define N_(str) str
#include "libvirt/libvirt.h"
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wpointer-sign\"")
-#if HAVE_SUGGEST_ATTRIBUTE_FORMAT
+#if WITH_SUGGEST_ATTRIBUTE_FORMAT
# define VIR_WARNINGS_NO_PRINTF \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
g_networking_init();
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
if (!bindtextdomain(PACKAGE, LOCALEDIR))
goto error;
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
/*
* Note that the order is important: the first ones have a higher
* HVM guest type. Add a PVH guest type for each new HVM
* guest type.
*/
-#ifdef HAVE_XEN_PVH
+#ifdef WITH_XEN_PVH
if (hvm && i == nr_guest_archs-1) {
/* Ensure we have not exhausted the guest_archs array */
if (nr_guest_archs >= G_N_ELEMENTS(guest_archs))
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM ||
def->os.type == VIR_DOMAIN_OSTYPE_XENPVH) {
-#ifdef HAVE_XEN_PVH
+#ifdef WITH_XEN_PVH
c_info->type = def->os.type == VIR_DOMAIN_OSTYPE_HVM ?
LIBXL_DOMAIN_TYPE_HVM : LIBXL_DOMAIN_TYPE_PVH;
#else
if (hvm) {
libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_HVM);
} else if (pvh) {
-#ifdef HAVE_XEN_PVH
+#ifdef WITH_XEN_PVH
libxl_domain_build_info_init_type(b_info, LIBXL_DOMAIN_TYPE_PVH);
#else
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
* corresponding header file wasn't. Use the header file if detected during
* configure, otherwise provide extern declarations for any functions used.
*/
-#ifdef HAVE_LIBXLUTIL_H
+#ifdef WITH_LIBXLUTIL_H
# include <libxlutil.h>
#else
typedef struct XLU_Config XLU_Config;
char **message)
{
if (err <= -200) {
-#if HAVE_SANLOCK_STRERROR
+#if WITH_SANLOCK_STRERROR
*message = g_strdup(sanlock_strerror(err));
#else
*message = g_strdup_printf(_("sanlock error %d"), err);
#include "viruuid.h"
#include "virstring.h"
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
# include <dlfcn.h>
#endif
#include <unistd.h>
*
* Returns a plugin object, or NULL if loading failed.
*/
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
virLockManagerPluginPtr virLockManagerPluginNew(const char *name,
const char *driverName,
const char *configDir,
dlclose(handle);
return NULL;
}
-#else /* !HAVE_DLFCN_H */
+#else /* !WITH_DLFCN_H */
virLockManagerPluginPtr
virLockManagerPluginNew(const char *name G_GNUC_UNUSED,
const char *driverName G_GNUC_UNUSED,
_("this platform is missing dlopen"));
return NULL;
}
-#endif /* !HAVE_DLFCN_H */
+#endif /* !WITH_DLFCN_H */
/**
* result in an unsafe scenario.
*
*/
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
void virLockManagerPluginUnref(virLockManagerPluginPtr plugin)
{
if (!plugin)
VIR_FREE(plugin->name);
VIR_FREE(plugin);
}
-#else /* !HAVE_DLFCN_H */
+#else /* !WITH_DLFCN_H */
void virLockManagerPluginUnref(virLockManagerPluginPtr plugin G_GNUC_UNUSED)
{
}
-#endif /* !HAVE_DLFCN_H */
+#endif /* !WITH_DLFCN_H */
const char *virLockManagerPluginGetName(virLockManagerPluginPtr plugin)
#include <pwd.h>
#include <sys/ioctl.h>
#include <net/if.h>
-#ifdef HAVE_SYSCTLBYNAME
+#ifdef WITH_SYSCTLBYNAME
# include <sys/sysctl.h>
#endif
bool enableIPv6)
{
int ret = 0;
-#ifdef HAVE_SYSCTLBYNAME
+#ifdef WITH_SYSCTLBYNAME
int enabled = 1;
if (enableIPv4)
ret = sysctlbyname("net.inet.ip.forwarding", NULL, 0,
*/
#include <config.h>
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
# include <pcap.h>
#endif
VIR_LOG_INIT("nwfilter.nwfilter_dhcpsnoop");
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
# define LEASEFILE_DIR RUNSTATEDIR "/libvirt/network/"
# define LEASEFILE LEASEFILE_DIR "nwfilter.leases"
virNWFilterSnoopActiveUnlock();
}
-#else /* HAVE_LIBPCAP */
+#else /* WITH_LIBPCAP */
int
virNWFilterDHCPSnoopInit(void)
"='dhcp'\" requires it."));
return -1;
}
-#endif /* HAVE_LIBPCAP */
+#endif /* WITH_LIBPCAP */
#include <config.h>
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
# include <pcap.h>
#endif
}
-#if HAVE_LIBPCAP
+#if WITH_LIBPCAP
static int
virNWFilterRegisterLearnReq(virNWFilterIPAddrLearnReqPtr req)
}
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
static virNWFilterIPAddrLearnReqPtr
virNWFilterDeregisterLearnReq(int ifindex)
#endif
-#ifdef HAVE_LIBPCAP
+#ifdef WITH_LIBPCAP
static void
procDHCPOpts(struct dhcp *dhcp, int dhcp_opts_len,
"support"));
return -1;
}
-#endif /* HAVE_LIBPCAP */
+#endif /* WITH_LIBPCAP */
/**
#ifdef __linux__
# include <sys/sysmacros.h>
#endif
-#if defined(HAVE_SYS_MOUNT_H)
+#if defined(WITH_SYS_MOUNT_H)
# include <sys/mount.h>
#endif
#ifdef WITH_SELINUX
switch (ns) {
case QEMU_DOMAIN_NS_MOUNT:
-# if !defined(HAVE_SYS_ACL_H) || !defined(WITH_SELINUX)
+# if !defined(WITH_SYS_ACL_H) || !defined(WITH_SELINUX)
/* We can't create the exact copy of paths if either of
* these is not available. */
return false;
/*
* To be run between fork/exec of QEMU only
*/
-#if defined(HAVE_SCHED_GETAFFINITY) || defined(HAVE_BSD_CPU_AFFINITY)
+#if defined(WITH_SCHED_GETAFFINITY) || defined(WITH_BSD_CPU_AFFINITY)
static int
qemuProcessInitCpuAffinity(virDomainObjPtr vm)
{
return 0;
}
-#else /* !defined(HAVE_SCHED_GETAFFINITY) && !defined(HAVE_BSD_CPU_AFFINITY) */
+#else /* !defined(WITH_SCHED_GETAFFINITY) && !defined(WITH_BSD_CPU_AFFINITY) */
static int
qemuProcessInitCpuAffinity(virDomainObjPtr vm G_GNUC_UNUSED)
{
return 0;
}
-#endif /* !defined(HAVE_SCHED_GETAFFINITY) && !defined(HAVE_BSD_CPU_AFFINITY) */
+#endif /* !defined(WITH_SCHED_GETAFFINITY) && !defined(WITH_BSD_CPU_AFFINITY) */
/* set link states to down on interfaces at qemu start */
static int
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
# include <ifaddrs.h>
#endif
-#ifdef HAVE_SYS_UCRED_H
+#ifdef WITH_SYS_UCRED_H
# include <sys/ucred.h>
#endif
int virNetSocketCheckProtocols(bool *hasIPv4,
bool *hasIPv6)
{
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
struct ifaddrs *ifaddr = NULL, *ifa;
*hasIPv4 = *hasIPv6 = false;
pid_t *pid,
unsigned long long *timestamp)
{
-# if defined(HAVE_STRUCT_SOCKPEERCRED)
+# if defined(WITH_STRUCT_SOCKPEERCRED)
struct sockpeercred cr;
# else
struct ucred cr;
}
-#ifdef HAVE_RBD_LIST2
+#ifdef WITH_RBD_LIST2
static char **
virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
{
return NULL;
}
-#else /* ! HAVE_RBD_LIST2 */
+#else /* ! WITH_RBD_LIST2 */
static char **
virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
virStringListFreeCount(names, nnames);
return NULL;
}
-#endif /* ! HAVE_RBD_LIST2 */
+#endif /* ! WITH_RBD_LIST2 */
static int
#include <sys/param.h>
#include <fcntl.h>
-#if HAVE_PWD_H
+#if WITH_PWD_H
# include <pwd.h>
#endif
#ifdef FICLONE
# define REFLINK_IOC_CLONE FICLONE
-#elif HAVE_LINUX_BTRFS_H
+#elif WITH_LINUX_BTRFS_H
# include <linux/btrfs.h>
# define REFLINK_IOC_CLONE BTRFS_IOC_CLONE
-#elif HAVE_XFS_XFS_H
+#elif WITH_XFS_XFS_H
# include <xfs/xfs.h>
# define REFLINK_IOC_CLONE XFS_IOC_CLONE
#endif
}
/* Avoid issues with older kernel's <linux/fs.h> namespace pollution. */
-#if HAVE_FALLOCATE - 0
+#if WITH_FALLOCATE - 0
/* Try to preallocate all requested disk space, but fall back to
* other methods if this fails with ENOSYS or EOPNOTSUPP. If allocation
* is 0 (or less than 0), then fallocate will fail with EINVAL.
bool direct = O_DIRECT && ((oflags & O_DIRECT) != 0);
off_t end = 0;
-#if HAVE_POSIX_MEMALIGN
+#if WITH_POSIX_MEMALIGN
if (posix_memalign(&base, alignMask + 1, buflen)) {
virReportOOMError();
goto cleanup;
#define VIR_FROM_THIS VIR_FROM_BPF
-#if HAVE_SYS_SYSCALL_H && HAVE_DECL_BPF_PROG_QUERY
+#if WITH_SYS_SYSCALL_H && WITH_DECL_BPF_PROG_QUERY
# include <sys/syscall.h>
# include <unistd.h>
}
-#else /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */
+#else /* !WITH_SYS_SYSCALL_H || !WITH_DECL_BPF_PROG_QUERY */
int
errno = ENOSYS;
return -1;
}
-#endif /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */
+#endif /* !WITH_SYS_SYSCALL_H || !WITH_DECL_BPF_PROG_QUERY */
#pragma once
-#if HAVE_DECL_BPF_PROG_QUERY
+#if WITH_DECL_BPF_PROG_QUERY
# include <linux/bpf.h>
.imm = 0, \
})
-#else /* HAVE_DECL_BPF_PROG_QUERY */
+#else /* WITH_DECL_BPF_PROG_QUERY */
struct bpf_prog_info;
struct bpf_map_info;
# define VIR_BPF_CALL_INSN(func)
# define VIR_BPF_EXIT_INSN()
-#endif /* HAVE_DECL_BPF_PROG_QUERY */
+#endif /* WITH_DECL_BPF_PROG_QUERY */
int
virBPFCreateMap(unsigned int mapType,
*/
#include <config.h>
-#if HAVE_DECL_BPF_CGROUP_DEVICE
+#if WITH_DECL_BPF_CGROUP_DEVICE
# include <fcntl.h>
# include <linux/bpf.h>
# include <sys/stat.h>
# include <sys/syscall.h>
# include <sys/types.h>
-#endif /* !HAVE_DECL_BPF_CGROUP_DEVICE */
+#endif /* !WITH_DECL_BPF_CGROUP_DEVICE */
#include "internal.h"
#define VIR_FROM_THIS VIR_FROM_CGROUP
-#if HAVE_DECL_BPF_CGROUP_DEVICE
+#if WITH_DECL_BPF_CGROUP_DEVICE
bool
virCgroupV2DevicesAvailable(virCgroupPtr group)
{
return ret;
}
-#else /* !HAVE_DECL_BPF_CGROUP_DEVICE */
+#else /* !WITH_DECL_BPF_CGROUP_DEVICE */
bool
virCgroupV2DevicesAvailable(virCgroupPtr group G_GNUC_UNUSED)
{
{
return 0;
}
-#endif /* !HAVE_DECL_BPF_CGROUP_DEVICE */
+#endif /* !WITH_DECL_BPF_CGROUP_DEVICE */
uint64_t
if (dbus_watch_get_enabled(watch))
flags = virDBusTranslateWatchFlags(dbus_watch_get_flags(watch));
-# if HAVE_DBUS_WATCH_GET_UNIX_FD
+# if WITH_DBUS_WATCH_GET_UNIX_FD
fd = dbus_watch_get_unix_fd(watch);
# else
fd = dbus_watch_get_fd(watch);
#include "virdbus.h"
-#if defined(WITH_DBUS) && !HAVE_DBUSBASICVALUE
+#if defined(WITH_DBUS) && !WITH_DBUSBASICVALUE
/* Copied (and simplified) from dbus 1.6.12, for use with older dbus headers */
typedef union
{
#ifndef WIN32
# include <termios.h>
#endif
-#ifdef HAVE_PTY_H
+#ifdef WITH_PTY_H
/* Linux openpty */
# include <pty.h>
#endif
-#ifdef HAVE_UTIL_H
+#ifdef WITH_UTIL_H
/* macOS openpty */
# include <util.h>
#endif
-#ifdef HAVE_LIBUTIL_H
+#ifdef WITH_LIBUTIL_H
/* FreeBSD openpty */
# include <libutil.h>
#endif
#include <sys/stat.h>
-#if defined(HAVE_SYS_MOUNT_H)
+#if defined(WITH_SYS_MOUNT_H)
# include <sys/mount.h>
#endif
#include <unistd.h>
#include <dirent.h>
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
# include <mntent.h>
#endif
-#if HAVE_MMAP
+#if WITH_MMAP
# include <sys/mman.h>
#endif
-#if HAVE_SYS_SYSCALL_H
+#if WITH_SYS_SYSCALL_H
# include <sys/syscall.h>
#endif
-#if HAVE_SYS_ACL_H
+#if WITH_SYS_ACL_H
# include <sys/acl.h>
#endif
#include <sys/file.h>
#ifdef __linux__
-# if HAVE_LINUX_MAGIC_H
+# if WITH_LINUX_MAGIC_H
# include <linux/magic.h>
# endif
# include <sys/statfs.h>
-# if HAVE_DECL_LO_FLAGS_AUTOCLEAR
+# if WITH_DECL_LO_FLAGS_AUTOCLEAR
# include <linux/loop.h>
# endif
# include <sys/ioctl.h>
# include <linux/fs.h>
#endif
-#if HAVE_LIBATTR
+#if WITH_LIBATTR
# include <sys/xattr.h>
#endif
}
-#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR
+#if defined(__linux__) && WITH_DECL_LO_FLAGS_AUTOCLEAR
-# if HAVE_DECL_LOOP_CTL_GET_FREE
+# if WITH_DECL_LOOP_CTL_GET_FREE
/* virFileLoopDeviceOpenLoopCtl() returns -1 when a real failure has occurred
* while in the process of allocating or opening the loop device. On success
*dev_name = looppath;
return 0;
}
-# endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
+# endif /* WITH_DECL_LOOP_CTL_GET_FREE */
static int virFileLoopDeviceOpenSearch(char **dev_name)
{
{
int loop_fd = -1;
-# if HAVE_DECL_LOOP_CTL_GET_FREE
+# if WITH_DECL_LOOP_CTL_GET_FREE
if (virFileLoopDeviceOpenLoopCtl(dev_name, &loop_fd) < 0)
return -1;
if (loop_fd >= 0)
return loop_fd;
-# endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
+# endif /* WITH_DECL_LOOP_CTL_GET_FREE */
/* Without the loop control device we just use the old technique. */
loop_fd = virFileLoopDeviceOpenSearch(dev_name);
return nwritten;
}
-#ifdef HAVE_POSIX_FALLOCATE
+#ifdef WITH_POSIX_FALLOCATE
static int
safezero_posix_fallocate(int fd, off_t offset, off_t len)
{
errno = ret;
return -1;
}
-#else /* !HAVE_POSIX_FALLOCATE */
+#else /* !WITH_POSIX_FALLOCATE */
static int
safezero_posix_fallocate(int fd G_GNUC_UNUSED,
off_t offset G_GNUC_UNUSED,
{
return -2;
}
-#endif /* !HAVE_POSIX_FALLOCATE */
+#endif /* !WITH_POSIX_FALLOCATE */
-#if HAVE_SYS_SYSCALL_H && defined(SYS_fallocate)
+#if WITH_SYS_SYSCALL_H && defined(SYS_fallocate)
static int
safezero_sys_fallocate(int fd,
off_t offset,
{
return syscall(SYS_fallocate, fd, 0, offset, len);
}
-#else /* !HAVE_SYS_SYSCALL_H || !defined(SYS_fallocate) */
+#else /* !WITH_SYS_SYSCALL_H || !defined(SYS_fallocate) */
static int
safezero_sys_fallocate(int fd G_GNUC_UNUSED,
off_t offset G_GNUC_UNUSED,
{
return -2;
}
-#endif /* !HAVE_SYS_SYSCALL_H || !defined(SYS_fallocate) */
+#endif /* !WITH_SYS_SYSCALL_H || !defined(SYS_fallocate) */
-#ifdef HAVE_MMAP
+#ifdef WITH_MMAP
static int
safezero_mmap(int fd, off_t offset, off_t len)
{
* example because of virtual memory limits) */
return -2;
}
-#else /* !HAVE_MMAP */
+#else /* !WITH_MMAP */
static int
safezero_mmap(int fd G_GNUC_UNUSED,
off_t offset G_GNUC_UNUSED,
{
return -2;
}
-#endif /* !HAVE_MMAP */
+#endif /* !WITH_MMAP */
static int
safezero_slow(int fd, off_t offset, off_t len)
return safezero_sys_fallocate(fd, offset, len);
}
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
/* search /proc/mounts for mount point of *type; return pointer to
* malloc'ed string of the path if found, otherwise return NULL
* with errno set to an appropriate value.
return ret;
}
-#else /* defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#else /* defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
char *
virFileFindMountPoint(const char *type G_GNUC_UNUSED)
return NULL;
}
-#endif /* defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
int
virBuildPathInternal(char **path, ...)
#endif /* defined(__linux__) */
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
static int
virFileGetMountSubtreeImpl(const char *mtabpath,
const char *prefix,
endmntent(procmnt);
return ret;
}
-#else /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#else /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
static int
virFileGetMountSubtreeImpl(const char *mtabpath G_GNUC_UNUSED,
const char *prefix G_GNUC_UNUSED,
_("Unable to determine mount table on this platform"));
return -1;
}
-#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
/**
* virFileGetMountSubtree:
}
-#if defined(__linux__) && defined(HAVE_SYS_MOUNT_H)
+#if defined(__linux__) && defined(WITH_SYS_MOUNT_H)
int
virFileSetupDev(const char *path,
const char *mount_options)
}
-#else /* !defined(__linux__) || !defined(HAVE_SYS_MOUNT_H) */
+#else /* !defined(__linux__) || !defined(WITH_SYS_MOUNT_H) */
int
virFileSetupDev(const char *path G_GNUC_UNUSED,
_("mount move is not supported on this platform."));
return -1;
}
-#endif /* !defined(__linux__) || !defined(HAVE_SYS_MOUNT_H) */
+#endif /* !defined(__linux__) || !defined(WITH_SYS_MOUNT_H) */
-#if defined(HAVE_SYS_ACL_H)
+#if defined(WITH_SYS_ACL_H)
int
virFileGetACLs(const char *file,
void **acl)
*acl = NULL;
}
-#else /* !defined(HAVE_SYS_ACL_H) */
+#else /* !defined(WITH_SYS_ACL_H) */
int
virFileGetACLs(const char *file G_GNUC_UNUSED,
*acl = NULL;
}
-#endif /* !defined(HAVE_SYS_ACL_H) */
+#endif /* !defined(WITH_SYS_ACL_H) */
int
virFileCopyACLs(const char *src,
}
-#if HAVE_DECL_SEEK_HOLE
+#if WITH_DECL_SEEK_HOLE
/**
* virFileInData:
* @fd: file to check
return ret;
}
-#else /* !HAVE_DECL_SEEK_HOLE */
+#else /* !WITH_DECL_SEEK_HOLE */
int
virFileInData(int fd G_GNUC_UNUSED,
return -1;
}
-#endif /* !HAVE_DECL_SEEK_HOLE */
+#endif /* !WITH_DECL_SEEK_HOLE */
/**
}
-#if HAVE_LIBATTR
+#if WITH_LIBATTR
/**
* virFileGetXAttrQuiet;
* @path: a filename
return 0;
}
-#else /* !HAVE_LIBATTR */
+#else /* !WITH_LIBATTR */
int
virFileGetXAttrQuiet(const char *path G_GNUC_UNUSED,
return -1;
}
-#endif /* HAVE_LIBATTR */
+#endif /* WITH_LIBATTR */
/**
* virFileGetXAttr;
#include <config.h>
#include <locale.h>
-#ifdef HAVE_XLOCALE_H
+#ifdef WITH_XLOCALE_H
# include <xlocale.h>
#endif
int
virGettextInitialize(void)
{
-#if HAVE_LIBINTL_H
+#if WITH_LIBINTL_H
if (!setlocale(LC_ALL, "")) {
perror("setlocale");
/* failure to setup locale is not fatal */
perror("textdomain");
return -1;
}
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
return 0;
}
#endif
#include <unistd.h>
-#if HAVE_LINUX_KVM_H
+#if WITH_LINUX_KVM_H
# include <linux/kvm.h>
#endif
}
-#if HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
+#if WITH_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
/* Get the number of threads per subcore.
*
return 0;
}
-#endif /* HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT) */
+#endif /* WITH_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT) */
-#if HAVE_LINUX_KVM_H
+#if WITH_LINUX_KVM_H
int
virHostCPUGetKVMMaxVCPUs(void)
{
_("KVM is not supported on this platform"));
return -1;
}
-#endif /* HAVE_LINUX_KVM_H */
+#endif /* WITH_LINUX_KVM_H */
#ifdef __linux__
#endif /* __linux__ */
-#if HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
+#if WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
(defined(__i386__) || defined(__x86_64__)) && \
(defined(__linux__) || defined(__FreeBSD__))
static int
return NULL;
}
-#endif /* HAVE_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
+#endif /* WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \
(defined(__i386__) || defined(__x86_64__)) && \
(defined(__linux__) || defined(__FreeBSD__)) */
static unsigned long long
virHostMemGetTotal(void)
{
-#if defined HAVE_SYSCTLBYNAME
+#if defined WITH_SYSCTLBYNAME
/* This works on freebsd & macOS. */
unsigned long long physmem = 0;
size_t len = sizeof(physmem);
static unsigned long long
virHostMemGetAvailable(void)
{
-#if defined HAVE_SYSCTLBYNAME
+#if defined WITH_SYSCTLBYNAME
/* This works on freebsd and macOS */
unsigned long long usermem = 0;
size_t len = sizeof(usermem);
#include <config.h>
-#ifdef HAVE_GETUTXID
+#ifdef WITH_GETUTXID
# include <utmpx.h>
#endif
}
#endif /* defined(__linux__) */
-#if defined(HAVE_GETUTXID) || defined(__linux__)
+#if defined(WITH_GETUTXID) || defined(__linux__)
static void
virHostGetBootTimeOnceInit(void)
{
-# ifdef HAVE_GETUTXID
+# ifdef WITH_GETUTXID
struct utmpx id = {.ut_type = BOOT_TIME};
struct utmpx *res = NULL;
}
endutxent();
-# endif /* HAVE_GETUTXID */
+# endif /* WITH_GETUTXID */
# ifdef __linux__
if (bootTimeErrno != 0 || bootTime == 0)
# endif /* __linux__ */
}
-#else /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
+#else /* !defined(WITH_GETUTXID) && !defined(__linux__) */
static void
virHostGetBootTimeOnceInit(void)
{
bootTimeErrno = ENOSYS;
}
-#endif /* !defined(HAVE_GETUTXID) && !defined(__linux__) */
+#endif /* !defined(WITH_GETUTXID) && !defined(__linux__) */
/**
* virHostGetBootTime:
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
# include <syslog.h>
#endif
/* Journald output is only supported on Linux new enough to expose
* htole64. */
-#if HAVE_SYSLOG_H && defined(__linux__) && HAVE_DECL_HTOLE64
+#if WITH_SYSLOG_H && defined(__linux__) && WITH_DECL_HTOLE64
# define USE_JOURNALD 1
# include <sys/uio.h>
#endif
}
-#if HAVE_SYSLOG_H || USE_JOURNALD
+#if WITH_SYSLOG_H || USE_JOURNALD
/* Compat in case we build with journald, but no syslog */
# ifndef LOG_DEBUG
return LOG_ERR;
}
}
-#endif /* HAVE_SYSLOG_H || USE_JOURNALD */
+#endif /* WITH_SYSLOG_H || USE_JOURNALD */
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
static void
virLogOutputToSyslog(virLogSourcePtr source G_GNUC_UNUSED,
virLogPriority priority,
return VIR_LOG_ERROR;
}
-#else /* HAVE_SYSLOG_H */
+#else /* WITH_SYSLOG_H */
int virLogPriorityFromSyslog(int priority G_GNUC_UNUSED)
{
return VIR_LOG_ERROR;
}
-#endif /* HAVE_SYSLOG_H */
+#endif /* WITH_SYSLOG_H */
/**
int
virLogDefineOutputs(virLogOutputPtr *outputs, size_t noutputs)
{
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
int id;
char *tmp = NULL;
-#endif /* HAVE_SYSLOG_H */
+#endif /* WITH_SYSLOG_H */
if (virLogInitialize() < 0)
return -1;
virLogLock();
virLogResetOutputs();
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
/* syslog needs to be special-cased, since it keeps the fd in private */
if ((id = virLogFindOutput(outputs, noutputs, VIR_LOG_TO_SYSLOG,
current_ident)) != -1) {
current_ident = tmp;
openlog(current_ident, 0, 0);
}
-#endif /* HAVE_SYSLOG_H */
+#endif /* WITH_SYSLOG_H */
virLogOutputs = outputs;
virLogNbOutputs = noutputs;
ret = virLogNewOutputToStderr(prio);
break;
case VIR_LOG_TO_SYSLOG:
-#if HAVE_SYSLOG_H
+#if WITH_SYSLOG_H
ret = virLogNewOutputToSyslog(prio, tokens[2]);
#endif
break;
VIR_LOG_INIT("util.module");
-#ifdef HAVE_DLFCN_H
+#ifdef WITH_DLFCN_H
# include <dlfcn.h>
static void *
return ret;
}
-#else /* ! HAVE_DLFCN_H */
+#else /* ! WITH_DLFCN_H */
int
virModuleLoad(const char *path,
const char *regfunc G_GNUC_UNUSED,
return 1;
}
}
-#endif /* ! HAVE_DLFCN_H */
+#endif /* ! WITH_DLFCN_H */
# include <linux/sockios.h>
# include <linux/if_vlan.h>
# define VIR_NETDEV_FAMILY AF_UNIX
-#elif defined(HAVE_STRUCT_IFREQ) && defined(AF_LOCAL)
+#elif defined(WITH_STRUCT_IFREQ) && defined(AF_LOCAL)
# define VIR_NETDEV_FAMILY AF_LOCAL
#else
-# undef HAVE_STRUCT_IFREQ
+# undef WITH_STRUCT_IFREQ
#endif
-#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCETHTOOL) && defined(WITH_STRUCT_IFREQ)
# include <linux/types.h>
# include <linux/ethtool.h>
#endif
-#if HAVE_DECL_LINK_ADDR
+#if WITH_DECL_LINK_ADDR
# include <sys/sockio.h>
# include <net/if_dl.h>
#endif
-#if HAVE_LINUX_DEVLINK_H
+#if WITH_LINUX_DEVLINK_H
# include <linux/devlink.h>
#endif
#define VIR_MCAST_NAME_LEN (IFNAMSIZ + 1)
#define VIR_MCAST_TOKEN_DELIMS " \n"
-#if defined(SIOCSIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFFLAGS) && defined(WITH_STRUCT_IFREQ)
# define VIR_IFF_UP IFF_UP
# define VIR_IFF_PROMISC IFF_PROMISC
# define VIR_IFF_MULTICAST IFF_MULTICAST
#endif
#define RESOURCE_FILE_LEN 4096
-#if HAVE_DECL_ETHTOOL_GFEATURES
+#if WITH_DECL_ETHTOOL_GFEATURES
# define TX_UDP_TNL 25
# define GFEATURES_SIZE 2
# define FEATURE_WORD(blocks, index, field) ((blocks)[(index) / 32U].field)
virNetDevMcastEntryPtr *entries;
};
-#if defined(HAVE_STRUCT_IFREQ)
+#if defined(WITH_STRUCT_IFREQ)
static int virNetDevSetupControlFull(const char *ifname,
struct ifreq *ifr,
int domain,
{
return virNetDevSetupControlFull(ifname, ifr, VIR_NETDEV_FAMILY, SOCK_DGRAM);
}
-#else /* !HAVE_STRUCT_IFREQ */
+#else /* !WITH_STRUCT_IFREQ */
int
virNetDevSetupControl(const char *ifname G_GNUC_UNUSED,
void *ifr G_GNUC_UNUSED)
"on this platform"));
return -1;
}
-#endif /* HAVE_STRUCT_IFREQ */
+#endif /* WITH_STRUCT_IFREQ */
-#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFFLAGS) && defined(WITH_STRUCT_IFREQ)
/**
* virNetDevExists:
* @ifname
#if defined(SIOCGIFHWADDR) && defined(SIOCSIFHWADDR) && \
- defined(HAVE_STRUCT_IFREQ)
+ defined(WITH_STRUCT_IFREQ)
/**
* virNetDevSetMACInternal:
* @ifname: interface name to set MTU for
}
-#elif defined(SIOCSIFLLADDR) && defined(HAVE_STRUCT_IFREQ) && \
- HAVE_DECL_LINK_ADDR
+#elif defined(SIOCSIFLLADDR) && defined(WITH_STRUCT_IFREQ) && \
+ WITH_DECL_LINK_ADDR
static int
}
-#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFHWADDR) && defined(WITH_STRUCT_IFREQ)
/**
* virNetDevGetMAC:
* @ifname: interface name to set MTU for
#endif
-#if defined(SIOCGIFMTU) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFMTU) && defined(WITH_STRUCT_IFREQ)
/**
* virNetDevGetMTU:
* @ifname: interface name get MTU for
#endif
-#if defined(SIOCSIFMTU) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFMTU) && defined(WITH_STRUCT_IFREQ)
/**
* virNetDevSetMTU:
* @ifname: interface name to set MTU for
return 0;
}
-#if defined(SIOCSIFNAME) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFNAME) && defined(WITH_STRUCT_IFREQ)
/**
* virNetDevSetName:
* @ifname: name of device
if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
return -1;
-# ifdef HAVE_STRUCT_IFREQ_IFR_NEWNAME
+# ifdef WITH_STRUCT_IFREQ_IFR_NEWNAME
if (virStrcpyStatic(ifr.ifr_newname, newifname) < 0) {
virReportSystemError(ERANGE,
_("Network interface name '%s' is too long"),
#endif
-#if defined(SIOCSIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCSIFFLAGS) && defined(WITH_STRUCT_IFREQ)
static int
virNetDevSetIFFlag(const char *ifname, int flag, bool val)
{
}
-#if defined(SIOCGIFFLAGS) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFFLAGS) && defined(WITH_STRUCT_IFREQ)
static int
virNetDevGetIFFlag(const char *ifname, int flag, bool *val)
{
return virNetDevGetIFFlag(ifname, VIR_IFF_ALLMULTI, receive);
}
-#if defined(HAVE_IF_INDEXTONAME)
+#if defined(WITH_IF_INDEXTONAME)
char *virNetDevGetName(int ifindex)
{
char name[IFNAMSIZ];
*
* Returns 0 on success, -1 on failure
*/
-#if defined(SIOCGIFINDEX) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFINDEX) && defined(WITH_STRUCT_IFREQ)
int virNetDevGetIndex(const char *ifname, int *ifindex)
{
struct ifreq ifreq;
return -1;
}
-# ifdef HAVE_STRUCT_IFREQ_IFR_INDEX
+# ifdef WITH_STRUCT_IFREQ_IFR_INDEX
*ifindex = ifreq.ifr_index;
# else
*ifindex = ifreq.ifr_ifindex;
#endif /* ! SIOCGIFINDEX */
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
/**
* virNetDevGetMaster:
* @ifname: name of interface we're interested in
}
-#endif /* defined(__linux__) && defined(HAVE_LIBNL) */
+#endif /* defined(__linux__) && defined(WITH_LIBNL) */
-#if defined(SIOCGIFVLAN) && defined(HAVE_STRUCT_IFREQ) && HAVE_DECL_GET_VLAN_VID_CMD
+#if defined(SIOCGIFVLAN) && defined(WITH_STRUCT_IFREQ) && WITH_DECL_GET_VLAN_VID_CMD
int virNetDevGetVLanID(const char *ifname, int *vlanid)
{
struct vlan_ioctl_args vlanargs = {
*
* Returns 1 if the config matches, 0 if the config does not match, or interface does not exist, -1 on error
*/
-#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFHWADDR) && defined(WITH_STRUCT_IFREQ)
int virNetDevValidateConfig(const char *ifname,
const virMacAddr *macaddr, int ifindex)
{
#endif /* !__linux__ */
-#if defined(__linux__) && defined(HAVE_LIBNL) && defined(IFLA_VF_MAX)
+#if defined(__linux__) && defined(WITH_LIBNL) && defined(IFLA_VF_MAX)
static virMacAddr zeroMAC = { .addr = { 0, 0, 0, 0, 0, 0 } };
}
-#else /* defined(__linux__) && defined(HAVE_LIBNL) && defined(IFLA_VF_MAX) */
+#else /* defined(__linux__) && defined(WITH_LIBNL) && defined(IFLA_VF_MAX) */
int
}
-#endif /* defined(__linux__) && defined(HAVE_LIBNL) && defined(IFLA_VF_MAX) */
+#endif /* defined(__linux__) && defined(WITH_LIBNL) && defined(IFLA_VF_MAX) */
VIR_ENUM_IMPL(virNetDevIfState,
VIR_NETDEV_IF_STATE_LAST,
#endif /* defined(__linux__) */
-#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ) && \
- defined(HAVE_STRUCT_IFREQ_IFR_HWADDR)
+#if defined(SIOCADDMULTI) && defined(WITH_STRUCT_IFREQ) && \
+ defined(WITH_STRUCT_IFREQ_IFR_HWADDR)
/**
* virNetDevAddMulti:
* @ifname: interface name to which to add multicast MAC address
}
#endif
-#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ) && \
- defined(HAVE_STRUCT_IFREQ_IFR_HWADDR)
+#if defined(SIOCDELMULTI) && defined(WITH_STRUCT_IFREQ) && \
+ defined(WITH_STRUCT_IFREQ_IFR_HWADDR)
/**
* virNetDevDelMulti:
* @ifname: interface name from which to delete the multicast MAC address
return ret;
}
-#if defined(SIOCETHTOOL) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCETHTOOL) && defined(WITH_STRUCT_IFREQ)
/**
* virNetDevRDMAFeature
{ETHTOOL_GTXCSUM, VIR_NET_DEV_FEAT_GTXCSUM},
{ETHTOOL_GSG, VIR_NET_DEV_FEAT_GSG},
{ETHTOOL_GTSO, VIR_NET_DEV_FEAT_GTSO},
-# if HAVE_DECL_ETHTOOL_GGSO
+# if WITH_DECL_ETHTOOL_GGSO
{ETHTOOL_GGSO, VIR_NET_DEV_FEAT_GGSO},
# endif
-# if HAVE_DECL_ETHTOOL_GGRO
+# if WITH_DECL_ETHTOOL_GGRO
{ETHTOOL_GGRO, VIR_NET_DEV_FEAT_GGRO},
# endif
};
-# if HAVE_DECL_ETHTOOL_GFLAGS
+# if WITH_DECL_ETHTOOL_GFLAGS
/* ethtool masks */
struct virNetDevEthtoolFeatureCmd flags[] = {
-# if HAVE_DECL_ETH_FLAG_LRO
+# if WITH_DECL_ETH_FLAG_LRO
{ETH_FLAG_LRO, VIR_NET_DEV_FEAT_LRO},
# endif
-# if HAVE_DECL_ETH_FLAG_TXVLAN
+# if WITH_DECL_ETH_FLAG_TXVLAN
{ETH_FLAG_RXVLAN, VIR_NET_DEV_FEAT_RXVLAN},
{ETH_FLAG_TXVLAN, VIR_NET_DEV_FEAT_TXVLAN},
# endif
-# if HAVE_DECL_ETH_FLAG_NTUBLE
+# if WITH_DECL_ETH_FLAG_NTUBLE
{ETH_FLAG_NTUPLE, VIR_NET_DEV_FEAT_NTUPLE},
# endif
-# if HAVE_DECL_ETH_FLAG_RXHASH
+# if WITH_DECL_ETH_FLAG_RXHASH
{ETH_FLAG_RXHASH, VIR_NET_DEV_FEAT_RXHASH},
# endif
};
ignore_value(virBitmapSetBit(bitmap, ethtool_cmds[i].feat));
}
-# if HAVE_DECL_ETHTOOL_GFLAGS
+# if WITH_DECL_ETHTOOL_GFLAGS
cmd.cmd = ETHTOOL_GFLAGS;
if (virNetDevFeatureAvailable(fd, ifr, &cmd)) {
for (i = 0; i < G_N_ELEMENTS(flags); i++) {
}
-# if HAVE_DECL_DEVLINK_CMD_ESWITCH_GET
+# if WITH_DECL_DEVLINK_CMD_ESWITCH_GET
/**
* virNetDevGetFamilyId:
# endif
-# if HAVE_DECL_ETHTOOL_GFEATURES
+# if WITH_DECL_ETHTOOL_GFEATURES
/**
* virNetDevGFeatureAvailable
* This function checks for the availability of a network device gfeature
# endif
-# if HAVE_DECL_ETHTOOL_SCOALESCE && HAVE_DECL_ETHTOOL_GCOALESCE
+# if WITH_DECL_ETHTOOL_SCOALESCE && WITH_DECL_ETHTOOL_GCOALESCE
/**
* virNetDevSetCoalesce:
* @ifname: interface name to modify
#include "virnetdevvlan.h"
#include "virenum.h"
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
# include <net/if.h>
#endif
-#ifdef HAVE_STRUCT_IFREQ
+#ifdef WITH_STRUCT_IFREQ
typedef struct ifreq virIfreq;
#else
typedef void virIfreq;
#include "virstring.h"
#include "virsocket.h"
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
# include <net/if.h>
#endif
#ifdef __linux__
-# if defined(HAVE_LIBNL)
+# if defined(WITH_LIBNL)
# include "virnetlink.h"
# endif
# include <linux/sockios.h>
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
#endif
-#if defined(HAVE_BSD_BRIDGE_MGMT)
+#if defined(WITH_BSD_BRIDGE_MGMT)
# include <net/ethernet.h>
# include <net/if_bridgevar.h>
#endif
VIR_LOG_INIT("util.netdevbridge");
-#if defined(HAVE_BSD_BRIDGE_MGMT)
+#if defined(WITH_BSD_BRIDGE_MGMT)
static int virNetDevBridgeCmd(const char *brname,
u_long op,
void *arg,
}
#endif
-#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
+#if defined(WITH_STRUCT_IFREQ) && defined(__linux__)
/*
* Bridge parameters can be set via sysfs on newish kernels,
* or by ioctl on older kernels. Perhaps we could just use
*
* Returns 0 in case of success or -1 on failure
*/
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDBR)
static int
virNetDevBridgeCreateWithIoctl(const char *brname,
const virMacAddr *mac)
}
#endif
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
int
virNetDevBridgeCreate(const char *brname,
const virMacAddr *mac)
if (virNetlinkNewLink(brname, "bridge", &data, &error) < 0) {
-# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
+# if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDBR)
if (error == -EOPNOTSUPP) {
/* fallback to ioctl if netlink doesn't support creating bridges */
return virNetDevBridgeCreateWithIoctl(brname, mac);
}
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDBR)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDBR)
int
virNetDevBridgeCreate(const char *brname,
const virMacAddr *mac)
}
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCIFCREATE2)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCIFCREATE2)
int
virNetDevBridgeCreate(const char *brname,
const virMacAddr *mac)
*
* Returns 0 in case of success or an errno code in case of failure.
*/
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELBR)
static int
virNetDevBridgeDeleteWithIoctl(const char *brname)
{
#endif
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
int
virNetDevBridgeDelete(const char *brname)
{
* deleting a bridge even if it is currently IFF_UP. fallback to
* using ioctl(SIOCBRDELBR) if netlink fails with EOPNOTSUPP.
*/
-# if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
+# if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELBR)
return virNetlinkDelLink(brname, virNetDevBridgeDeleteWithIoctl);
# else
return virNetlinkDelLink(brname, NULL);
}
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELBR)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELBR)
int
virNetDevBridgeDelete(const char *brname)
{
}
-#elif defined(HAVE_STRUCT_IFREQ) && defined(SIOCIFDESTROY)
+#elif defined(WITH_STRUCT_IFREQ) && defined(SIOCIFDESTROY)
int
virNetDevBridgeDelete(const char *brname)
{
*
* Returns 0 in case of success or an errno code in case of failure.
*/
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRADDIF)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRADDIF)
int virNetDevBridgeAddPort(const char *brname,
const char *ifname)
{
return 0;
}
-#elif defined(HAVE_BSD_BRIDGE_MGMT)
+#elif defined(WITH_BSD_BRIDGE_MGMT)
int virNetDevBridgeAddPort(const char *brname,
const char *ifname)
{
*
* Returns 0 in case of success or an errno code in case of failure.
*/
-#if defined(HAVE_STRUCT_IFREQ) && defined(SIOCBRDELIF)
+#if defined(WITH_STRUCT_IFREQ) && defined(SIOCBRDELIF)
int virNetDevBridgeRemovePort(const char *brname,
const char *ifname)
{
return 0;
}
-#elif defined(HAVE_BSD_BRIDGE_MGMT)
+#elif defined(WITH_BSD_BRIDGE_MGMT)
int virNetDevBridgeRemovePort(const char *brname,
const char *ifname)
{
#endif
-#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
+#if defined(WITH_STRUCT_IFREQ) && defined(__linux__)
/**
* virNetDevBridgeSetSTPDelay:
* @brname: the bridge name
return ret;
}
-#elif defined(HAVE_BSD_BRIDGE_MGMT)
+#elif defined(WITH_BSD_BRIDGE_MGMT)
int virNetDevBridgeSetSTPDelay(const char *brname,
int delay)
{
}
#endif
-#if defined(HAVE_STRUCT_IFREQ) && defined(__linux__)
+#if defined(WITH_STRUCT_IFREQ) && defined(__linux__)
/**
* virNetDevBridgeGetVlanFiltering:
* @brname: the bridge device name
#endif
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
# ifndef NTF_SELF
# define NTF_SELF 0x02
#include "vircommand.h"
#include "viralloc.h"
-#if HAVE_GETIFADDRS
+#if WITH_GETIFADDRS
# include <ifaddrs.h>
#endif
#ifndef WIN32
# include <sys/ioctl.h>
#endif
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
# include <net/if.h>
#endif
#include <fcntl.h>
VIR_LOG_INIT("util.netdevip");
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
static int
virNetDevGetIPAddressBinary(virSocketAddr *addr, void **data, size_t *len)
return valid;
}
-#else /* defined(__linux__) && defined(HAVE_LIBNL) */
+#else /* defined(__linux__) && defined(WITH_LIBNL) */
int
return true;
}
-#endif /* defined(__linux__) && defined(HAVE_LIBNL) */
+#endif /* defined(__linux__) && defined(WITH_LIBNL) */
/**
*
* Returns 0 on success, -errno on failure.
*/
-#if defined(SIOCGIFADDR) && defined(HAVE_STRUCT_IFREQ)
+#if defined(SIOCGIFADDR) && defined(WITH_STRUCT_IFREQ)
static int
virNetDevGetIPv4AddressIoctl(const char *ifname,
virSocketAddrPtr addr)
*
* Returns 0 on success, -1 on failure, -2 on unsupported.
*/
-#if HAVE_GETIFADDRS
+#if WITH_GETIFADDRS
static int
virNetDevGetifaddrsAddress(const char *ifname,
virSocketAddrPtr addr)
return ret;
}
-#else /* ! HAVE_GETIFADDRS */
+#else /* ! WITH_GETIFADDRS */
static int
virNetDevGetifaddrsAddress(const char *ifname G_GNUC_UNUSED,
# include <math.h>
/* Older kernels lacked this enum value. */
-# if !HAVE_DECL_MACVLAN_MODE_PASSTHRU
+# if !WITH_DECL_MACVLAN_MODE_PASSTHRU
# define MACVLAN_MODE_PASSTHRU 8
# endif
#ifndef WIN32
# include <sys/ioctl.h>
#endif
-#ifdef HAVE_NET_IF_H
+#ifdef WITH_NET_IF_H
# include <net/if.h>
#endif
#include <fcntl.h>
# include <net/if_mib.h>
# include <sys/sysctl.h>
#endif
-#if defined(HAVE_GETIFADDRS) && defined(AF_LINK)
+#if defined(WITH_GETIFADDRS) && defined(AF_LINK)
# include <ifaddrs.h>
#endif
#include <math.h>
_("/proc/net/dev: Interface not found"));
return -1;
}
-#elif defined(HAVE_GETIFADDRS) && defined(AF_LINK)
+#elif defined(WITH_GETIFADDRS) && defined(AF_LINK)
int
virNetDevTapInterfaceStats(const char *ifname,
virDomainInterfaceStatsPtr stats,
#define NETLINK_ACK_TIMEOUT_S (2*1000)
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
/* State for a single netlink event handle */
struct virNetlinkEventHandle {
int watch;
#include "internal.h"
#include "virmacaddr.h"
-#if defined(__linux__) && defined(HAVE_LIBNL)
+#if defined(__linux__) && defined(WITH_LIBNL)
# include <netlink/msg.h>
VIR_LOG_INIT("util.numa");
-#if HAVE_NUMAD
+#if WITH_NUMAD
char *
virNumaGetAutoPlacementAdvice(unsigned short vcpus,
unsigned long long balloon)
return output;
}
-#else /* !HAVE_NUMAD */
+#else /* !WITH_NUMAD */
char *
virNumaGetAutoPlacementAdvice(unsigned short vcpus G_GNUC_UNUSED,
unsigned long long balloon G_GNUC_UNUSED)
_("numad is not available on this host"));
return NULL;
}
-#endif /* !HAVE_NUMAD */
+#endif /* !WITH_NUMAD */
#if WITH_NUMACTL
int
}
-#if WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET
+#if WITH_NUMACTL && WITH_NUMA_BITMASK_ISBITSET
/**
* virNumaNodeIsAvailable:
* @node: node to check
return 0;
}
-#else /* !(WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET) */
+#else /* !(WITH_NUMACTL && WITH_NUMA_BITMASK_ISBITSET) */
bool
virNumaNodeIsAvailable(int node)
VIR_DEBUG("NUMA distance information isn't available on this host");
return 0;
}
-#endif /* !(WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET) */
+#endif /* !(WITH_NUMACTL && WITH_NUMA_BITMASK_ISBITSET) */
/* currently all the huge page stuff below is linux only */
#ifndef WIN32
# include <sys/ioctl.h>
#endif
-#if defined HAVE_SYS_SYSCALL_H
+#if defined WITH_SYS_SYSCALL_H
# include <sys/syscall.h>
#endif
struct virPerfEvent events[VIR_PERF_EVENT_LAST];
};
-#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)
+#if defined(__linux__) && defined(WITH_SYS_SYSCALL_H)
# include <linux/perf_event.h>
# include <sys/wait.h>
#endif
#include <unistd.h>
-#if HAVE_SYS_MOUNT_H
+#if WITH_SYS_MOUNT_H
# include <sys/mount.h>
#endif
-#if HAVE_SETRLIMIT
+#if WITH_SETRLIMIT
# include <sys/time.h>
# include <sys/resource.h>
#endif
-#if HAVE_SCHED_SETSCHEDULER
+#if WITH_SCHED_SETSCHEDULER
# include <sched.h>
#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || HAVE_BSD_CPU_AFFINITY
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || WITH_BSD_CPU_AFFINITY
# include <sys/param.h>
#endif
# include <sys/user.h>
#endif
-#if HAVE_BSD_CPU_AFFINITY
+#if WITH_BSD_CPU_AFFINITY
# include <sys/cpuset.h>
#endif
# endif
# endif
-# ifndef HAVE_SETNS
+# ifndef WITH_SETNS
# if defined(__NR_setns)
# include <sys/syscall.h>
return virProcessKillPainfullyDelay(pid, force, 0);
}
-#if HAVE_SCHED_GETAFFINITY
+#if WITH_SCHED_GETAFFINITY
int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
{
return ret;
}
-#elif defined(HAVE_BSD_CPU_AFFINITY)
+#elif defined(WITH_BSD_CPU_AFFINITY)
int virProcessSetAffinity(pid_t pid,
virBitmapPtr map)
return ret;
}
-#else /* HAVE_SCHED_GETAFFINITY */
+#else /* WITH_SCHED_GETAFFINITY */
int virProcessSetAffinity(pid_t pid G_GNUC_UNUSED,
virBitmapPtr map G_GNUC_UNUSED)
_("Process CPU affinity is not supported on this platform"));
return NULL;
}
-#endif /* HAVE_SCHED_GETAFFINITY */
+#endif /* WITH_SCHED_GETAFFINITY */
int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
return 0;
}
-#if HAVE_PRLIMIT
+#if WITH_PRLIMIT
static int
virProcessPrLimit(pid_t pid,
int resource,
{
return prlimit(pid, resource, new_limit, old_limit);
}
-#elif HAVE_SETRLIMIT
+#elif WITH_SETRLIMIT
static int
virProcessPrLimit(pid_t pid G_GNUC_UNUSED,
int resource G_GNUC_UNUSED,
}
#endif
-#if HAVE_SETRLIMIT && defined(RLIMIT_MEMLOCK)
+#if WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)
int
virProcessSetMaxMemLock(pid_t pid, unsigned long long bytes)
{
return 0;
}
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
int
virProcessSetMaxMemLock(pid_t pid G_GNUC_UNUSED, unsigned long long bytes)
{
virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
return -1;
}
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_MEMLOCK)) */
-#if HAVE_GETRLIMIT && defined(RLIMIT_MEMLOCK)
+#if WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)
int
virProcessGetMaxMemLock(pid_t pid,
unsigned long long *bytes)
return 0;
}
-#else /* ! (HAVE_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#else /* ! (WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
int
virProcessGetMaxMemLock(pid_t pid G_GNUC_UNUSED,
unsigned long long *bytes)
virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
return -1;
}
-#endif /* ! (HAVE_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
+#endif /* ! (WITH_GETRLIMIT && defined(RLIMIT_MEMLOCK)) */
-#if HAVE_SETRLIMIT && defined(RLIMIT_NPROC)
+#if WITH_SETRLIMIT && defined(RLIMIT_NPROC)
int
virProcessSetMaxProcesses(pid_t pid, unsigned int procs)
{
}
return 0;
}
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NPROC)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_NPROC)) */
int
virProcessSetMaxProcesses(pid_t pid G_GNUC_UNUSED, unsigned int procs)
{
virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
return -1;
}
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NPROC)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NPROC)) */
-#if HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)
+#if WITH_SETRLIMIT && defined(RLIMIT_NOFILE)
int
virProcessSetMaxFiles(pid_t pid, unsigned int files)
{
}
return 0;
}
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */
int
virProcessSetMaxFiles(pid_t pid G_GNUC_UNUSED, unsigned int files)
{
virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
return -1;
}
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_NOFILE)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_NOFILE)) */
-#if HAVE_SETRLIMIT && defined(RLIMIT_CORE)
+#if WITH_SETRLIMIT && defined(RLIMIT_CORE)
int
virProcessSetMaxCoreSize(pid_t pid, unsigned long long bytes)
{
}
return 0;
}
-#else /* ! (HAVE_SETRLIMIT && defined(RLIMIT_CORE)) */
+#else /* ! (WITH_SETRLIMIT && defined(RLIMIT_CORE)) */
int
virProcessSetMaxCoreSize(pid_t pid G_GNUC_UNUSED,
unsigned long long bytes)
virReportSystemError(ENOSYS, "%s", _("Not supported on this platform"));
return -1;
}
-#endif /* ! (HAVE_SETRLIMIT && defined(RLIMIT_CORE)) */
+#endif /* ! (WITH_SETRLIMIT && defined(RLIMIT_CORE)) */
#ifdef __linux__
exit(value);
}
-#if HAVE_SCHED_SETSCHEDULER
+#if WITH_SCHED_SETSCHEDULER
static int
virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
return 0;
}
-#else /* ! HAVE_SCHED_SETSCHEDULER */
+#else /* ! WITH_SCHED_SETSCHEDULER */
int
virProcessSetScheduler(pid_t pid G_GNUC_UNUSED,
return -1;
}
-#endif /* !HAVE_SCHED_SETSCHEDULER */
+#endif /* !WITH_SCHED_SETSCHEDULER */
#include <glib/gprintf.h>
#include <locale.h>
-#ifdef HAVE_XLOCALE_H
+#ifdef WITH_XLOCALE_H
# include <xlocale.h>
#endif
}
/* In case thread-safe locales are available */
-#if HAVE_NEWLOCALE
+#if WITH_NEWLOCALE
typedef locale_t virLocale;
static virLocale virLocaleRaw;
{
}
-#else /* !HAVE_NEWLOCALE */
+#else /* !WITH_NEWLOCALE */
typedef int virLocale;
}
}
-#endif /* !HAVE_NEWLOCALE */
+#endif /* !WITH_NEWLOCALE */
/**
#include <unistd.h>
#include <inttypes.h>
-#if HAVE_SYS_SYSCALL_H
+#if WITH_SYS_SYSCALL_H
# include <sys/syscall.h>
#endif
* the pthread_self() id on Linux. */
unsigned long long virThreadSelfID(void)
{
-#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux__)
+#if defined(WITH_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux__)
pid_t tid = syscall(SYS_gettid);
return tid;
#else
#include <sys/types.h>
-#ifdef HAVE_GETPWUID_R
+#ifdef WITH_GETPWUID_R
# include <pwd.h>
# include <grp.h>
#endif
}
-#ifdef HAVE_GETPWUID_R
+#ifdef WITH_GETPWUID_R
/* Look up fields from the user database for the given user. On
* error, set errno, report the error if not instructed otherwise via @quiet,
* and return -1. */
return -1;
}
-# if HAVE_SETGROUPS
+# if WITH_SETGROUPS
if (gid != (gid_t)-1 && setgroups(ngroups, groups) < 0) {
virReportSystemError(errno, "%s",
_("cannot set supplemental groups"));
return 0;
}
-#else /* ! HAVE_GETPWUID_R */
+#else /* ! WITH_GETPWUID_R */
int
virGetGroupList(uid_t uid G_GNUC_UNUSED, gid_t gid G_GNUC_UNUSED,
return NULL;
}
-# else /* !HAVE_GETPWUID_R && !WIN32 */
+# else /* !WITH_GETPWUID_R && !WIN32 */
char *
virGetUserDirectoryByUID(uid_t uid G_GNUC_UNUSED)
{
return NULL;
}
-# endif /* ! HAVE_GETPWUID_R && ! WIN32 */
+# endif /* ! WITH_GETPWUID_R && ! WIN32 */
char *
virGetUserName(uid_t uid G_GNUC_UNUSED)
return NULL;
}
-#endif /* HAVE_GETPWUID_R */
+#endif /* WITH_GETPWUID_R */
#if WITH_CAPNG
/* Set the real and effective uid and gid to the given values, while
static int
virPipeImpl(int fds[2], bool nonblock, bool errreport)
{
-#ifdef HAVE_PIPE2
+#ifdef WITH_PIPE2
int rv;
int flags = O_CLOEXEC;
if (nonblock)
flags |= O_NONBLOCK;
rv = pipe2(fds, flags);
-#else /* !HAVE_PIPE2 */
+#else /* !WITH_PIPE2 */
# ifdef WIN32
int rv = _pipe(fds, 4096, _O_BINARY);
# else /* !WIN32 */
int rv = pipe(fds);
# endif /* !WIN32 */
-#endif /* !HAVE_PIPE2 */
+#endif /* !WITH_PIPE2 */
if (rv < 0) {
if (errreport)
return rv;
}
-#ifndef HAVE_PIPE2
+#ifndef WITH_PIPE2
if (nonblock) {
if (virSetNonBlock(fds[0]) < 0 ||
virSetNonBlock(fds[1]) < 0) {
return -1;
}
}
-#endif /* !HAVE_PIPE2 */
+#endif /* !WITH_PIPE2 */
return 0;
}
char *virIndexToDiskName(int idx, const char *prefix);
/* No-op workarounds for functionality missing in mingw. */
-#ifndef HAVE_GETUID
+#ifndef WITH_GETUID
static inline int getuid(void)
{ return 0; }
#endif
-#ifndef HAVE_GETEUID
+#ifndef WITH_GETEUID
static inline int geteuid(void)
{ return 0; }
#endif
-#ifndef HAVE_GETGID
+#ifndef WITH_GETGID
static inline int getgid(void)
{ return 0; }
#endif
-#ifndef HAVE_GETEGID
+#ifndef WITH_GETEGID
static inline int getegid(void)
{ return 0; }
#endif
#include <config.h>
-#ifdef HAVE_SYS_IOCTL_H
+#ifdef WITH_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
-#if HAVE_DECL_VHOST_VSOCK_SET_GUEST_CID
+#if WITH_DECL_VHOST_VSOCK_SET_GUEST_CID
# include <linux/vhost.h>
#endif
VIR_LOG_INIT("util.vsock");
-#if HAVE_DECL_VHOST_VSOCK_SET_GUEST_CID
+#if WITH_DECL_VHOST_VSOCK_SET_GUEST_CID
static int
virVsockSetGuestCidQuiet(int fd,
unsigned int guest_cid)
#include <signal.h>
#include <time.h>
-#if HAVE_MACH_CLOCK_ROUTINES
+#if WITH_MACH_CLOCK_ROUTINES
# include <mach/clock.h>
# include <mach/mach.h>
#endif
DO_TEST("basic-pv");
DO_TEST("basic-hvm");
-# ifdef HAVE_XEN_PVH
+# ifdef WITH_XEN_PVH
DO_TEST("basic-pvh");
# endif
DO_TEST("cpu-shares-hvm");
]
nettls_sources = [ 'virnettlshelpers.c' ]
- if conf.has('HAVE_LIBTASN1_H')
+ if conf.has('WITH_LIBTASN1_H')
nettls_sources += 'pkix_asn1_tab.c'
endif
* detected. */
#include "virmock.h"
-#if HAVE_LINUX_MAGIC_H
+#if WITH_LINUX_MAGIC_H
# include <linux/magic.h>
#endif
#include <selinux/selinux.h>
#include <stdio.h>
#include <mntent.h>
#include <sys/vfs.h>
-#if HAVE_LINUX_MAGIC_H
+#if WITH_LINUX_MAGIC_H
# include <linux/magic.h>
#endif
#include <assert.h>
#define VIR_FROM_THIS VIR_FROM_NONE
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
static int testFileCheckMounts(const char *prefix,
char **gotmounts,
size_t gotnmounts,
g_strfreev(gotmounts);
return ret;
}
-#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
struct testFileSanitizePathData
{
}
-#if HAVE_DECL_SEEK_HOLE && defined(__linux__)
+#if WITH_DECL_SEEK_HOLE && defined(__linux__)
/* Create a sparse file. @offsets in KiB. */
static int
return ret;
}
-#else /* !HAVE_DECL_SEEK_HOLE || !defined(__linux__)*/
+#else /* !WITH_DECL_SEEK_HOLE || !defined(__linux__)*/
static int
makeSparseFile(const off_t offsets[] G_GNUC_UNUSED,
return false;
}
-#endif /* !HAVE_DECL_SEEK_HOLE || !defined(__linux__)*/
+#endif /* !WITH_DECL_SEEK_HOLE || !defined(__linux__)*/
struct testFileInData {
bool startData; /* whether the list of offsets starts with data section */
int ret = 0;
struct testFileSanitizePathData data1;
-#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
+#if defined WITH_MNTENT_H && defined WITH_GETMNTENT_R
# define MTAB_PATH1 abs_srcdir "/virfiledata/mounts1.txt"
# define MTAB_PATH2 abs_srcdir "/virfiledata/mounts2.txt"
DO_TEST_MOUNT_SUBTREE("/proc reverse", MTAB_PATH1, "/proc", wantmounts1rev, true);
DO_TEST_MOUNT_SUBTREE("/etc/aliases", MTAB_PATH2, "/etc/aliases", wantmounts2a, false);
DO_TEST_MOUNT_SUBTREE("/etc/aliases.db", MTAB_PATH2, "/etc/aliases.db", wantmounts2b, false);
-#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
+#endif /* ! defined WITH_MNTENT_H && defined WITH_GETMNTENT_R */
#define DO_TEST_SANITIZE_PATH(PATH, EXPECT) \
do { \
#pragma once
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
# include <dlfcn.h>
#endif
-#if defined(HAVE_STAT) && !defined(HAVE___XSTAT) && !defined(HAVE_STAT64)
+#if defined(WITH_STAT) && !defined(WITH___XSTAT) && !defined(WITH_STAT64)
# define MOCK_STAT
#endif
-#if defined(HAVE_STAT64) && !defined(HAVE___XSTAT64)
+#if defined(WITH_STAT64) && !defined(WITH___XSTAT64)
# define MOCK_STAT64
#endif
-#if defined(HAVE___XSTAT) && !defined(HAVE___XSTAT64)
+#if defined(WITH___XSTAT) && !defined(WITH___XSTAT64)
# define MOCK___XSTAT
#endif
-#if defined(HAVE___XSTAT64)
+#if defined(WITH___XSTAT64)
# define MOCK___XSTAT64
#endif
-#if defined(HAVE_LSTAT) && !defined(HAVE___LXSTAT) && !defined(HAVE_LSTAT64)
+#if defined(WITH_LSTAT) && !defined(WITH___LXSTAT) && !defined(WITH_LSTAT64)
# define MOCK_LSTAT
#endif
-#if defined(HAVE_LSTAT64) && !defined(HAVE___LXSTAT64)
+#if defined(WITH_LSTAT64) && !defined(WITH___LXSTAT64)
# define MOCK_LSTAT64
#endif
-#if defined(HAVE___LXSTAT) && !defined(HAVE___LXSTAT64)
+#if defined(WITH___LXSTAT) && !defined(WITH___LXSTAT64)
# define MOCK___LXSTAT
#endif
-#if defined(HAVE___LXSTAT64)
+#if defined(WITH___LXSTAT64)
# define MOCK___LXSTAT64
#endif
#include <signal.h>
#include <unistd.h>
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
# include <ifaddrs.h>
#endif
VIR_LOG_INIT("tests.netsockettest");
-#if HAVE_IFADDRS_H
+#if WITH_IFADDRS_H
# define BASE_PORT 5672
static int
mymain(void)
{
int ret = 0;
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
bool hasIPv4, hasIPv6;
int freePort;
#endif
virEventRegisterDefaultImpl();
-#ifdef HAVE_IFADDRS_H
+#ifdef WITH_IFADDRS_H
if (checkProtocols(&hasIPv4, &hasIPv6, &freePort) < 0) {
fprintf(stderr, "Cannot identify IPv4/6 availability\n");
return EXIT_FAILURE;
#include "vircommand.h"
#include "virsocket.h"
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
# include "rpc/virnettlscontext.h"
#include "virsocketaddr.h"
#include "virutil.h"
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
# define VIR_FROM_THIS VIR_FROM_RPC
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
# include <libtasn1.h>
#include "vircommand.h"
#include "virsocket.h"
-#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
+#if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
# define VIR_FROM_THIS VIR_FROM_RPC
#include <config.h>
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
# include <dlfcn.h>
#endif
#include "virfile.h"
#include "testutils.h"
-#if HAVE_DLFCN_H
+#if WITH_DLFCN_H
# include <dlfcn.h>
#endif
if (virCommandRun(cmd, NULL) < 0)
goto skip;
-#ifdef HAVE_SYMLINK
+#ifdef WITH_SYMLINK
/* Create some symlinks in a sub-directory. */
if (symlink("../qcow2", datadir "/sub/link1") < 0 ||
symlink("../wrap", datadir "/sub/link2") < 0) {
TEST_CHAIN(absdir, VIR_STORAGE_FILE_NONE, (&dir), EXP_PASS);
TEST_CHAIN(absdir, VIR_STORAGE_FILE_DIR, (&dir), EXP_PASS);
-#ifdef HAVE_SYMLINK
+#ifdef WITH_SYMLINK
/* Rewrite qcow2 and wrap file to use backing names relative to a
* symlink from a different directory */
virCommandFree(cmd);
#include <config.h>
#include <locale.h>
-#ifdef HAVE_XLOCALE_H
+#ifdef WITH_XLOCALE_H
# include <xlocale.h>
#endif
#include <wchar.h>
return ret;
}
-#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
+#ifdef WITH_STRUCT_GAIH_ADDRTUPLE
enum nss_status
NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
char *buffer, size_t buflen, int *errnop,
free(addr);
return ret;
}
-#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+#endif /* WITH_STRUCT_GAIH_ADDRTUPLE */
#if defined(WITH_BSD_NSS)
NSS_METHOD_PROTOTYPE(_nss_compat_getaddrinfo);
char *buffer, size_t buflen, int *errnop,
int *herrnop, int32_t *ttlp, char **canonp);
-#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
+#ifdef WITH_STRUCT_GAIH_ADDRTUPLE
enum nss_status
NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
char *buffer, size_t buflen, int *errnop,
int *herrnop, int32_t *ttlp);
-#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+#endif /* WITH_STRUCT_GAIH_ADDRTUPLE */
#if defined(WITH_BSD_NSS)
ns_mtab*
#include <config.h>
-#ifdef HAVE_LIBINTL_H
+#ifdef WITH_LIBINTL_H
# include <libintl.h>
-#endif /* HAVE_LIBINTL_H */
+#endif /* WITH_LIBINTL_H */
#include <getopt.h>
#include "internal.h"