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

Function ExampleProgramSpec_Compatible

prog_test.go:1075–1093  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1073}
1074
1075func ExampleProgramSpec_Compatible() {
1076 spec := &ProgramSpec{
1077 Type: SocketFilter,
1078 Instructions: asm.Instructions{
1079 asm.LoadImm(asm.R0, 0, asm.DWord),
1080 asm.Return(),
1081 },
1082 License: "MIT",
1083 }
1084
1085 prog, _ := NewProgram(spec)
1086 info, _ := prog.Info()
1087
1088 if err := spec.Compatible(info); err != nil {
1089 fmt.Printf("The programs are incompatible: %s\n", err)
1090 } else {
1091 fmt.Println("The programs are compatible")
1092 }
1093}

Callers

nothing calls this directly

Calls 5

InfoMethod · 0.95
CompatibleMethod · 0.95
LoadImmFunction · 0.92
ReturnFunction · 0.92
NewProgramFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…