samples/bpf: set max locked memory to ulimited
Subsystems (3)
Signed-off-by William Tu <[email protected]>
--- samples/bpf/sockex2_user.c | 3 +++ samples/bpf/sockex3_user.c | 3 +++ 2 files changed, 6 insertions(+)
samples/bpf/sockex2_user.c +3 -0
@@ -5,6 +5,7 @@#include "bpf_load.h" #include <unistd.h> #include <arpa/inet.h> +#include <sys/resource.h> struct pair {__u64 packets;
@@ -13,11 +14,13 @@ struct pair {int main (int ac,char **argv) { +struct rlimit r = {RLIM_INFINITY ,RLIM_INFINITY };char filename[256 ];FILE *f;int i, sock;snprintf (filename,sizeof (filename),"%s_kern.o" , argv[0 ]); +setrlimit (RLIMIT_MEMLOCK , &r);if (load_bpf_file (filename)) {printf ("%s" , bpf_log_buf);
samples/bpf/sockex3_user.c +3 -0
@@ -5,6 +5,7 @@#include "bpf_load.h" #include <unistd.h> #include <arpa/inet.h> +#include <sys/resource.h> struct flow_keys {__be32 src;
@@ -23,11 +24,13 @@ struct pair {int main (int argc,char **argv) { +struct rlimit r = {RLIM_INFINITY ,RLIM_INFINITY };char filename[256 ];FILE *f;int i, sock;snprintf (filename,sizeof (filename),"%s_kern.o" , argv[0 ]); +setrlimit (RLIMIT_MEMLOCK , &r);if (load_bpf_file (filename)) {printf ("%s" , bpf_log_buf);
Signature · 1 line
2.5.0
Alexei Starovoitov
Acked-byQuoted 1 line · William Tu
Signed-off-by William Tu <[email protected]>
From: William Tu <[email protected]>
Date: Tue, 21 Jun 2016 21:05:58 -0700
Quoted 1 line
Signed-off-by William Tu <[email protected]>
Applied.