浏览代码

Use `unix.SysctlRaw` for macOS

ruokeqx 1 年之前
父节点
当前提交
e5991cae0b
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      common/process/searcher_darwin.go

+ 2 - 2
common/process/searcher_darwin.go

@@ -60,12 +60,12 @@ func findProcessName(network string, ip netip.Addr, port int) (string, error) {
 
 
 	isIPv4 := ip.Is4()
 	isIPv4 := ip.Is4()
 
 
-	value, err := syscall.Sysctl(spath)
+	value, err := unix.SysctlRaw(spath)
 	if err != nil {
 	if err != nil {
 		return "", err
 		return "", err
 	}
 	}
 
 
-	buf := []byte(value)
+	buf := value
 
 
 	// from darwin-xnu/bsd/netinet/in_pcblist.c:get_pcblist_n
 	// from darwin-xnu/bsd/netinet/in_pcblist.c:get_pcblist_n
 	// size/offset are round up (aligned) to 8 bytes in darwin
 	// size/offset are round up (aligned) to 8 bytes in darwin