github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/snapshot/process/tracer/processcollector_bpfel.go (about) 1 // Code generated by bpf2go; DO NOT EDIT. 2 //go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 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 processCollectorProcessEntry struct { 16 Tgid uint32 17 Pid uint32 18 ParentPid uint32 19 Uid uint32 20 Gid uint32 21 _ [4]byte 22 MntnsId uint64 23 Comm [16]uint8 24 } 25 26 // loadProcessCollector returns the embedded CollectionSpec for processCollector. 27 func loadProcessCollector() (*ebpf.CollectionSpec, error) { 28 reader := bytes.NewReader(_ProcessCollectorBytes) 29 spec, err := ebpf.LoadCollectionSpecFromReader(reader) 30 if err != nil { 31 return nil, fmt.Errorf("can't load processCollector: %w", err) 32 } 33 34 return spec, err 35 } 36 37 // loadProcessCollectorObjects loads processCollector and converts it into a struct. 38 // 39 // The following types are suitable as obj argument: 40 // 41 // *processCollectorObjects 42 // *processCollectorPrograms 43 // *processCollectorMaps 44 // 45 // See ebpf.CollectionSpec.LoadAndAssign documentation for details. 46 func loadProcessCollectorObjects(obj interface{}, opts *ebpf.CollectionOptions) error { 47 spec, err := loadProcessCollector() 48 if err != nil { 49 return err 50 } 51 52 return spec.LoadAndAssign(obj, opts) 53 } 54 55 // processCollectorSpecs contains maps and programs before they are loaded into the kernel. 56 // 57 // It can be passed ebpf.CollectionSpec.Assign. 58 type processCollectorSpecs struct { 59 processCollectorProgramSpecs 60 processCollectorMapSpecs 61 } 62 63 // processCollectorSpecs contains programs before they are loaded into the kernel. 64 // 65 // It can be passed ebpf.CollectionSpec.Assign. 66 type processCollectorProgramSpecs struct { 67 IgSnapProc *ebpf.ProgramSpec `ebpf:"ig_snap_proc"` 68 } 69 70 // processCollectorMapSpecs contains maps before they are loaded into the kernel. 71 // 72 // It can be passed ebpf.CollectionSpec.Assign. 73 type processCollectorMapSpecs struct { 74 GadgetMntnsFilterMap *ebpf.MapSpec `ebpf:"gadget_mntns_filter_map"` 75 } 76 77 // processCollectorObjects contains all objects after they have been loaded into the kernel. 78 // 79 // It can be passed to loadProcessCollectorObjects or ebpf.CollectionSpec.LoadAndAssign. 80 type processCollectorObjects struct { 81 processCollectorPrograms 82 processCollectorMaps 83 } 84 85 func (o *processCollectorObjects) Close() error { 86 return _ProcessCollectorClose( 87 &o.processCollectorPrograms, 88 &o.processCollectorMaps, 89 ) 90 } 91 92 // processCollectorMaps contains all maps after they have been loaded into the kernel. 93 // 94 // It can be passed to loadProcessCollectorObjects or ebpf.CollectionSpec.LoadAndAssign. 95 type processCollectorMaps struct { 96 GadgetMntnsFilterMap *ebpf.Map `ebpf:"gadget_mntns_filter_map"` 97 } 98 99 func (m *processCollectorMaps) Close() error { 100 return _ProcessCollectorClose( 101 m.GadgetMntnsFilterMap, 102 ) 103 } 104 105 // processCollectorPrograms contains all programs after they have been loaded into the kernel. 106 // 107 // It can be passed to loadProcessCollectorObjects or ebpf.CollectionSpec.LoadAndAssign. 108 type processCollectorPrograms struct { 109 IgSnapProc *ebpf.Program `ebpf:"ig_snap_proc"` 110 } 111 112 func (p *processCollectorPrograms) Close() error { 113 return _ProcessCollectorClose( 114 p.IgSnapProc, 115 ) 116 } 117 118 func _ProcessCollectorClose(closers ...io.Closer) error { 119 for _, closer := range closers { 120 if err := closer.Close(); err != nil { 121 return err 122 } 123 } 124 return nil 125 } 126 127 // Do not access this directly. 128 // 129 //go:embed processcollector_bpfel.o 130 var _ProcessCollectorBytes []byte