Debian Codegraph @

internal/testutils/rlimit.go

raw symbols SCIP
1 package testutils
2
3 import (
4 "fmt"
5 "os"
6
7 "github.com/cilium/ebpf/rlimit"
8 )
9
10 func init() {
11 // Don't adjust rlimit in a user namespace, we won't have permission to do so.
12 if _, ok := os.LookupEnv(setupUserNS); ok {
13 return
14 }
15
16 // Increase the memlock for all tests unconditionally. It's a great source of
17 // weird bugs, since different distros have different default limits.
18 if err := rlimit.RemoveMemlock(); err != nil {
19 fmt.Fprintln(os.Stderr, "WARNING: Failed to adjust rlimit, tests may fail")
20 }
21 }