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)
| 188 | // |
| 189 | // Returns [ErrProgIncompatible] if the tags do not match. |
| 190 | func (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. |