mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: use unsafe.Pointer in BSD kevent
Doesn't really matter for the most part, since the runtime-integrated network poller uses its own kevent implementation, but for people using the syscall directly, we should use an unsafe.Pointer for the precise GC to retain the pointer arguments. Also push down unsafe.Pointer a bit further in exec_linux.go, not that there are any GC preemption points in the middle and sys is still live anyway. R=golang-codereviews, dvyukov CC=golang-codereviews, iant https://golang.org/cl/55520043
This commit is contained in:
parent
b7b93a7154
commit
ba8c92c166
14 changed files with 67 additions and 77 deletions
|
|
@ -131,11 +131,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
|
|||
// User and groups
|
||||
if cred := sys.Credential; cred != nil {
|
||||
ngroups := uintptr(len(cred.Groups))
|
||||
groups := uintptr(0)
|
||||
var groups unsafe.Pointer
|
||||
if ngroups > 0 {
|
||||
groups = uintptr(unsafe.Pointer(&cred.Groups[0]))
|
||||
groups = unsafe.Pointer(&cred.Groups[0])
|
||||
}
|
||||
_, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, groups, 0)
|
||||
_, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, uintptr(groups), 0)
|
||||
if err1 != 0 {
|
||||
goto childerror
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue