diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-11-06 19:15:45 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-11-06 19:15:45 +0000 |
commit | 9da92cbda9b73a179f031d4d362b5374f9fcaa09 (patch) | |
tree | 3c89e373addb3b0abe146e923891ebbdfc72ced5 /libgo/go/net | |
parent | e78d485eb842bfe4209cec9da3725f5ef6a74abb (diff) | |
download | gcc-9da92cbda9b73a179f031d4d362b5374f9fcaa09.tar.gz |
libgo: Solaris portability fixes.
Only build net/hook_cloexec.go on GNU/Linux and FreeBSD, because those
are the only systems with accept4.
Add syscall/libcall_bsd.go to define sendfile for *BSD and Solaris.
Revert tcpsockopt_solaris.go back to the earlier version, so that it
works on Solaris 10.
Always pass the address of a Pid_t value to TIOCGPGRP and TIOCSPGRP.
Include <unistd.h> in runtime/go-varargs.c.
Reviewed-on: https://go-review.googlesource.com/16719
From-SVN: r229880
Diffstat (limited to 'libgo/go/net')
-rw-r--r-- | libgo/go/net/tcpsockopt_solaris.go | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/libgo/go/net/tcpsockopt_solaris.go b/libgo/go/net/tcpsockopt_solaris.go index 31f5df0526f..eaab6b6787b 100644 --- a/libgo/go/net/tcpsockopt_solaris.go +++ b/libgo/go/net/tcpsockopt_solaris.go @@ -1,7 +1,9 @@ -// Copyright 2015 The Go Authors. All rights reserved. +// 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 ( @@ -10,26 +12,16 @@ import ( "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 / time.Millisecond) - // Normally we'd do - // syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, secs) - // here, but we can't because Solaris does not have TCP_KEEPINTVL. - // Solaris has TCP_KEEPALIVE_ABORT_THRESHOLD, but it's not the same - // thing, it refers to the total time until aborting (not between - // probes), and it uses an exponential backoff algorithm instead of - // waiting the same time between probes. We can't hope for the best - // and do it anyway, like on Darwin, because Solaris might eventually - // allocate a constant with a different meaning for the value of - // TCP_KEEPINTVL on illumos. + // 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.TCP_KEEPALIVE_THRESHOLD, msecs)) + return os.NewSyscallError("setsockopt", syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.SO_KEEPALIVE, secs)) } |