aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/osutil
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-06-26 13:43:20 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-06-26 13:43:20 +0200
commitb3ae0111960b82fc4f94563918e2bc8e0a16af3b (patch)
tree2472d4a59baaf84cf8a2ff4d80258e6a93543bcd /pkg/osutil
parent8ebb2147d9eff47da10054ede27c5e399617bc0b (diff)
pkg/osutil: port to darwin
Diffstat (limited to 'pkg/osutil')
-rw-r--r--pkg/osutil/osutil.go4
-rw-r--r--pkg/osutil/osutil_linux.go15
-rw-r--r--pkg/osutil/osutil_stub.go13
3 files changed, 29 insertions, 3 deletions
diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go
index 3d5a18a67..b63fffc1e 100644
--- a/pkg/osutil/osutil.go
+++ b/pkg/osutil/osutil.go
@@ -52,9 +52,7 @@ func LongPipe() (io.ReadCloser, io.WriteCloser, error) {
if err != nil {
return nil, nil, fmt.Errorf("failed to create pipe: %v", err)
}
- for sz := 128 << 10; sz <= 2<<20; sz *= 2 {
- syscall.Syscall(syscall.SYS_FCNTL, w.Fd(), syscall.F_SETPIPE_SZ, uintptr(sz))
- }
+ prolongPipe(r, w)
return r, w, err
}
diff --git a/pkg/osutil/osutil_linux.go b/pkg/osutil/osutil_linux.go
new file mode 100644
index 000000000..320f06fc3
--- /dev/null
+++ b/pkg/osutil/osutil_linux.go
@@ -0,0 +1,15 @@
+// Copyright 2017 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+package osutil
+
+import (
+ "os"
+ "syscall"
+)
+
+func prolongPipe(r, w *os.File) {
+ for sz := 128 << 10; sz <= 2<<20; sz *= 2 {
+ syscall.Syscall(syscall.SYS_FCNTL, w.Fd(), syscall.F_SETPIPE_SZ, uintptr(sz))
+ }
+}
diff --git a/pkg/osutil/osutil_stub.go b/pkg/osutil/osutil_stub.go
new file mode 100644
index 000000000..74ce2cc31
--- /dev/null
+++ b/pkg/osutil/osutil_stub.go
@@ -0,0 +1,13 @@
+// Copyright 2017 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+// +build !linux
+
+package osutil
+
+import (
+ "os"
+)
+
+func prolongPipe(r, w *os.File) {
+}