int bpf_dump_prog_info(FILE *f, uint32_t id);
+int bpf(int cmd, union bpf_attr *attr, unsigned int size);
+
#ifdef HAVE_ELF
int bpf_send_map_fds(const char *path, const char *obj);
int bpf_recv_map_fds(const char *path, int *fds, struct bpf_map_aux *aux,
* Authors: Hangbin Liu <haliu@redhat.com>
*
*/
+#include <sys/syscall.h>
#include <limits.h>
+#include <unistd.h>
#include "bpf_util.h"
#ifdef HAVE_LIBBPF
#include <bpf/bpf.h>
#endif
+int bpf(int cmd, union bpf_attr *attr, unsigned int size)
+{
+#ifdef __NR_bpf
+ return syscall(__NR_bpf, cmd, attr, size);
+#else
+ fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
int bpf_program_attach(int prog_fd, int target_fd, enum bpf_attach_type type)
{
#ifdef HAVE_LIBBPF
#include <sys/un.h>
#include <sys/vfs.h>
#include <sys/mount.h>
-#include <sys/syscall.h>
#include <sys/sendfile.h>
#include <sys/resource.h>
return (__u64)(unsigned long)ptr;
}
-static int bpf(int cmd, union bpf_attr *attr, unsigned int size)
-{
-#ifdef __NR_bpf
- return syscall(__NR_bpf, cmd, attr, size);
-#else
- fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
- errno = ENOSYS;
- return -1;
-#endif
-}
-
static int bpf_map_update(int fd, const void *key, const void *value,
uint64_t flags)
{