This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Recent Go patch broke Solaris bootstrap


On Fri, Nov 8, 2013 at 4:01 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> The recent Go patch (couldn't find the submission on gcc-patches) broke
> Solaris bootstrap: on Solaris 10/x86 I get
>
> /vol/gcc/src/hg/trunk/local/libgo/go/net/tcpsockopt_unix.go:26:103: error: reference to undefined identifier 'syscall.TCP_KEEPINTVL'
>   err := os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, secs))
>                                                                                                        ^
> /vol/gcc/src/hg/trunk/local/libgo/go/net/tcpsockopt_unix.go:30:103: error: reference to undefined identifier 'syscall.TCP_KEEPIDLE'
>   return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, secs))
>                                                                                                        ^

I think this will be fixed by the appended patch.  Bootstrapped and
tested on x86_64-unknown-linux-gnu, not that that proves anything.
Committed to mainline.

Ian
diff -r 47a9c8a497d5 libgo/Makefile.am
--- a/libgo/Makefile.am	Mon Nov 11 13:20:11 2013 -0800
+++ b/libgo/Makefile.am	Mon Nov 11 13:23:07 2013 -0800
@@ -770,9 +770,13 @@
 if LIBGO_IS_DARWIN
 go_net_tcpsockopt_file = go/net/tcpsockopt_darwin.go
 else
+if LIBGO_IS_SOLARIS
+go_net_tcpsockopt_file = go/net/tcpsockopt_solaris.go
+else
 go_net_tcpsockopt_file =  go/net/tcpsockopt_unix.go
 endif
 endif
+endif
 
 go_net_files = \
 	go/net/cgo_unix.go \
diff -r 47a9c8a497d5 libgo/go/net/tcpsockopt_solaris.go
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgo/go/net/tcpsockopt_solaris.go	Mon Nov 11 13:23:07 2013 -0800
@@ -0,0 +1,25 @@
+// 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 net
+
+import (
+	"os"
+	"syscall"
+	"time"
+)
+
+// Set keep alive period.
+func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
+	if err := fd.incref(); err != nil {
+		return err
+	}
+	defer fd.decref()
+
+	// The kernel expects milliseconds so round to next highest millisecond.
+	d += (time.Millisecond - time.Nanosecond)
+	msecs := int(d.Nanoseconds() / time.Millisecond)
+
+	return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE_THRESHOLD, msecs))
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]