github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/internal/testutils/rlimit.go (about)

     1  package testutils
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/cilium/ebpf/rlimit"
     8  )
     9  
    10  func init() {
    11  	// Increase the memlock for all tests unconditionally. It's a great source of
    12  	// weird bugs, since different distros have different default limits.
    13  	if err := rlimit.RemoveMemlock(); err != nil {
    14  		fmt.Fprintln(os.Stderr, "WARNING: Failed to adjust rlimit, tests may fail")
    15  	}
    16  }