MCPcopy
hub / github.com/cilium/ebpf / loadKernelModuleSpec

Function loadKernelModuleSpec

btf/kernel.go:87–104  ·  view source on GitHub ↗
(module string, base *Spec)

Source from the content-addressed store, hash-verified

85}
86
87func loadKernelModuleSpec(module string, base *Spec) (*Spec, error) {
88 if platform.IsWindows {
89 return nil, internal.ErrNotSupportedOnOS
90 }
91
92 dir, file := filepath.Split(module)
93 if dir != "" || filepath.Ext(file) != "" {
94 return nil, fmt.Errorf("invalid module name %q", module)
95 }
96
97 fh, err := os.Open(filepath.Join("/sys/kernel/btf", module))
98 if err != nil {
99 return nil, err
100 }
101 defer fh.Close()
102
103 return LoadSplitSpecFromReader(fh, base)
104}
105
106// findVMLinux scans multiple well-known paths for vmlinux kernel images.
107func findVMLinux() (*os.File, error) {

Callers 2

LoadKernelModuleSpecFunction · 0.85
ModuleMethod · 0.85

Calls 3

LoadSplitSpecFromReaderFunction · 0.85
OpenMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…