Feature: PROCESS-NAME support freebsd 13, fix panic on unsupported platforms (#1351)

This commit is contained in:
Rusty Pen 2021-04-14 17:57:17 +08:00 committed by GitHub
parent a9cbd9ec98
commit 936b7012ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,10 @@ func findProcessName(network string, ip net.IP, srcPort int) (string, error) {
}
})
if defaultSearcher == nil {
return "", ErrPlatformNotSupport
}
var spath string
isTCP := network == TCP
switch network {
@ -190,6 +194,8 @@ func newSearcher(major int) *searcher {
udpInpOffset: 8,
}
case 12:
fallthrough
case 13:
s = &searcher{
headSize: 64,
tcpItemSize: 744,