mirror of
https://github.com/golang/go
synced 2024-11-22 01:14:40 -07:00
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
This commit is contained in:
parent
f5f651b89a
commit
452d6b46a3
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user