github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/trace/oomkill/tracer/oomkill_x86_bpfel.go (about) 1 // Code generated by bpf2go; DO NOT EDIT. 2 //go:build 386 || amd64 3 4 package tracer 5 6 import ( 7 "bytes" 8 _ "embed" 9 "fmt" 10 "io" 11 12 "github.com/cilium/ebpf" 13 ) 14 15 type oomkillDataT struct { 16 Fpid uint32 17 Fuid uint32 18 Fgid uint32 19 Tpid uint32 20 Pages uint64 21 MountNsId uint64 22 Timestamp uint64 23 Fcomm [16]uint8 24 Tcomm [16]uint8 25 } 26 27 // loadOomkill returns the embedded CollectionSpec for oomkill. 28 func loadOomkill() (*ebpf.CollectionSpec, error) { 29 reader := bytes.NewReader(_OomkillBytes) 30 spec, err := ebpf.LoadCollectionSpecFromReader(reader) 31 if err != nil { 32 return nil, fmt.Errorf("can't load oomkill: %w", err) 33 } 34 35 return spec, err 36 } 37 38 // loadOomkillObjects loads oomkill and converts it into a struct. 39 // 40 // The following types are suitable as obj argument: 41 // 42 // *oomkillObjects 43 // *oomkillPrograms 44 // *oomkillMaps 45 // 46 // See ebpf.CollectionSpec.LoadAndAssign documentation for details. 47 func loadOomkillObjects(obj interface{}, opts *ebpf.CollectionOptions) error { 48 spec, err := loadOomkill() 49 if err != nil { 50 return err 51 } 52 53 return spec.LoadAndAssign(obj, opts) 54 } 55 56 // oomkillSpecs contains maps and programs before they are loaded into the kernel. 57 // 58 // It can be passed ebpf.CollectionSpec.Assign. 59 type oomkillSpecs struct { 60 oomkillProgramSpecs 61 oomkillMapSpecs 62 } 63 64 // oomkillSpecs contains programs before they are loaded into the kernel. 65 // 66 // It can be passed ebpf.CollectionSpec.Assign. 67 type oomkillProgramSpecs struct { 68 IgOomKill *ebpf.ProgramSpec `ebpf:"ig_oom_kill"` 69 } 70 71 // oomkillMapSpecs contains maps before they are loaded into the kernel. 72 // 73 // It can be passed ebpf.CollectionSpec.Assign. 74 type oomkillMapSpecs struct { 75 Events *ebpf.MapSpec `ebpf:"events"` 76 GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"` 77 } 78 79 // oomkillObjects contains all objects after they have been loaded into the kernel. 80 // 81 // It can be passed to loadOomkillObjects or ebpf.CollectionSpec.LoadAndAssign. 82 type oomkillObjects struct { 83 oomkillPrograms 84 oomkillMaps 85 } 86 87 func (o *oomkillObjects) Close() error { 88 return _OomkillClose( 89 &o.oomkillPrograms, 90 &o.oomkillMaps, 91 ) 92 } 93 94 // oomkillMaps contains all maps after they have been loaded into the kernel. 95 // 96 // It can be passed to loadOomkillObjects or ebpf.CollectionSpec.LoadAndAssign. 97 type oomkillMaps struct { 98 Events *ebpf.Map `ebpf:"events"` 99 GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"` 100 } 101 102 func (m *oomkillMaps) Close() error { 103 return _OomkillClose( 104 m.Events, 105 m.GadgetMntnsFilterMap, 106 ) 107 } 108 109 // oomkillPrograms contains all programs after they have been loaded into the kernel. 110 // 111 // It can be passed to loadOomkillObjects or ebpf.CollectionSpec.LoadAndAssign. 112 type oomkillPrograms struct { 113 IgOomKill *ebpf.Program `ebpf:"ig_oom_kill"` 114 } 115 116 func (p *oomkillPrograms) Close() error { 117 return _OomkillClose( 118 p.IgOomKill, 119 ) 120 } 121 122 func _OomkillClose(closers ...io.Closer) error { 123 for _, closer := range closers { 124 if err := closer.Close(); err != nil { 125 return err 126 } 127 } 128 return nil 129 } 130 131 // Do not access this directly. 132 // 133 //go:embed oomkill_x86_bpfel.o 134 var _OomkillBytes []byte