diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2024-04-02 11:23:47 +0200 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-04-02 21:49:26 +0000 |
commit | e074fcc945da2ed2384d562425a7e15b24d15b55 (patch) | |
tree | 59c9d4038bb8ec8fdf6dd9a197588ac84005ea7b /src/net | |
parent | b6efc3b755b74147a3700ad51773b01fa68f76e8 (diff) | |
download | go-e074fcc945da2ed2384d562425a7e15b24d15b55.tar.gz go-e074fcc945da2ed2384d562425a7e15b24d15b55.zip |
internal/poll, net, os: remove poll.Splice syscall name return value
The sc return value of internal/poll.Splice is always set to the same
value "splice" in the error case and then passed to wrapSyscallError.
Move that value to the wrapSyscallError calls to simplify the code a
bit.
Change-Id: I98104d755da68ff9f301fabc43c2618fda21a175
Reviewed-on: https://go-review.googlesource.com/c/go/+/575655
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/splice_linux.go | 8 | ||||
-rw-r--r-- | src/net/splice_linux_test.go | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/net/splice_linux.go b/src/net/splice_linux.go index 9fc26b4c23..b62e8a722d 100644 --- a/src/net/splice_linux.go +++ b/src/net/splice_linux.go @@ -41,11 +41,11 @@ func spliceFrom(c *netFD, r io.Reader) (written int64, err error, handled bool) return 0, nil, false } - written, handled, sc, err := pollSplice(&c.pfd, &s.pfd, remain) + written, handled, err = pollSplice(&c.pfd, &s.pfd, remain) if lr != nil { lr.N -= written } - return written, wrapSyscallError(sc, err), handled + return written, wrapSyscallError("splice", err), handled } // spliceTo transfers data from c to w using the splice system call to minimize @@ -59,6 +59,6 @@ func spliceTo(w io.Writer, c *netFD) (written int64, err error, handled bool) { return } - written, handled, sc, err := pollSplice(&uc.fd.pfd, &c.pfd, 1<<63-1) - return written, wrapSyscallError(sc, err), handled + written, handled, err = pollSplice(&uc.fd.pfd, &c.pfd, 1<<63-1) + return written, wrapSyscallError("splice", err), handled } diff --git a/src/net/splice_linux_test.go b/src/net/splice_linux_test.go index 2edd744406..52efafa8c5 100644 --- a/src/net/splice_linux_test.go +++ b/src/net/splice_linux_test.go @@ -519,21 +519,20 @@ type spliceHook struct { written int64 handled bool - sc string err error - original func(dst, src *poll.FD, remain int64) (int64, bool, string, error) + original func(dst, src *poll.FD, remain int64) (int64, bool, error) } func (h *spliceHook) install() { h.original = pollSplice - pollSplice = func(dst, src *poll.FD, remain int64) (int64, bool, string, error) { + pollSplice = func(dst, src *poll.FD, remain int64) (int64, bool, error) { h.called = true h.dstfd = dst.Sysfd h.srcfd = src.Sysfd h.remain = remain - h.written, h.handled, h.sc, h.err = h.original(dst, src, remain) - return h.written, h.handled, h.sc, h.err + h.written, h.handled, h.err = h.original(dst, src, remain) + return h.written, h.handled, h.err } } |