Browse Source

x/sys/unix: move gccgo redeclared functions to separate files

These functions are redeclared in gccgo builds, so move them
to separate files with the "!gccgo" build constraint.

Fixes golang/go#18312

Change-Id: I868cfb77fc394e5e96cee78af0f3abf43db6082a
Reviewed-on: https://go-review.googlesource.com/34379
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Samuel Tan 9 years ago
parent
commit
d75a526598
4 changed files with 28 additions and 10 deletions
  1. 0 5
      unix/syscall_linux_amd64.go
  2. 13 0
      unix/syscall_linux_amd64_gc.go
  3. 0 5
      unix/syscall_unix.go
  4. 15 0
      unix/syscall_unix_gc.go

+ 0 - 5
unix/syscall_linux_amd64.go

@@ -6,8 +6,6 @@
 
 package unix
 
-import "syscall"
-
 //sys	Dup2(oldfd int, newfd int) (err error)
 //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
 //sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
@@ -63,9 +61,6 @@ import "syscall"
 //sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
 //sys	mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
 
-//go:noescape
-func gettimeofday(tv *Timeval) (err syscall.Errno)
-
 func Gettimeofday(tv *Timeval) (err error) {
 	errno := gettimeofday(tv)
 	if errno != 0 {

+ 13 - 0
unix/syscall_linux_amd64_gc.go

@@ -0,0 +1,13 @@
+// Copyright 2016 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 amd64,linux
+// +build !gccgo
+
+package unix
+
+import "syscall"
+
+//go:noescape
+func gettimeofday(tv *Timeval) (err syscall.Errno)

+ 0 - 5
unix/syscall_unix.go

@@ -49,11 +49,6 @@ func errnoErr(e syscall.Errno) error {
 	return e
 }
 
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
-
 // Mmap manager, for use by operating system-specific implementations.
 
 type mmapper struct {

+ 15 - 0
unix/syscall_unix_gc.go

@@ -0,0 +1,15 @@
+// Copyright 2016 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 netbsd openbsd solaris
+// +build !gccgo
+
+package unix
+
+import "syscall"
+
+func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
+func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
+func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno)
+func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)