From b3ae0111960b82fc4f94563918e2bc8e0a16af3b Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 26 Jun 2017 13:43:20 +0200 Subject: pkg/osutil: port to darwin --- pkg/osutil/osutil.go | 4 +--- pkg/osutil/osutil_linux.go | 15 +++++++++++++++ pkg/osutil/osutil_stub.go | 13 +++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 pkg/osutil/osutil_linux.go create mode 100644 pkg/osutil/osutil_stub.go (limited to 'pkg/osutil') 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) { +} -- cgit mrf-deployment