Commit 7f2ea938 authored by Christopher Wedgwood's avatar Christopher Wedgwood Committed by Russ Cox

syscall: Implement SetsockoptString

R=rsc, r
CC=golang-dev
https://golang.org/cl/739042
parent 16e54316
...@@ -342,6 +342,9 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) { ...@@ -342,6 +342,9 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l))
} }
func SetsockoptString(fd, level, opt int, s string) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s))
}
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int)
......
...@@ -342,6 +342,9 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) { ...@@ -342,6 +342,9 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l))
} }
func SetsockoptString(fd, level, opt int, s string) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s))
}
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int)
......
...@@ -365,6 +365,10 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) { ...@@ -365,6 +365,10 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l)) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(l)), unsafe.Sizeof(*l))
} }
func SetsockoptString(fd, level, opt int, s string) (errno int) {
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s))
}
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, errno int) { func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, errno int) {
var rsa RawSockaddrAny var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny var len _Socklen = SizeofSockaddrAny
......
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