]> Cypherpunks repositories - gostls13.git/commitdiff
os: define wrapSyscallError only on linux
authorTobias Klauser <tklauser@distanz.ch>
Mon, 1 Apr 2024 22:10:47 +0000 (00:10 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 2 Apr 2024 15:01:40 +0000 (15:01 +0000)
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>

src/os/error_posix.go [deleted file]
src/os/zero_copy_linux.go

diff --git a/src/os/error_posix.go b/src/os/error_posix.go
deleted file mode 100644 (file)
index b159c03..0000000
+++ /dev/null
@@ -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
-}
index 7c45aefeee8621b4585f39998558ab9316da19d7..d9cf18c22f0fcb8c1d4ae286714483643b7360db 100644 (file)
@@ -16,6 +16,15 @@ var (
        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) {
        pfd, network := getPollFDAndNetwork(w)
        // TODO(panjf2000): same as File.spliceToFile.