This source file includes following definitions.
- bpf_rlimit_ctor
1 #include <sys/resource.h>
2 #include <stdio.h>
3
4 static __attribute__((constructor)) void bpf_rlimit_ctor(void)
5 {
6 struct rlimit rlim_old, rlim_new = {
7 .rlim_cur = RLIM_INFINITY,
8 .rlim_max = RLIM_INFINITY,
9 };
10
11 getrlimit(RLIMIT_MEMLOCK, &rlim_old);
12
13
14
15
16
17
18
19 if (setrlimit(RLIMIT_MEMLOCK, &rlim_new) < 0) {
20 perror("Unable to lift memlock rlimit");
21
22
23
24 rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20);
25 rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20);
26 setrlimit(RLIMIT_MEMLOCK, &rlim_new);
27 }
28 }