staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / bpf_rlimit.h
blob9dac9b30f8ef21151e4e55baf6d4e9554f60ca0a
1 #include <sys/resource.h>
2 #include <stdio.h>
4 static __attribute__((constructor)) void bpf_rlimit_ctor(void)
6 struct rlimit rlim_old, rlim_new = {
7 .rlim_cur = RLIM_INFINITY,
8 .rlim_max = RLIM_INFINITY,
9 };
11 getrlimit(RLIMIT_MEMLOCK, &rlim_old);
12 /* For the sake of running the test cases, we temporarily
13 * set rlimit to infinity in order for kernel to focus on
14 * errors from actual test cases and not getting noise
15 * from hitting memlock limits. The limit is on per-process
16 * basis and not a global one, hence destructor not really
17 * needed here.
19 if (setrlimit(RLIMIT_MEMLOCK, &rlim_new) < 0) {
20 perror("Unable to lift memlock rlimit");
21 /* Trying out lower limit, but expect potential test
22 * case failures from this!
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);