diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-06-26 13:43:20 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-06-26 13:43:20 +0200 |
| commit | b3ae0111960b82fc4f94563918e2bc8e0a16af3b (patch) | |
| tree | 2472d4a59baaf84cf8a2ff4d80258e6a93543bcd /pkg/osutil | |
| parent | 8ebb2147d9eff47da10054ede27c5e399617bc0b (diff) | |
pkg/osutil: port to darwin
Diffstat (limited to 'pkg/osutil')
| -rw-r--r-- | pkg/osutil/osutil.go | 4 | ||||
| -rw-r--r-- | pkg/osutil/osutil_linux.go | 15 | ||||
| -rw-r--r-- | pkg/osutil/osutil_stub.go | 13 |
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) { +} |
