INNER CODE UNIT · Go
b
mozillazg/ptcpdump · bpf/bpf.go:472
b := *(*[2]byte)(unsafe.Pointer(&n))
return binary.BigEndian.Uint16(b[:])
}
func (b *BPF) applyFilters() error {
value := uint8(0)
opts := b.opts
log.Infof("start to update FilterPidMap with %+v", opts.pids)
for _, pid := range opts.pids {
pid := pid
if err := b.objs.BpfMaps.PtcpdumpFilterPidMap.Update(pid, value, ebpf.UpdateAny); err != nil {
return fmt.Errorf("update FilterPidMap: %w", err)
}
}
log.Infof("start to update FilterUidMap with %+v", opts.pids)
for _, uid := range opts.uids {