diff options
| author | Damien Neil <dneil@google.com> | 2024-10-25 11:47:53 -0700 |
|---|---|---|
| committer | Damien Neil <dneil@google.com> | 2024-10-28 23:45:31 +0000 |
| commit | 98b3be702b05e8fc071fececf7bf44f078bf032f (patch) | |
| tree | 6dd003824218c5120d94be622030f7cdddf07248 /src/database/sql | |
| parent | cd54b9bae94b36f67869ef174cbb432bc4012183 (diff) | |
| download | go-98b3be702b05e8fc071fececf7bf44f078bf032f.tar.xz | |
os, net, internal/poll: combine unix sendfile implementations
The internal/poll/sendfile_{bsd,linux,solaris}.go implementations
have more in common than not. Combine into a single sendfile_unix.go.
The net and os packages have redundant code dealing with sendfile
quirks on non-Linux Unix systems, such as the need to determine the
size of the source file before sending. Move the common code into
internal/poll.
Remove some obsolete or incorrect behaviors:
Drop the maximum sendfile chunk size. If we ask the kernel
to copy more data than it is willing to send, it'll copy up to
its limit.
There was a comment in net/sendfile_unix_alt.go indicating that
copying more bytes than a file contains results in the kernel
looping back to the start of the file. I am unable to replicate
this behavior anywhere. Dropped the comment, the workarounds,
and added a test covering this case.
Darwin, Dragonfly, and FreeBSD all support copying the entire
contents of a file by passing 0 for the copy limit.
Take advantage of this.
Change-Id: I9f707ac7a27c165020ae02a6b5bb8f6f16f3c530
Reviewed-on: https://go-review.googlesource.com/c/go/+/621416
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/database/sql')
0 files changed, 0 insertions, 0 deletions
