Repository navigation
[IO_URING] Accept immutable buffers for unregistered writes - #402
Open
rksharma-owg wants to merge 4 commits into
Open
rksharma-owg wants to merge 4 commits into
rksharma-owg wants to merge 4 commits into
Conversation
FranzBusch
reviewed
Oct 6, 2026
Comment on lines
+388
to
+398
| @inlinable public static func write( | ||
| _ buffer: UnsafeRawBufferPointer, | ||
| into file: IORing.RegisteredFile, | ||
| at offset: UInt64 = 0, | ||
| context: UInt64 = 0 | ||
| ) -> IORing.Request { | ||
| // The shared request encoder uses a mutable pointer, but writes only read the buffer. | ||
| write(UnsafeMutableRawBufferPointer(mutating: buffer), into: file, at: offset, context: context) | ||
| } | ||
|
|
||
| @inlinable public static func write( |
Member
There was a problem hiding this comment.
While we are here can we add doc comments to these methods. Also I am thinking that we should deprecate the other methods since they are just wrong. @jrflat WDYT about deprecating?
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.
IORing.Request.writerequired mutable buffers even though a write only reads from them. AddUnsafeRawBufferPointeroverloads for both ordinary file descriptors and registered file slots, retaining the existing mutable-buffer signatures and function references.The new overloads use the existing write request encoder. Their documentation explains buffer lifetime, offsets, completion context and partial writes. Regression tests check the resulting operation, descriptor, address, length, offset and context. A real io_uring pipe test writes an immutable buffer and verifies the received bytes.
Local Linux ARM64 Swift 6.4 validation passed: 81 XCTest cases and 7 Swift Testing tests, including real io_uring execution. The immutable-buffer tests fail to compile before the overloads are added. Mutable function references and inferred buffer-construction calls compile with the fix.
The cloud API breakage check passes against the refreshed target branch.
Fork preflight passed all 49 enabled jobs for
92481cc05652e561623eb32c1411d5d2e4b7fd4dagainst486d48c80fce32823218000cf8563d9b4bbbf4a9: Linux, macOS, Windows, FreeBSD, Android emulator tests, static Linux/Wasm SDK builds, ABI-stable macOS builds, CMake and applicable soundness/API checks. Standard container runs skip io_uring when unavailable; the separate kernel write/read-back job executed and passed. Upstream-disabled checks remain inapplicable.Fixes #400.