]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: clean up windows a bit
authorRuss Cox <rsc@golang.org>
Wed, 27 Jan 2021 16:39:48 +0000 (11:39 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 19 Feb 2021 00:04:30 +0000 (00:04 +0000)
The files being deleted contain no code.
They exist because back when we used Makefiles
that listed all the Go sources to be compiled, we wrote
patterns like syscall_$GOOS_$GOARCH.go,
and it was easier to create dummy empty files
than introduce conditionals to not look for that
file on Windows.

Now that we have the go command instead,
we don't need those dummy files.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: Ie0066d1dd2bf09802c74c6a496276e8c593e4bc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/288815
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/syscall/syscall_windows.go
src/syscall/syscall_windows_386.go [deleted file]
src/syscall/syscall_windows_amd64.go [deleted file]
src/syscall/zerrors_windows_386.go [deleted file]
src/syscall/zerrors_windows_amd64.go [deleted file]
src/syscall/zsysnum_windows_386.go [deleted file]
src/syscall/zsysnum_windows_amd64.go [deleted file]

index ba69133d819db3b969082d7fdf9592d34bf22dc6..4a576486d11d6db18ec526b3e19b391f7719680b 100644 (file)
@@ -414,19 +414,22 @@ const ptrSize = unsafe.Sizeof(uintptr(0))
 // See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365542(v=vs.85).aspx
 func setFilePointerEx(handle Handle, distToMove int64, newFilePointer *int64, whence uint32) error {
        var e1 Errno
-       switch runtime.GOARCH {
-       default:
-               panic("unsupported architecture")
-       case "amd64":
+       if unsafe.Sizeof(uintptr(0)) == 8 {
                _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 4, uintptr(handle), uintptr(distToMove), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0, 0)
-       case "386":
-               // distToMove is a LARGE_INTEGER:
-               // https://msdn.microsoft.com/en-us/library/windows/desktop/aa383713(v=vs.85).aspx
-               _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 5, uintptr(handle), uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0)
-       case "arm":
-               // distToMove must be 8-byte aligned per ARM calling convention
-               // https://msdn.microsoft.com/en-us/library/dn736986.aspx#Anchor_7
-               _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 6, uintptr(handle), 0, uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence))
+       } else {
+               // Different 32-bit systems disgaree about whether distToMove starts 8-byte aligned.
+               switch runtime.GOARCH {
+               default:
+                       panic("unsupported 32-bit architecture")
+               case "386":
+                       // distToMove is a LARGE_INTEGER:
+                       // https://msdn.microsoft.com/en-us/library/windows/desktop/aa383713(v=vs.85).aspx
+                       _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 5, uintptr(handle), uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0)
+               case "arm":
+                       // distToMove must be 8-byte aligned per ARM calling convention
+                       // https://msdn.microsoft.com/en-us/library/dn736986.aspx#Anchor_7
+                       _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 6, uintptr(handle), 0, uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence))
+               }
        }
        if e1 != 0 {
                return errnoErr(e1)
diff --git a/src/syscall/syscall_windows_386.go b/src/syscall/syscall_windows_386.go
deleted file mode 100644 (file)
index e82b540..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2009 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 syscall
diff --git a/src/syscall/syscall_windows_amd64.go b/src/syscall/syscall_windows_amd64.go
deleted file mode 100644 (file)
index e82b540..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2009 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 syscall
diff --git a/src/syscall/zerrors_windows_386.go b/src/syscall/zerrors_windows_386.go
deleted file mode 100644 (file)
index 8bc5b6b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2011 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 syscall
diff --git a/src/syscall/zerrors_windows_amd64.go b/src/syscall/zerrors_windows_amd64.go
deleted file mode 100644 (file)
index 8bc5b6b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2011 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 syscall
diff --git a/src/syscall/zsysnum_windows_386.go b/src/syscall/zsysnum_windows_386.go
deleted file mode 100644 (file)
index 36bf065..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// nothing to see here
-
-package syscall
diff --git a/src/syscall/zsysnum_windows_amd64.go b/src/syscall/zsysnum_windows_amd64.go
deleted file mode 100644 (file)
index 36bf065..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// nothing to see here
-
-package syscall