summaryrefslogtreecommitdiffstats
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-11 21:21:50 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-11 21:21:50 +0000
commitaf06d5b48b40d093cc5771b2f2edaa82ba3b7fd7 (patch)
tree4f7025cbbf5334e10ed41103edbe6ce63bd5b86d /libgo
parente6c705fbf686673722554bfa5474511e0db53776 (diff)
downloadppe42-gcc-af06d5b48b40d093cc5771b2f2edaa82ba3b7fd7.tar.gz
ppe42-gcc-af06d5b48b40d093cc5771b2f2edaa82ba3b7fd7.zip
mksysinfo, net: Always define F_DUPFD_CLOEXEC.
For Solaris and CentOS portability. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204687 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/net/fd_unix.go2
-rwxr-xr-xlibgo/mksysinfo.sh5
2 files changed, 6 insertions, 1 deletions
diff --git a/libgo/go/net/fd_unix.go b/libgo/go/net/fd_unix.go
index 9ed4f753649..4911ab0abe3 100644
--- a/libgo/go/net/fd_unix.go
+++ b/libgo/go/net/fd_unix.go
@@ -410,7 +410,7 @@ func (fd *netFD) accept(toAddr func(syscall.Sockaddr) Addr) (netfd *netFD, err e
var tryDupCloexec = int32(1)
func dupCloseOnExec(fd int) (newfd int, err error) {
- if atomic.LoadInt32(&tryDupCloexec) == 1 {
+ if atomic.LoadInt32(&tryDupCloexec) == 1 && syscall.F_DUPFD_CLOEXEC != 0 {
r0, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_DUPFD_CLOEXEC, 0)
if runtime.GOOS == "darwin" && e1 == syscall.EBADF {
// On OS X 10.6 and below (but we only support
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index a1713df9b57..025729ccad1 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -220,6 +220,11 @@ if ! grep '^const O_CLOEXEC' ${OUT} >/dev/null 2>&1; then
echo "const O_CLOEXEC = 0" >> ${OUT}
fi
+# The os package requires F_DUPFD_CLOEXEC to be defined.
+if ! grep '^const F_DUPFD_CLOEXEC' ${OUT} >/dev/null 2>&1; then
+ echo "const F_DUPFD_CLOEXEC = 0" >> ${OUT}
+fi
+
# These flags can be lost on i386 GNU/Linux when using
# -D_FILE_OFFSET_BITS=64, because we see "#define F_SETLK F_SETLK64"
# before we see the definition of F_SETLK64.
OpenPOWER on IntegriCloud