| 100 | } |
| 101 | |
| 102 | func (this *MStack) setupManagerOptions() { |
| 103 | // 对于没有开启 CONFIG_DEBUG_INFO_BTF 的加载额外的 btf.Spec |
| 104 | if this.mconf.ExternalBTF != "" { |
| 105 | byteBuf, err := assets.Asset("user/assets/" + this.mconf.ExternalBTF) |
| 106 | if err != nil { |
| 107 | this.logger.Fatalf("[setupManagerOptions] failed, err:%v", err) |
| 108 | return |
| 109 | } |
| 110 | spec, err := btf.LoadSpecFromReader((bytes.NewReader(byteBuf))) |
| 111 | |
| 112 | this.bpfManagerOptions = manager.Options{ |
| 113 | DefaultKProbeMaxActive: 512, |
| 114 | VerifierOptions: ebpf.CollectionOptions{ |
| 115 | Programs: ebpf.ProgramOptions{ |
| 116 | LogSize: 2097152, |
| 117 | KernelTypes: spec, |
| 118 | }, |
| 119 | }, |
| 120 | RLimit: &unix.Rlimit{ |
| 121 | Cur: math.MaxUint64, |
| 122 | Max: math.MaxUint64, |
| 123 | }, |
| 124 | } |
| 125 | } else { |
| 126 | this.bpfManagerOptions = manager.Options{ |
| 127 | DefaultKProbeMaxActive: 512, |
| 128 | VerifierOptions: ebpf.CollectionOptions{ |
| 129 | Programs: ebpf.ProgramOptions{ |
| 130 | LogSize: 2097152, |
| 131 | }, |
| 132 | }, |
| 133 | RLimit: &unix.Rlimit{ |
| 134 | Cur: math.MaxUint64, |
| 135 | Max: math.MaxUint64, |
| 136 | }, |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func (this *MStack) Start() error { |
| 142 | return this.start() |