aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-01-16 15:57:32 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-01-16 15:57:32 +0000
commit72d7151a721ce182f4a13e7e5a6f5ced2f468c17 (patch)
tree67d8317577cc1f51bb4135ce8e47ea58c8c69d5a /libgo/go
parented22611ae503ebea38011dcfc2fe75ebab97dcfc (diff)
downloadgcc-72d7151a721ce182f4a13e7e5a6f5ced2f468c17.zip
gcc-72d7151a721ce182f4a13e7e5a6f5ced2f468c17.tar.gz
gcc-72d7151a721ce182f4a13e7e5a6f5ced2f468c17.tar.bz2
net: Restore earlier Solaris-specific version of setKeepAlivePeriod.
The version from the master repository seems to be appropriate for OpenSolaris but not for Solaris itself. Solaris 11.2 proper does not define TCP_KEEPIDLE or TCP_KEEPINTVL. From-SVN: r219749
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/net/tcpsockopt_solaris.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/libgo/go/net/tcpsockopt_solaris.go b/libgo/go/net/tcpsockopt_solaris.go
new file mode 100644
index 0000000..eaab6b6
--- /dev/null
+++ b/libgo/go/net/tcpsockopt_solaris.go
@@ -0,0 +1,27 @@
+// Copyright 2013 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.
+
+// TCP socket options for solaris
+
+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 seconds so round to next highest second.
+ d += (time.Second - time.Nanosecond)
+ secs := int(d.Seconds())
+
+ return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.SO_KEEPALIVE, secs))
+}