Commit e83d6964 authored by Albert Strasheim's avatar Albert Strasheim Committed by Russ Cox

syscall: GetsockoptInt for darwin, freebsd.

R=rsc
CC=golang-dev
https://golang.org/cl/4298060
parent e480b819
...@@ -149,6 +149,7 @@ func Sleep(ns int64) (errno int) { ...@@ -149,6 +149,7 @@ func Sleep(ns int64) (errno int) {
//sys bind(s int, addr uintptr, addrlen _Socklen) (errno int) //sys bind(s int, addr uintptr, addrlen _Socklen) (errno int)
//sys connect(s int, addr uintptr, addrlen _Socklen) (errno int) //sys connect(s int, addr uintptr, addrlen _Socklen) (errno int)
//sysnb socket(domain int, typ int, proto int) (fd int, errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int)
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int)
//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) //sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int)
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int)
...@@ -362,6 +363,13 @@ func Socketpair(domain, typ, proto int) (fd [2]int, errno int) { ...@@ -362,6 +363,13 @@ func Socketpair(domain, typ, proto int) (fd [2]int, errno int) {
return return
} }
func GetsockoptInt(fd, level, opt int) (value, errno int) {
var n int32
vallen := _Socklen(4)
errno = getsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), &vallen)
return int(n), errno
}
func SetsockoptInt(fd, level, opt int, value int) (errno int) { func SetsockoptInt(fd, level, opt int, value int) (errno int) {
var n = int32(value) var n = int32(value)
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4) return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
...@@ -552,7 +560,6 @@ func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (errno int) { ...@@ -552,7 +560,6 @@ func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (errno int) {
// TODO: wrap // TODO: wrap
// Acct(name nil-string) (errno int) // Acct(name nil-string) (errno int)
// Gethostuuid(uuid *byte, timeout *Timespec) (errno int) // Gethostuuid(uuid *byte, timeout *Timespec) (errno int)
// Getsockopt(s int, level int, name int, val *byte, vallen *int) (errno int)
// Madvise(addr *byte, len int, behav int) (errno int) // Madvise(addr *byte, len int, behav int) (errno int)
// Mprotect(addr *byte, len int, prot int) (errno int) // Mprotect(addr *byte, len int, prot int) (errno int)
// Msync(addr *byte, len int, flags int) (errno int) // Msync(addr *byte, len int, flags int) (errno int)
......
// mksyscall.sh -l32 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go // mksyscall.pl -l32 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall package syscall
...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) { ...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
errno = int(e1)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
errno = int(e1) errno = int(e1)
......
...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) { ...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
errno = int(e1)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
errno = int(e1) errno = int(e1)
......
// mksyscall.sh -l32 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go // mksyscall.pl -l32 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall package syscall
...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) { ...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
errno = int(e1)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
errno = int(e1) errno = int(e1)
......
// mksyscall.sh syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go // mksyscall.pl syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall package syscall
...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) { ...@@ -77,6 +77,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
errno = int(e1)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
errno = int(e1) errno = int(e1)
......
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