diff options
| author | Mikio Hara <mikioh.mikioh@gmail.com> | 2015-07-02 15:02:03 +0900 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2015-07-02 16:11:03 +0000 |
| commit | 2a0fc9e70e26cefc1877efa00e85c2e82fbec7e3 (patch) | |
| tree | d2e183e4d19a9a4e1c6fa55fef3dbef2ce43a1d6 /src/internal | |
| parent | 85938714e9619e1db064ad11a94ac987d6c24ac0 (diff) | |
| download | go-2a0fc9e70e26cefc1877efa00e85c2e82fbec7e3.tar.xz | |
Revert "net, internal/syscall/unix: add SocketConn, SocketPacketConn"
This reverts commit 6f7961da28232c609f7c51b3bed7f15db7dd33e1.
Russ suggests changing the frozon syscall package and obviously it's a
better solution. Perhaps he will also let me know the way how to get the
project owners to agree later.
Fixes #11492.
Change-Id: I98f9f366b72b85db54b4acfc3a604b62fb6d783c
Reviewed-on: https://go-review.googlesource.com/11854
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/internal')
| -rw-r--r-- | src/internal/syscall/unix/socket.go | 39 | ||||
| -rw-r--r-- | src/internal/syscall/unix/socket_linux_386.go | 67 | ||||
| -rw-r--r-- | src/internal/syscall/unix/socket_linux_386.s | 11 | ||||
| -rw-r--r-- | src/internal/syscall/unix/socket_stub.go | 25 | ||||
| -rw-r--r-- | src/internal/syscall/unix/socket_unix.go | 59 |
5 files changed, 0 insertions, 201 deletions
diff --git a/src/internal/syscall/unix/socket.go b/src/internal/syscall/unix/socket.go deleted file mode 100644 index d7a9b9cb1d..0000000000 --- a/src/internal/syscall/unix/socket.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris - -package unix - -// Getsockname copies the binary encoding of the current address for s -// into addr. -func Getsockname(s int, addr []byte) error { - return getsockname(s, addr) -} - -// Getpeername copies the binary encoding of the peer address for s -// into addr. -func Getpeername(s int, addr []byte) error { - return getpeername(s, addr) -} - -var emptyPayload uintptr - -// Recvfrom receives a message from s, copying the message into b. -// The socket address addr must be large enough for storing the source -// address of the message. -// Flags must be operation control flags or 0. -// It retunrs the number of bytes copied into b. -func Recvfrom(s int, b []byte, flags int, addr []byte) (int, error) { - return recvfrom(s, b, flags, addr) -} - -// Sendto sends a message to the socket address addr, copying the -// message from b. -// The socket address addr must be suitable for s. -// Flags must be operation control flags or 0. -// It retunrs the number of bytes copied from b. -func Sendto(s int, b []byte, flags int, addr []byte) (int, error) { - return sendto(s, b, flags, addr) -} diff --git a/src/internal/syscall/unix/socket_linux_386.go b/src/internal/syscall/unix/socket_linux_386.go deleted file mode 100644 index 47105e0b1d..0000000000 --- a/src/internal/syscall/unix/socket_linux_386.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -import ( - "syscall" - "unsafe" -) - -const ( - sysGETSOCKNAME = 0x6 - sysGETPEERNAME = 0x7 - sysSENDTO = 0xb - sysRECVFROM = 0xc -) - -func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) -func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) - -func getsockname(s int, addr []byte) error { - l := uint32(len(addr)) - _, errno := rawsocketcall(sysGETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(&addr[0])), uintptr(unsafe.Pointer(&l)), 0, 0, 0) - if errno != 0 { - return error(errno) - } - return nil -} - -func getpeername(s int, addr []byte) error { - l := uint32(len(addr)) - _, errno := rawsocketcall(sysGETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(&addr[0])), uintptr(unsafe.Pointer(&l)), 0, 0, 0) - if errno != 0 { - return error(errno) - } - return nil -} - -func recvfrom(s int, b []byte, flags int, from []byte) (int, error) { - var p unsafe.Pointer - if len(b) > 0 { - p = unsafe.Pointer(&b[0]) - } else { - p = unsafe.Pointer(&emptyPayload) - } - l := uint32(len(from)) - n, errno := socketcall(sysRECVFROM, uintptr(s), uintptr(p), uintptr(len(b)), uintptr(flags), uintptr(unsafe.Pointer(&from[0])), uintptr(unsafe.Pointer(&l))) - if errno != 0 { - return int(n), error(errno) - } - return int(n), nil -} - -func sendto(s int, b []byte, flags int, to []byte) (int, error) { - var p unsafe.Pointer - if len(b) > 0 { - p = unsafe.Pointer(&b[0]) - } else { - p = unsafe.Pointer(&emptyPayload) - } - n, errno := socketcall(sysSENDTO, uintptr(s), uintptr(p), uintptr(len(b)), uintptr(flags), uintptr(unsafe.Pointer(&to[0])), uintptr(len(to))) - if errno != 0 { - return int(n), error(errno) - } - return int(n), nil -} diff --git a/src/internal/syscall/unix/socket_linux_386.s b/src/internal/syscall/unix/socket_linux_386.s deleted file mode 100644 index 48e2094db5..0000000000 --- a/src/internal/syscall/unix/socket_linux_386.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -TEXT ·socketcall(SB),NOSPLIT,$0-36 - JMP syscall·socketcall(SB) - -TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 - JMP syscall·socketcall(SB) diff --git a/src/internal/syscall/unix/socket_stub.go b/src/internal/syscall/unix/socket_stub.go deleted file mode 100644 index 1c89ed1820..0000000000 --- a/src/internal/syscall/unix/socket_stub.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build nacl solaris - -package unix - -import "syscall" - -func getsockname(s int, addr []byte) error { - return syscall.EOPNOTSUPP -} - -func getpeername(s int, addr []byte) error { - return syscall.EOPNOTSUPP -} - -func recvfrom(s int, b []byte, flags int, from []byte) (int, error) { - return 0, syscall.EOPNOTSUPP -} - -func sendto(s int, b []byte, flags int, to []byte) (int, error) { - return 0, syscall.EOPNOTSUPP -} diff --git a/src/internal/syscall/unix/socket_unix.go b/src/internal/syscall/unix/socket_unix.go deleted file mode 100644 index a769bb38b6..0000000000 --- a/src/internal/syscall/unix/socket_unix.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux,!386 netbsd openbsd - -package unix - -import ( - "syscall" - "unsafe" -) - -func getsockname(s int, addr []byte) error { - l := uint32(len(addr)) - _, _, errno := syscall.RawSyscall(syscall.SYS_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(&addr[0])), uintptr(unsafe.Pointer(&l))) - if errno != 0 { - return error(errno) - } - return nil -} - -func getpeername(s int, addr []byte) error { - l := uint32(len(addr)) - _, _, errno := syscall.RawSyscall(syscall.SYS_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(&addr[0])), uintptr(unsafe.Pointer(&l))) - if errno != 0 { - return error(errno) - } - return nil -} - -func recvfrom(s int, b []byte, flags int, from []byte) (int, error) { - var p unsafe.Pointer - if len(b) > 0 { - p = unsafe.Pointer(&b[0]) - } else { - p = unsafe.Pointer(&emptyPayload) - } - l := uint32(len(from)) - n, _, errno := syscall.Syscall6(syscall.SYS_RECVFROM, uintptr(s), uintptr(p), uintptr(len(b)), uintptr(flags), uintptr(unsafe.Pointer(&from[0])), uintptr(unsafe.Pointer(&l))) - if errno != 0 { - return int(n), error(errno) - } - return int(n), nil -} - -func sendto(s int, b []byte, flags int, to []byte) (int, error) { - var p unsafe.Pointer - if len(b) > 0 { - p = unsafe.Pointer(&b[0]) - } else { - p = unsafe.Pointer(&emptyPayload) - } - n, _, errno := syscall.Syscall6(syscall.SYS_SENDTO, uintptr(s), uintptr(p), uintptr(len(b)), uintptr(flags), uintptr(unsafe.Pointer(&to[0])), uintptr(len(to))) - if errno != 0 { - return int(n), error(errno) - } - return int(n), nil -} |
