]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - samples/bpf/sampleip_user.c
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-zesty-kernel.git] / samples / bpf / sampleip_user.c
index 260a6bdd6413ecf2e24b434ce5c30ca137d37ca2..be59d7dcbdde3664c573a78d6d27adee03234a16 100644 (file)
@@ -21,6 +21,7 @@
 #include <sys/ioctl.h>
 #include "libbpf.h"
 #include "bpf_load.h"
+#include "perf-sys.h"
 
 #define DEFAULT_FREQ   99
 #define DEFAULT_SECS   5
@@ -49,7 +50,7 @@ static int sampling_start(int *pmu_fd, int freq)
        };
 
        for (i = 0; i < nr_cpus; i++) {
-               pmu_fd[i] = perf_event_open(&pe_sample_attr, -1 /* pid */, i,
+               pmu_fd[i] = sys_perf_event_open(&pe_sample_attr, -1 /* pid */, i,
                                            -1 /* group_fd */, 0 /* flags */);
                if (pmu_fd[i] < 0) {
                        fprintf(stderr, "ERROR: Initializing perf sampling\n");
@@ -95,8 +96,8 @@ static void print_ip_map(int fd)
 
        /* fetch IPs and counts */
        key = 0, i = 0;
-       while (bpf_get_next_key(fd, &key, &next_key) == 0) {
-               bpf_lookup_elem(fd, &next_key, &value);
+       while (bpf_map_get_next_key(fd, &key, &next_key) == 0) {
+               bpf_map_lookup_elem(fd, &next_key, &value);
                counts[i].ip = next_key;
                counts[i++].count = value;
                key = next_key;