Allow specifying R/W flags for reads and writes on tokio_uring::fs::File#326
Open
ChrysoliteAzalea wants to merge 1 commit intotokio-rs:masterfrom
Open
Allow specifying R/W flags for reads and writes on tokio_uring::fs::File#326ChrysoliteAzalea wants to merge 1 commit intotokio-rs:masterfrom
tokio_uring::fs::File#326ChrysoliteAzalea wants to merge 1 commit intotokio-rs:masterfrom
Conversation
Author
|
Example of writing to stdout with io_uring: |
|
It looks too destructive to change all the public API and I believe tokio-uring has similar mental model not to expose I/O flag but provides higher abstraction like Stream. |
Author
It does not change already-present pubic API, it adds new methods to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello everyone! I propose adding methods to
tokio_uring::fs::Filethat would allow passingRWF_flags to read and write operations.Explanation
Along with ordinary I/O system calls (
read()/write()), vectored I/O (readv()/writev()), positional I/O (pread()/pwrite()) and vectored positional I/O (preadv()/pwritev()), Linux also has file I/O system callspreadv2()andpwritev2()that, in addition topreadv()/pwritev(), allow passing read/write flags, that affect individual I/O operations. Examples of such flags areRWF_NOWAIT(for reading, which means if it has to perform some possibly-blocking operations, it instead should fail withEAGAIN) andRWF_APPEND(perform an atomic append even if the file is opened withoutO_APPENDflag). io_uring also allows passing these flags in submissions.Possible benefits
This would be useful for implementing writing to stdout and stderr using io_uring. Stdout and/or stderr may point to regular files, but don't have the
O_APPENDflag set, which means, if several processes have their stdout or stderr redirected to such file, they would have to specifyRWF_APPENDwhen writing to such file to avoid overwriting each other's data.