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.
pull/153/head
Johan Walles 9 years ago
parent e3a7a45492
commit 09fbecef59

@ -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()

Loading…
Cancel
Save