mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
virbpf: Check if syscall() is available
There are some OSes which don't have syscall() nor <sys/syscall.h>. We already check for the header file in configure phase, so we just need to add check for HAVE_SYS_SYSCALL_H to HAVE_DECL_BPF_PROG_QUERY. While I'm at it, some header files we are including are not needed, so their includes can be safely dropped. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
5a5e92000d
commit
c07a33bef9
@ -17,22 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
#include "internal.h"
|
|
||||||
|
|
||||||
#include "viralloc.h"
|
|
||||||
#include "virbpf.h"
|
|
||||||
#include "virerror.h"
|
|
||||||
#include "virfile.h"
|
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virstring.h"
|
#include "virerror.h"
|
||||||
|
#include "virbpf.h"
|
||||||
|
|
||||||
VIR_LOG_INIT("util.bpf");
|
VIR_LOG_INIT("util.bpf");
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_BPF
|
#define VIR_FROM_THIS VIR_FROM_BPF
|
||||||
|
|
||||||
#if HAVE_DECL_BPF_PROG_QUERY
|
#if HAVE_SYS_SYSCALL_H && HAVE_DECL_BPF_PROG_QUERY
|
||||||
|
# include <sys/syscall.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virBPFCreateMap(unsigned int mapType,
|
virBPFCreateMap(unsigned int mapType,
|
||||||
unsigned int keySize,
|
unsigned int keySize,
|
||||||
@ -294,7 +291,11 @@ virBPFDeleteElem(int mapfd,
|
|||||||
|
|
||||||
return syscall(SYS_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
|
return syscall(SYS_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
|
||||||
}
|
}
|
||||||
#else /* HAVE_DECL_BPF_PROG_QUERY */
|
|
||||||
|
|
||||||
|
#else /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virBPFCreateMap(unsigned int mapType G_GNUC_UNUSED,
|
virBPFCreateMap(unsigned int mapType G_GNUC_UNUSED,
|
||||||
unsigned int keySize G_GNUC_UNUSED,
|
unsigned int keySize G_GNUC_UNUSED,
|
||||||
@ -433,4 +434,4 @@ virBPFDeleteElem(int mapfd G_GNUC_UNUSED,
|
|||||||
_("BPF not supported with this kernel"));
|
_("BPF not supported with this kernel"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_DECL_BPF_PROG_QUERY */
|
#endif /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */
|
||||||
|
Loading…
Reference in New Issue
Block a user