Commit 452d6b46 authored by Andreas Jellinghaus's avatar Andreas Jellinghaus Committed by Ian Lance Taylor

syscall: add linux specific Getsockopt for Ucred struct

SO_PEERCRED on unix domain socket will fill a Ucred struct,
thus linux needs a custom Getsockopt variant.
Fixes #3836.

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/6445104
parent f5f651b8
......@@ -477,6 +477,13 @@ func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) {
return &value, err
}
func GetsockoptUcred(fd, level, opt int) (*Ucred, error) {
var value Ucred
vallen := _Socklen(SizeofUcred)
err := getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&value)), &vallen)
return &value, err
}
func SetsockoptInt(fd, level, opt int, value int) (err error) {
var n = int32(value)
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment