From 5c3b78e2fc4400a0287da8eb93f73a8d88898b20 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Sun, 24 Jul 2022 01:38:00 +0800 Subject: [PATCH] fix process code --- component/process/process_darwin.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/component/process/process_darwin.go b/component/process/process_darwin.go index 3c2007fd..5615b985 100644 --- a/component/process/process_darwin.go +++ b/component/process/process_darwin.go @@ -15,6 +15,10 @@ const ( proccallnumpidinfo = 0x2 ) +func resolveSocketByNetlink(network string, ip netip.Addr, srcPort int) (int32, int32, error) { + return 0, 0, ErrPlatformNotSupport +} + func findProcessName(network string, ip netip.Addr, port int) (int32, string, error) { var spath string switch network { @@ -78,7 +82,8 @@ func findProcessName(network string, ip netip.Addr, port int) (int32, string, er if ip == srcIP { // xsocket_n.so_last_pid pid := readNativeUint32(buf[so+68 : so+72]) - return getExecPathFromPID(pid) + pp, err := getExecPathFromPID(pid) + return -1, pp, err } // udp packet connection may be not equal with srcIP @@ -88,10 +93,10 @@ func findProcessName(network string, ip netip.Addr, port int) (int32, string, er } if network == UDP && fallbackUDPProcess != "" { - return fallbackUDPProcess, nil + return -1, fallbackUDPProcess, nil } - return "", ErrNotFound + return -1, "", ErrNotFound } func getExecPathFromPID(pid uint32) (string, error) {