Documentation ¶
Overview ¶
Package rlimit allows raising RLIMIT_MEMLOCK if necessary for the use of BPF.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveMemlock ¶
func RemoveMemlock() error
RemoveMemlock removes the limit on the amount of memory the current process can lock into RAM, if necessary.
This is not required to load eBPF resources on kernel versions 5.11+ due to the introduction of cgroup-based memory accounting. On such kernels the function is a no-op.
Since the function may change global per-process limits it should be invoked at program start up, in main() or init().
This function exists as a convenience and should only be used when permanently raising RLIMIT_MEMLOCK to infinite is appropriate. Consider invoking prlimit(2) directly with a more reasonable limit if desired.
Requires CAP_SYS_RESOURCE on kernels < 5.11.
Types ¶
This section is empty.