diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go
index 00c82df..43e79c6 100644
--- a/src/syscall/syscall_linux_386.go
+++ b/src/syscall/syscall_linux_386.go
@@ -7,10 +7,25 @@
import "unsafe"
const (
- _SYS_setgroups = SYS_SETGROUPS32
- _SYS_clone3 = 435
- _SYS_faccessat2 = 439
- _SYS_fchmodat2 = 452
+ _SYS_setgroups = SYS_SETGROUPS32
+ _SYS_socket = 359
+ _SYS_socketpair = 360
+ _SYS_bind = 361
+ _SYS_connect = 362
+ _SYS_listen = 363
+ _SYS_accept4 = 364
+ _SYS_getsockopt = 365
+ _SYS_setsockopt = 366
+ _SYS_getsockname = 367
+ _SYS_getpeername = 368
+ _SYS_sendto = 369
+ _SYS_sendmsg = 370
+ _SYS_recvfrom = 371
+ _SYS_recvmsg = 372
+ _SYS_shutdown = 373
+ _SYS_clone3 = 435
+ _SYS_faccessat2 = 439
+ _SYS_fchmodat2 = 452
)
func setTimespec(sec, nsec int64) Timespec {
@@ -94,12 +109,11 @@
//sys Utime(path string, buf *Utimbuf) (err error)
//sys utimes(path string, times *[2]Timeval) (err error)
-// On x86 Linux, all the socket calls go through an extra indirection,
-// I think because the 5-register system call interface can't handle
-// the 6-argument calls like sendto and recvfrom. Instead the
-// arguments to the underlying system call are the number below
-// and a pointer to an array of uintptr. We hide the pointer in the
-// socketcall assembly to avoid allocation on every system call.
+// On x86 Linux before Linux 4.3, all the socket calls go through an
+// extra indirection. The arguments to the underlying system call are
+// the number below and a pointer to an array of uintptr. We hide the
+// pointer in the socketcall assembly to avoid allocation on every
+// fallback system call.
const (
// see linux/net.h
@@ -134,7 +148,15 @@
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
- fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ r0, _, e := Syscall6(_SYS_accept4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
if e != 0 {
err = e
}
@@ -142,7 +164,14 @@
}
func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getsockname, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -150,7 +179,14 @@
}
func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getpeername, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -158,7 +194,14 @@
}
func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
- _, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ _, _, e := RawSyscall6(_SYS_socketpair, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
if e != 0 {
err = e
}
@@ -166,7 +209,14 @@
}
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_bind, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -174,7 +224,14 @@
}
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_connect, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -182,7 +239,15 @@
}
func socket(domain int, typ int, proto int) (fd int, err error) {
- fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
+ r0, _, e := RawSyscall(_SYS_socket, uintptr(domain), uintptr(typ), uintptr(proto))
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
if e != 0 {
err = e
}
@@ -190,7 +255,14 @@
}
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
- _, e := socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ _, _, e := Syscall6(_SYS_getsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e != 0 {
err = e
}
@@ -198,7 +270,14 @@
}
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
- _, e := socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ _, _, e := Syscall6(_SYS_setsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
if e != 0 {
err = e
}
@@ -210,7 +289,15 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- n, e := socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ r0, _, e := Syscall6(_SYS_recvfrom, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
if e != 0 {
err = e
}
@@ -222,7 +309,14 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- _, e := socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ _, _, e := Syscall6(_SYS_sendto, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e != 0 {
err = e
}
@@ -230,7 +324,15 @@
}
func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_recvmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -238,7 +340,15 @@
}
func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_sendmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -246,7 +356,14 @@
}
func Listen(s int, n int) (err error) {
- _, e := socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_listen, uintptr(s), uintptr(n), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
if e != 0 {
err = e
}
@@ -254,7 +371,14 @@
}
func Shutdown(s, how int) (err error) {
- _, e := socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_shutdown, uintptr(s), uintptr(how), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
if e != 0 {
err = e
}
diff --git a/src/syscall/syscall_linux_s390x.go b/src/syscall/syscall_linux_s390x.go
index abff53c..e0888f6 100644
--- a/src/syscall/syscall_linux_s390x.go
+++ b/src/syscall/syscall_linux_s390x.go
@@ -7,10 +7,25 @@
import "unsafe"
const (
- _SYS_setgroups = SYS_SETGROUPS
- _SYS_clone3 = 435
- _SYS_faccessat2 = 439
- _SYS_fchmodat2 = 452
+ _SYS_setgroups = SYS_SETGROUPS
+ _SYS_socket = 359
+ _SYS_socketpair = 360
+ _SYS_bind = 361
+ _SYS_connect = 362
+ _SYS_listen = 363
+ _SYS_accept4 = 364
+ _SYS_getsockopt = 365
+ _SYS_setsockopt = 366
+ _SYS_getsockname = 367
+ _SYS_getpeername = 368
+ _SYS_sendto = 369
+ _SYS_sendmsg = 370
+ _SYS_recvfrom = 371
+ _SYS_recvmsg = 372
+ _SYS_shutdown = 373
+ _SYS_clone3 = 435
+ _SYS_faccessat2 = 439
+ _SYS_fchmodat2 = 452
)
//sys Dup2(oldfd int, newfd int) (err error)
@@ -82,10 +97,11 @@
return
}
-// On s390x Linux, all the socket calls go through an extra indirection.
-// The arguments to the underlying system call are the number below
-// and a pointer to an array of uintptr. We hide the pointer in the
-// socketcall assembly to avoid allocation on every system call.
+// On s390x Linux before Linux 4.3, all the socket calls go through an
+// extra indirection. The arguments to the underlying system call are
+// the number below and a pointer to an array of uintptr. We hide the
+// pointer in the socketcall assembly to avoid allocation on every
+// fallback system call.
const (
// see linux/net.h
@@ -120,7 +136,15 @@
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err Errno)
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
- fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ r0, _, e := Syscall6(_SYS_accept4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
if e != 0 {
err = e
}
@@ -128,7 +152,14 @@
}
func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getsockname, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -136,7 +167,14 @@
}
func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
- _, e := rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
+ _, _, e := RawSyscall(_SYS_getpeername, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e != 0 {
err = e
}
@@ -144,7 +182,14 @@
}
func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
- _, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ _, _, e := RawSyscall6(_SYS_socketpair, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
if e != 0 {
err = e
}
@@ -152,7 +197,14 @@
}
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_bind, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -160,7 +212,14 @@
}
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
- _, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
+ _, _, e := Syscall(_SYS_connect, uintptr(s), uintptr(addr), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e != 0 {
err = e
}
@@ -168,7 +227,15 @@
}
func socket(domain int, typ int, proto int) (fd int, err error) {
- fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
+ r0, _, e := RawSyscall(_SYS_socket, uintptr(domain), uintptr(typ), uintptr(proto))
+ if e != ENOSYS {
+ fd = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ fd, e = rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
if e != 0 {
err = e
}
@@ -176,7 +243,14 @@
}
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
- _, e := socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ _, _, e := Syscall6(_SYS_getsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e != 0 {
err = e
}
@@ -184,7 +258,14 @@
}
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
- _, e := socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ _, _, e := Syscall6(_SYS_setsockopt, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
if e != 0 {
err = e
}
@@ -196,7 +277,15 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- n, e := socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ r0, _, e := Syscall6(_SYS_recvfrom, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
if e != 0 {
err = e
}
@@ -208,7 +297,14 @@
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
- _, e := socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ _, _, e := Syscall6(_SYS_sendto, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e != 0 {
err = e
}
@@ -216,7 +312,15 @@
}
func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_recvmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -224,7 +328,15 @@
}
func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
- n, e := socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
+ r0, _, e := Syscall(_SYS_sendmsg, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
+ if e != ENOSYS {
+ n = int(r0)
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ n, e = socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
if e != 0 {
err = e
}
@@ -232,7 +344,14 @@
}
func Listen(s int, n int) (err error) {
- _, e := socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_listen, uintptr(s), uintptr(n), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
if e != 0 {
err = e
}
@@ -240,7 +359,14 @@
}
func Shutdown(s, how int) (err error) {
- _, e := socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
+ _, _, e := Syscall(_SYS_shutdown, uintptr(s), uintptr(how), 0)
+ if e != ENOSYS {
+ if e != 0 {
+ err = e
+ }
+ return
+ }
+ _, e = socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
if e != 0 {
err = e
}