From: John Fastabend Date: Mon, 22 Jan 2018 18:37:11 +0000 (-0800) Subject: bpf: sockmap set rlimit X-Git-Tag: v4.19~1702^2~33^2~7^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e0ef38052c81b08310a8e31a2e6da0a32359257;p=platform%2Fkernel%2Flinux-rpi3.git bpf: sockmap set rlimit Avoid extra step of setting limit from cmdline and do it directly in the program. Signed-off-by: John Fastabend Acked-by: Martin KaFai Lau Signed-off-by: Daniel Borkmann --- diff --git a/samples/sockmap/sockmap_user.c b/samples/sockmap/sockmap_user.c index fe943c9..7c25c0c 100644 --- a/samples/sockmap/sockmap_user.c +++ b/samples/sockmap/sockmap_user.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -447,6 +448,7 @@ enum { int main(int argc, char **argv) { int iov_count = 1, length = 1024, rate = 1, verbose = 0; + struct rlimit r = {10 * 1024 * 1024, RLIM_INFINITY}; int opt, longindex, err, cg_fd = 0; int test = PING_PONG; char filename[256]; @@ -501,6 +503,11 @@ int main(int argc, char **argv) return -1; } + if (setrlimit(RLIMIT_MEMLOCK, &r)) { + perror("setrlimit(RLIMIT_MEMLOCK)"); + return 1; + } + snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); running = 1;