From d75a52659825e75fff6158388dddc6a5b04f9ba5 Mon Sep 17 00:00:00 2001 From: Samuel Tan Date: Wed, 14 Dec 2016 10:38:57 -0800 Subject: [PATCH] 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 --- unix/syscall_linux_amd64.go | 5 ----- unix/syscall_linux_amd64_gc.go | 13 +++++++++++++ unix/syscall_unix.go | 5 ----- unix/syscall_unix_gc.go | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 unix/syscall_linux_amd64_gc.go create mode 100644 unix/syscall_unix_gc.go diff --git a/unix/syscall_linux_amd64.go b/unix/syscall_linux_amd64.go index 18911c2d..9516a3fd 100644 --- a/unix/syscall_linux_amd64.go +++ b/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 { diff --git a/unix/syscall_linux_amd64_gc.go b/unix/syscall_linux_amd64_gc.go new file mode 100644 index 00000000..21a4946b --- /dev/null +++ b/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) diff --git a/unix/syscall_unix.go b/unix/syscall_unix.go index b46b2502..8a5237de 100644 --- a/unix/syscall_unix.go +++ b/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 { diff --git a/unix/syscall_unix_gc.go b/unix/syscall_unix_gc.go new file mode 100644 index 00000000..4cb8e8ed --- /dev/null +++ b/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)