aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/net/tcpsockopt_solaris.go24
-rw-r--r--libgo/go/syscall/exec_bsd.go6
-rw-r--r--libgo/go/syscall/exec_linux.go11
-rw-r--r--libgo/go/syscall/exec_unix.go6
-rw-r--r--libgo/go/syscall/exec_unix_test.go2
-rw-r--r--libgo/go/syscall/libcall_bsd.go27
6 files changed, 44 insertions, 32 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))
}
diff --git a/libgo/go/syscall/exec_bsd.go b/libgo/go/syscall/exec_bsd.go
index f44e897f39b..9042ce263aa 100644
--- a/libgo/go/syscall/exec_bsd.go
+++ b/libgo/go/syscall/exec_bsd.go
@@ -102,11 +102,9 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
if sys.Foreground {
- pgrp := sys.Pgid
+ pgrp := Pid_t(sys.Pgid)
if pgrp == 0 {
- r1 = raw_getpid()
-
- pgrp = int(r1)
+ pgrp = raw_getpid()
}
// Place process group in foreground.
diff --git a/libgo/go/syscall/exec_linux.go b/libgo/go/syscall/exec_linux.go
index d9600a142ae..540efb3a6d8 100644
--- a/libgo/go/syscall/exec_linux.go
+++ b/libgo/go/syscall/exec_linux.go
@@ -171,14 +171,9 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
if sys.Foreground {
- pgrp := int32(sys.Pgid)
+ pgrp := Pid_t(sys.Pgid)
if pgrp == 0 {
- r1 = uintptr(raw_getpid())
- if err1 != 0 {
- goto childerror
- }
-
- pgrp = int32(r1)
+ pgrp = raw_getpid()
}
// Place process group in foreground.
@@ -236,7 +231,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// using SIGKILL.
r1 := raw_getppid()
if r1 != ppid {
- pid = raw_getpid()
+ pid := raw_getpid()
err1 = raw_kill(pid, sys.Pdeathsig)
if err1 != 0 {
goto childerror
diff --git a/libgo/go/syscall/exec_unix.go b/libgo/go/syscall/exec_unix.go
index 218d78cf146..d1927de9b4b 100644
--- a/libgo/go/syscall/exec_unix.go
+++ b/libgo/go/syscall/exec_unix.go
@@ -17,10 +17,10 @@ import (
//sysnb raw_fork() (pid Pid_t, err Errno)
//fork() Pid_t
-//sysnb raw_getpid() (pid int)
+//sysnb raw_getpid() (pid Pid_t)
//getpid() Pid_t
-//sysnb raw_getppid() (pid int)
+//sysnb raw_getppid() (pid Pid_t)
//getppid() Pid_t
//sysnb raw_setsid() (err Errno)
@@ -59,7 +59,7 @@ import (
//sysnb raw_dup2(oldfd int, newfd int) (err Errno)
//dup2(oldfd _C_int, newfd _C_int) _C_int
-//sysnb raw_kill(pid int, sig Signal) (err Errno)
+//sysnb raw_kill(pid Pid_t, sig Signal) (err Errno)
//kill(pid Pid_t, sig _C_int) _C_int
//sysnb raw_setgroups(size int, list unsafe.Pointer) (err Errno)
diff --git a/libgo/go/syscall/exec_unix_test.go b/libgo/go/syscall/exec_unix_test.go
index 9bb95c0f395..69c4a1f1798 100644
--- a/libgo/go/syscall/exec_unix_test.go
+++ b/libgo/go/syscall/exec_unix_test.go
@@ -169,7 +169,7 @@ func TestForeground(t *testing.T) {
t.Skipf("Can't test Foreground. Couldn't open /dev/tty: %s", err)
}
- fpgrp := 0
+ fpgrp := syscall.Pid_t(0)
errno := syscall.Ioctl(tty.Fd(), syscall.TIOCGPGRP, uintptr(unsafe.Pointer(&fpgrp)))
if errno != 0 {
diff --git a/libgo/go/syscall/libcall_bsd.go b/libgo/go/syscall/libcall_bsd.go
new file mode 100644
index 00000000000..4501f88ad48
--- /dev/null
+++ b/libgo/go/syscall/libcall_bsd.go
@@ -0,0 +1,27 @@
+// Copyright 2015 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.
+
+// BSD library calls.
+
+package syscall
+
+import "unsafe"
+
+//sys sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error)
+//sendfile(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t
+func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
+ if raceenabled {
+ raceReleaseMerge(unsafe.Pointer(&ioSync))
+ }
+ var soff Offset_t
+ var psoff *Offset_t
+ if offset != nil {
+ psoff = &soff
+ }
+ written, err = sendfile(outfd, infd, psoff, count)
+ if offset != nil {
+ *offset = int64(soff)
+ }
+ return
+}