1
0
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:
Mikio Hara 2011-09-23 23:39:19 +09:00
parent 4e2f2c7704
commit 17410d75d0

View File

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