diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-10-07 17:22:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-10-07 17:22:08 +0000 |
commit | 0786e1fe8688691332e6c4f9aab82956546073c5 (patch) | |
tree | dfed1026d5397402b85feef171a5e9c2c1ff4dae /libgo/go/net | |
parent | 919e06d3f59f9770be5e3968159a46f6c077c9f8 (diff) | |
download | gcc-0786e1fe8688691332e6c4f9aab82956546073c5.zip gcc-0786e1fe8688691332e6c4f9aab82956546073c5.tar.gz gcc-0786e1fe8688691332e6c4f9aab82956546073c5.tar.bz2 |
re PR go/67874 (fd_unix.go does not build when there is fcntl64 and no fcntl syscall)
PR go/67874
net, runtime: Call C library fcntl function rather than syscall.Syscall.
Not all systems define a fcntl syscall; some only have fcntl64.
Fixes GCC PR go/67874.
Reviewed-on: https://go-review.googlesource.com/15497
From-SVN: r228576
Diffstat (limited to 'libgo/go/net')
-rw-r--r-- | libgo/go/net/fd_unix.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libgo/go/net/fd_unix.go b/libgo/go/net/fd_unix.go index 7a97fae..45a4eb8 100644 --- a/libgo/go/net/fd_unix.go +++ b/libgo/go/net/fd_unix.go @@ -442,13 +442,21 @@ func (fd *netFD) accept() (netfd *netFD, err error) { return netfd, nil } +// Use a helper function to call fcntl. This is defined in C in +// libgo/runtime. +//extern __go_fcntl_uintptr +func fcntl(uintptr, uintptr, uintptr) (uintptr, uintptr) + // tryDupCloexec indicates whether F_DUPFD_CLOEXEC should be used. // If the kernel doesn't support it, this is set to 0. var tryDupCloexec = int32(1) func dupCloseOnExec(fd int) (newfd int, err error) { if atomic.LoadInt32(&tryDupCloexec) == 1 && syscall.F_DUPFD_CLOEXEC != 0 { - r0, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_DUPFD_CLOEXEC, 0) + syscall.Entersyscall() + r0, errno := fcntl(uintptr(fd), syscall.F_DUPFD_CLOEXEC, 0) + syscall.Exitsyscall() + e1 := syscall.Errno(errno) if runtime.GOOS == "darwin" && e1 == syscall.EBADF { // On OS X 10.6 and below (but we only support // >= 10.6), F_DUPFD_CLOEXEC is unsupported |