Skip to content

Commit

Permalink
samples/bpf: set max locked memory to ulimited
Browse files Browse the repository at this point in the history
Signed-off-by: William Tu <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
williamtu authored and davem330 committed Jun 25, 2016
1 parent 176275a commit eb88d58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/bpf/sockex2_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "bpf_load.h"
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/resource.h>

struct pair {
__u64 packets;
Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions samples/bpf/sockex3_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "bpf_load.h"
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/resource.h>

struct flow_keys {
__be32 src;
Expand All @@ -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);
Expand Down

0 comments on commit eb88d58

Please sign in to comment.