1
0
mirror of https://github.com/golang/go synced 2024-11-22 02:44:39 -07:00

net: windows/amd64 port

R=rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/3790044
This commit is contained in:
Wei Guangjing 2011-07-13 12:44:21 -07:00 committed by Russ Cox
parent 932db13e93
commit 350504559e
7 changed files with 40 additions and 23 deletions

View File

@ -493,7 +493,7 @@ func (fd *netFD) accept(toAddr func(syscall.Sockaddr) Addr) (nfd *netFD, err os.
}
// Inherit properties of the listening socket.
e = syscall.SetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_UPDATE_ACCEPT_CONTEXT, int(fd.sysfd))
e = syscall.Setsockopt(s, syscall.SOL_SOCKET, syscall.SO_UPDATE_ACCEPT_CONTEXT, (*byte)(unsafe.Pointer(&fd.sysfd)), int32(unsafe.Sizeof(fd.sysfd)))
if e != 0 {
closesocket(s)
return nil, err

View File

@ -594,7 +594,7 @@ func Socket(domain, typ, proto int) (fd Handle, errno int) {
func SetsockoptInt(fd Handle, level, opt int, value int) (errno int) {
v := int32(value)
return int(setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), int32(unsafe.Sizeof(v))))
return int(Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), int32(unsafe.Sizeof(v))))
}
func Bind(fd Handle, sa Sockaddr) (errno int) {

View File

@ -1076,7 +1076,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, errno int) {
return
}
func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) {
func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) {
r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
if int(r1) == -1 {
if e1 != 0 {

View File

@ -1076,7 +1076,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, errno int) {
return
}
func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) {
func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) {
r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
if int(r1) == -1 {
if e1 != 0 {

View File

@ -212,8 +212,8 @@ type SecurityAttributes struct {
}
type Overlapped struct {
Internal uint32
InternalHigh uint32
Internal uintptr
InternalHigh uintptr
Offset uint32
OffsetHigh uint32
HEvent Handle
@ -388,16 +388,6 @@ const (
WSASYS_STATUS_LEN = 128
)
type WSAData struct {
Version uint16
HighVersion uint16
Description [WSADESCRIPTION_LEN + 1]byte
SystemStatus [WSASYS_STATUS_LEN + 1]byte
MaxSockets uint16
MaxUdpDg uint16
VendorInfo *byte
}
type WSABuf struct {
Len uint32
Buf *byte
@ -453,13 +443,6 @@ type Hostent struct {
AddrList **byte
}
type Servent struct {
Name *byte
Aliases **byte
Port uint16
Proto *byte
}
const (
DNS_TYPE_A = 0x0001
DNS_TYPE_NS = 0x0002

View File

@ -3,3 +3,20 @@
// license that can be found in the LICENSE file.
package syscall
type WSAData struct {
Version uint16
HighVersion uint16
Description [WSADESCRIPTION_LEN + 1]byte
SystemStatus [WSASYS_STATUS_LEN + 1]byte
MaxSockets uint16
MaxUdpDg uint16
VendorInfo *byte
}
type Servent struct {
Name *byte
Aliases **byte
Port uint16
Proto *byte
}

View File

@ -3,3 +3,20 @@
// license that can be found in the LICENSE file.
package syscall
type WSAData struct {
Version uint16
HighVersion uint16
MaxSockets uint16
MaxUdpDg uint16
VendorInfo *byte
Description [WSADESCRIPTION_LEN + 1]byte
SystemStatus [WSASYS_STATUS_LEN + 1]byte
}
type Servent struct {
Name *byte
Aliases **byte
Proto *byte
Port uint16
}