mirror of
https://github.com/golang/go
synced 2024-11-25 06:07:58 -07:00
syscall: add GetsockoptByte, SetsockoptByte for openbsd
R=golang-dev, fullung, dave, rsc CC=golang-dev https://golang.org/cl/5081044
This commit is contained in:
parent
4e2f2c7704
commit
17410d75d0
@ -363,6 +363,13 @@ func Socketpair(domain, typ, proto int) (fd [2]int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetsockoptByte(fd, level, opt int) (value byte, errno int) {
|
||||
var n byte
|
||||
vallen := _Socklen(1)
|
||||
errno = getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), &vallen)
|
||||
return n, errno
|
||||
}
|
||||
|
||||
func GetsockoptInt(fd, level, opt int) (value, errno int) {
|
||||
var n int32
|
||||
vallen := _Socklen(4)
|
||||
@ -370,6 +377,11 @@ func GetsockoptInt(fd, level, opt int) (value, errno int) {
|
||||
return int(n), errno
|
||||
}
|
||||
|
||||
func SetsockoptByte(fd, level, opt int, value byte) (errno int) {
|
||||
var n = byte(value)
|
||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 1)
|
||||
}
|
||||
|
||||
func SetsockoptInt(fd, level, opt int, value int) (errno int) {
|
||||
var n = int32(value)
|
||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
||||
|
Loading…
Reference in New Issue
Block a user