mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
faf673ee45
The implementation is based on https://github.com/containers/crun/blob/0.10.2/src/libcrun/ebpf.c Although ebpf.c is originally licensed under LGPL-3.0-or-later, the author Giuseppe Scrivano agreed to relicense the file in Apache License 2.0: https://github.com/opencontainers/runc/issues/2144#issuecomment-543116397 See libcontainer/cgroups/ebpf/devicefilter/devicefilter_test.go for tested configurations. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
20 lines
217 B
Go
20 lines
217 B
Go
package ebpf
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
type featureTest struct {
|
|
Fn func() bool
|
|
|
|
once sync.Once
|
|
result bool
|
|
}
|
|
|
|
func (ft *featureTest) Result() bool {
|
|
ft.once.Do(func() {
|
|
ft.result = ft.Fn()
|
|
})
|
|
return ft.result
|
|
}
|