]> Cypherpunks repositories - gostls13.git/commitdiff
net: windows/amd64 port
authorWei Guangjing <vcc.163@gmail.com>
Wed, 13 Jul 2011 19:44:21 +0000 (12:44 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 13 Jul 2011 19:44:21 +0000 (12:44 -0700)
R=rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/3790044

src/pkg/net/fd_windows.go
src/pkg/syscall/syscall_windows.go
src/pkg/syscall/zsyscall_windows_386.go
src/pkg/syscall/zsyscall_windows_amd64.go
src/pkg/syscall/ztypes_windows.go
src/pkg/syscall/ztypes_windows_386.go
src/pkg/syscall/ztypes_windows_amd64.go

index f727696740ff2cd4780e2304bbeb94f4bf5305d5..6ab9053348b749dea71c088c2a286c6e74284540 100644 (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
index 5b8143aac940e1839e590febc1470cd44aca7d3c..048c4fa436317b6fdb715f47d4e149bc29877e3b 100644 (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) {
index 350ad232adaf9419c64a4dda188cd7f4651c6c47..ccb63abe01c19124e4bb22b703d3ceb813e8fdab 100644 (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 {
index e7d09fbc2d03ad1896217e9119504fa9e7cbe491..af237e891b07fd9a2a2562c637744bb8c1f5fe76 100644 (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 {
index 1a264a405f9fa4597a2f3617ce1cce454872e384..2943df580c52020fe8f59b458725759c12ff4447 100644 (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
index d1008bd03c5e4023e73b4a289455f615f0f1db01..734ee6e0f0efea55abc0feb8e7917dc98b99cb70 100644 (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
+}
index d1008bd03c5e4023e73b4a289455f615f0f1db01..78aa55b2ee0ca49c8305bde4ad0210cc82fc1dcd 100644 (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
+}