From e5991cae0b39709515fb07da23d6b32dbabdcebb Mon Sep 17 00:00:00 2001 From: ruokeqx Date: Mon, 22 Jul 2024 12:41:44 +0800 Subject: [PATCH] Use `unix.SysctlRaw` for macOS --- common/process/searcher_darwin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/process/searcher_darwin.go b/common/process/searcher_darwin.go index de8d3b3b..4344c706 100644 --- a/common/process/searcher_darwin.go +++ b/common/process/searcher_darwin.go @@ -60,12 +60,12 @@ func findProcessName(network string, ip netip.Addr, port int) (string, error) { isIPv4 := ip.Is4() - value, err := syscall.Sysctl(spath) + value, err := unix.SysctlRaw(spath) if err != nil { return "", err } - buf := []byte(value) + buf := value // from darwin-xnu/bsd/netinet/in_pcblist.c:get_pcblist_n // size/offset are round up (aligned) to 8 bytes in darwin