Debian Codegraph @

examples/ringbuffer/bpf_bpfel.go

raw symbols SCIP
1 // Code generated by bpf2go; DO NOT EDIT.
2 //go:build (386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 || wasm) && linux
3
4 package main
5
6 import (
7 "bytes"
8 _ "embed"
9 "fmt"
10 "io"
11 "structs"
12
13 "github.com/cilium/ebpf"
14 )
15
16 type bpfEvent struct {
17 _ structs.HostLayout
18 Pid uint32
19 Comm [16]uint8
20 }
21
22 // Names of all BPF objects in the ELF.
23 //
24 // Used for safe lookups in a Collection or CollectionSpec.
25 const (
26 bpfMapEvents = "events"
27 bpfProgKprobeExecve = "kprobe_execve"
28 )
29
30 // loadBpf returns the embedded CollectionSpec for bpf.
31 func loadBpf() (*ebpf.CollectionSpec, error) {
32 reader := bytes.NewReader(_BpfBytes)
33 spec, err := ebpf.LoadCollectionSpecFromReader(reader)
34 if err != nil {
35 return nil, fmt.Errorf("can't load bpf: %w", err)
36 }
37
38 return spec, err
39 }
40
41 // loadBpfObjects loads bpf and converts it into a struct.
42 //
43 // The following types are suitable as obj argument:
44 //
45 // *bpfObjects
46 // *bpfPrograms
47 // *bpfMaps
48 //
49 // See ebpf.CollectionSpec.LoadAndAssign documentation for details.
50 func loadBpfObjects(obj any, opts *ebpf.CollectionOptions) error {
51 spec, err := loadBpf()
52 if err != nil {
53 return err
54 }
55
56 return spec.LoadAndAssign(obj, opts)
57 }
58
59 // bpfSpecs contains maps and programs before they are loaded into the kernel.
60 //
61 // It can be passed ebpf.CollectionSpec.Assign.
62 type bpfSpecs struct {
63 bpfProgramSpecs
64 bpfMapSpecs
65 bpfVariableSpecs
66 }
67
68 // bpfProgramSpecs contains programs before they are loaded into the kernel.
69 //
70 // It can be passed ebpf.CollectionSpec.Assign.
71 type bpfProgramSpecs struct {
72 KprobeExecve *ebpf.ProgramSpec `ebpf:"kprobe_execve"`
73 }
74
75 // bpfMapSpecs contains maps before they are loaded into the kernel.
76 //
77 // It can be passed ebpf.CollectionSpec.Assign.
78 type bpfMapSpecs struct {
79 Events *ebpf.MapSpec `ebpf:"events"`
80 }
81
82 // bpfVariableSpecs contains global variables before they are loaded into the kernel.
83 //
84 // It can be passed ebpf.CollectionSpec.Assign.
85 type bpfVariableSpecs struct {
86 }
87
88 // bpfObjects contains all objects after they have been loaded into the kernel.
89 //
90 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
91 type bpfObjects struct {
92 bpfPrograms
93 bpfMaps
94 bpfVariables
95 }
96
97 func (o *bpfObjects) Close() error {
98 return _BpfClose(
99 &o.bpfPrograms,
100 &o.bpfMaps,
101 )
102 }
103
104 // bpfMaps contains all maps after they have been loaded into the kernel.
105 //
106 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
107 type bpfMaps struct {
108 Events *ebpf.Map `ebpf:"events"`
109 }
110
111 func (m *bpfMaps) Close() error {
112 return _BpfClose(
113 m.Events,
114 )
115 }
116
117 // bpfVariables contains all global variables after they have been loaded into the kernel.
118 //
119 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
120 type bpfVariables struct {
121 }
122
123 // bpfPrograms contains all programs after they have been loaded into the kernel.
124 //
125 // It can be passed to loadBpfObjects or ebpf.CollectionSpec.LoadAndAssign.
126 type bpfPrograms struct {
127 KprobeExecve *ebpf.Program `ebpf:"kprobe_execve"`
128 }
129
130 func (p *bpfPrograms) Close() error {
131 return _BpfClose(
132 p.KprobeExecve,
133 )
134 }
135
136 func _BpfClose(closers ...io.Closer) error {
137 for _, closer := range closers {
138 if err := closer.Close(); err != nil {
139 return err
140 }
141 }
142 return nil
143 }
144
145 // Do not access this directly.
146 //
147 //go:embed bpf_bpfel.o
148 var _BpfBytes []byte