Skip to content

proposal: os: support copy_file_range for SectionReader #73399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hanwen-flow opened this issue Apr 16, 2025 · 1 comment
Open

proposal: os: support copy_file_range for SectionReader #73399

hanwen-flow opened this issue Apr 16, 2025 · 1 comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Milestone

Comments

@hanwen-flow
Copy link

Proposal Details

Writing to a file from an io.SectionReader backed by a file could
use copy_file_range(2).

The machinery for this mostly exists: SectionReader.Outer() gives
access to the underlying *os.File and offset. Then, the offset
should be passed into unix.CopyFileRange. After the call completes,
the number of bytes (or the updated offset) can be passed to
SectionReader.Seek.

The only missing piece is that CopyFileRange in internal/poll
does not accept offset arguments. Is this something that can be
changed, and if yes, does it require a formal proposal?

For reference, this is similar to
#61727.

@gopherbot gopherbot added this to the Proposal milestone Apr 16, 2025
@gabyhelp
Copy link

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gabyhelp gabyhelp added the LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool label Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LibraryProposal Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool Proposal
Projects
None yet
Development

No branches or pull requests

3 participants