Initial FreeBSD PID support

This commit is contained in:
2025-04-04 01:36:14 -04:00
parent 1210f10798
commit cfcdc4bfaa
6 changed files with 8 additions and 10 deletions
+1 -1
View File
@@ -2,4 +2,4 @@ module github.com/rwinkhart/peercred-mini
go 1.24.1 go 1.24.1
require golang.org/x/sys v0.31.0 require github.com/rwinkhart/sys v0.0.0-20250404053244-7215932ae926
+2 -4
View File
@@ -1,4 +1,2 @@
golang.org/x/sys v0.29.1-0.20250107080300-1c14dcadc3ab h1:BMkEEWYOjkvOX7+YKOGbp6jCyQ5pR2j0Ah47p1Vdsx4= github.com/rwinkhart/sys v0.0.0-20250404053244-7215932ae926 h1:MJe9Z46ilI9g7N3/JvQ4pHdXlZvb7InTb3aCoXrSRXM=
golang.org/x/sys v0.29.1-0.20250107080300-1c14dcadc3ab/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= github.com/rwinkhart/sys v0.0.0-20250404053244-7215932ae926/go.mod h1:vs22XiZlTvulYNkiIbKpx01rWq8dXeSF3PML0S2nQd4=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"net" "net"
"strconv" "strconv"
"golang.org/x/sys/unix" "github.com/rwinkhart/sys/unix"
) )
func getUnix(c *net.UnixConn) (*Creds, error) { func getUnix(c *net.UnixConn) (*Creds, error) {
+2 -2
View File
@@ -9,7 +9,7 @@ import (
"net" "net"
"strconv" "strconv"
"golang.org/x/sys/unix" "github.com/rwinkhart/sys/unix"
) )
func getUnix(c *net.UnixConn) (*Creds, error) { func getUnix(c *net.UnixConn) (*Creds, error) {
@@ -35,7 +35,7 @@ func getUnix(c *net.UnixConn) (*Creds, error) {
return nil, err return nil, err
} }
return &Creds{ return &Creds{
pid: 0, // FreeBSD 13 adds a cr_pid field, can be used here. pid: int(cred.Pid),
uid: strconv.FormatUint(uint64(cred.Uid), 10), uid: strconv.FormatUint(uint64(cred.Uid), 10),
}, nil }, nil
} }
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"net" "net"
"strconv" "strconv"
"golang.org/x/sys/unix" "github.com/rwinkhart/sys/unix"
) )
func getUnix(c *net.UnixConn) (*Creds, error) { func getUnix(c *net.UnixConn) (*Creds, error) {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"net" "net"
"strconv" "strconv"
"golang.org/x/sys/unix" "github.com/rwinkhart/sys/unix"
) )
func getUnix(c *net.UnixConn) (*Creds, error) { func getUnix(c *net.UnixConn) (*Creds, error) {