mirror of
https://github.com/golang/go
synced 2024-10-14 11:53:56 +00:00
os: define wrapSyscallError only on linux
wrapSyscallError by now is only used on linux in the methods defined in os/zero_copy_linux.go. Move the definition there. Change-Id: I0ca5749adaac44e8d095b8452458b647f595d3c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/575595 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
parent
88b1d6115a
commit
e3ec1ca17e
|
@ -1,18 +0,0 @@
|
||||||
// Copyright 2017 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.
|
|
||||||
|
|
||||||
//go:build unix || (js && wasm) || wasip1 || windows
|
|
||||||
|
|
||||||
package os
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
// wrapSyscallError takes an error and a syscall name. If the error is
|
|
||||||
// a syscall.Errno, it wraps it in an os.SyscallError using the syscall name.
|
|
||||||
func wrapSyscallError(name string, err error) error {
|
|
||||||
if _, ok := err.(syscall.Errno); ok {
|
|
||||||
err = NewSyscallError(name, err)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
|
@ -16,6 +16,15 @@ var (
|
||||||
pollSendFile = poll.SendFile
|
pollSendFile = poll.SendFile
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// wrapSyscallError takes an error and a syscall name. If the error is
|
||||||
|
// a syscall.Errno, it wraps it in an os.SyscallError using the syscall name.
|
||||||
|
func wrapSyscallError(name string, err error) error {
|
||||||
|
if _, ok := err.(syscall.Errno); ok {
|
||||||
|
err = NewSyscallError(name, err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (f *File) writeTo(w io.Writer) (written int64, handled bool, err error) {
|
func (f *File) writeTo(w io.Writer) (written int64, handled bool, err error) {
|
||||||
pfd, network := getPollFDAndNetwork(w)
|
pfd, network := getPollFDAndNetwork(w)
|
||||||
// TODO(panjf2000): same as File.spliceToFile.
|
// TODO(panjf2000): same as File.spliceToFile.
|
||||||
|
|
Loading…
Reference in a new issue