From 09fbecef598a970ecf51da31ff24ce36c10dfdd4 Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Fri, 12 Feb 2016 10:58:55 +0100 Subject: [PATCH] Darwin: Remove questionable UIDs process.Process.uids is an array of undocumented values. That one of them is the user that the process is running as is obvious, but what the other two are supposed to be is AFAICT undocumented. On Darwin, the second and third UID (out of three) seem to always be 0. This change removes the two always-zero UIDs from the process.Process struct on Darwin, and leaves just the one that actually identifies the user the process is running as. --- process/process_darwin.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/process/process_darwin.go b/process/process_darwin.go index 7c16639..91543e1 100644 --- a/process/process_darwin.go +++ b/process/process_darwin.go @@ -125,18 +125,10 @@ func (p *Process) Uids() ([]int32, error) { return nil, err } - uids := make([]int32, 0, 3) - // See: http://unix.superglobalmegacorp.com/Net2/newsrc/sys/ucred.h.html userEffectiveUID := int32(k.Eproc.Ucred.Uid) - // See: http://unix.superglobalmegacorp.com/Net2/newsrc/sys/proc.h.html - procRealUID := int32(k.Eproc.Pcred.P_ruid) - procSavedEffectiveUID := int32(k.Eproc.Pcred.P_svuid) - - uids = append(uids, userEffectiveUID, procRealUID, procSavedEffectiveUID) - - return uids, nil + return []int32{userEffectiveUID}, nil } func (p *Process) Gids() ([]int32, error) { k, err := p.getKProc()