mirror of
https://github.com/golang/go
synced 2024-11-21 23:44:39 -07:00
syscall: add socketpair
R=rsc CC=golang-dev https://golang.org/cl/1319042
This commit is contained in:
parent
a0117bafa0
commit
400f7a6ba5
@ -323,6 +323,11 @@ func Socket(domain, typ, proto int) (fd, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func Socketpair(domain, typ, proto int) (fd [2]int, errno int) {
|
||||
fd, errno = socketpair(domain, typ, proto)
|
||||
return
|
||||
}
|
||||
|
||||
func SetsockoptInt(fd, level, opt int, value int) (errno int) {
|
||||
var n = int32(value)
|
||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
||||
|
@ -368,6 +368,11 @@ func Socket(domain, typ, proto int) (fd, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func Socketpair(domain, typ, proto int) (fd [2]int, errno int) {
|
||||
fd, errno = socketpair(domain, typ, proto)
|
||||
return
|
||||
}
|
||||
|
||||
func SetsockoptInt(fd, level, opt int, value int) (errno int) {
|
||||
var n = int32(value)
|
||||
return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&n)), 4)
|
||||
|
@ -100,6 +100,13 @@ func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, errno = socketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
return
|
||||
}
|
||||
|
||||
func bind(s int, addr uintptr, addrlen _Socklen) (errno int) {
|
||||
_, errno = socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
|
||||
return
|
||||
|
@ -59,6 +59,15 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, _, e1 := Syscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
errno = int(e1)
|
||||
|
@ -59,6 +59,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, _, e1 := Syscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
errno = int(e1)
|
||||
|
@ -59,6 +59,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, _, e1 := Syscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
errno = int(e1)
|
||||
|
@ -59,6 +59,15 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, _, e1 := Syscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
errno = int(e1)
|
||||
|
@ -786,6 +786,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, _, e1 := Syscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
|
||||
errno = int(e1)
|
||||
|
@ -628,6 +628,14 @@ func socket(domain int, typ int, proto int) (fd int, errno int) {
|
||||
return
|
||||
}
|
||||
|
||||
func socketpair(domain int, typ int, proto int) (fd [2]int, errno int) {
|
||||
var f [2]int
|
||||
_, _, e1 := Syscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(&f)), 0, 0)
|
||||
fd = f
|
||||
errno = int(e1)
|
||||
return
|
||||
}
|
||||
|
||||
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
|
||||
errno = int(e1)
|
||||
|
Loading…
Reference in New Issue
Block a user