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

Method Compatible

prog.go:190–205  ·  view source on GitHub ↗

Compatible returns nil if a loaded Program's kernel tag matches the one of the ProgramSpec. Returns [ErrProgIncompatible] if the tags do not match.

(info *ProgramInfo)

Source from the content-addressed store, hash-verified

188//
189// Returns [ErrProgIncompatible] if the tags do not match.
190func (ps *ProgramSpec) Compatible(info *ProgramInfo) error {
191 if platform.IsWindows {
192 return fmt.Errorf("%w: Windows does not support tag readback from kernel", internal.ErrNotSupportedOnOS)
193 }
194
195 ok, err := ps.Instructions.HasTag(info.Tag, internal.NativeEndian)
196 if err != nil {
197 return err
198 }
199
200 if !ok {
201 return fmt.Errorf("%w: ProgramSpec and Program tags do not match", ErrProgIncompatible)
202 }
203
204 return nil
205}
206
207// targetsKernelModule returns true if the program supports being attached to a
208// symbol provided by a kernel module.

Callers 2

Calls 1

HasTagMethod · 0.80

Tested by 2