chore: reduce func findProcessName mem allocs and copy (#1393)

This commit is contained in:
ruokeqx 2024-07-19 22:24:27 +08:00 committed by GitHub
parent e263518f01
commit 28794c62c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,12 +46,12 @@ func findProcessName(network string, ip netip.Addr, port int) (uint32, string, e
isIPv4 := ip.Is4()
value, err := syscall.Sysctl(spath)
value, err := unix.SysctlRaw(spath)
if err != nil {
return 0, "", err
}
buf := []byte(value)
buf := value
itemSize := structSize
if network == TCP {
// rup8(sizeof(xtcpcb_n))