Skip to content
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

Rewrite internals #142

Merged
merged 346 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
346 commits
Select commit Hold shift + click to select a range
04a80b5
Mark sq::Queue::resubmit and submit_with_id as unsafe
Thomasdezeeuw Nov 3, 2024
78f7c1a
Allow multiple futures in op_futures! macro
Thomasdezeeuw Nov 5, 2024
69e2a8e
Update comment
Thomasdezeeuw Nov 5, 2024
2a9548c
Add boolean to OpResult::Again
Thomasdezeeuw Nov 5, 2024
1c128ef
Remove old io_uring code
Thomasdezeeuw Nov 5, 2024
6386a36
Drop drop_by_ptr
Thomasdezeeuw Nov 5, 2024
5d747fb
Set descriptor specific flags
Thomasdezeeuw Nov 5, 2024
c2d2d1b
Add cq::OperationState to support multishot operations
Thomasdezeeuw Nov 5, 2024
ddd25a8
Add sq::Queue::submit_multishot
Thomasdezeeuw Nov 5, 2024
26e6a39
Move unused_macros to debug_detail
Thomasdezeeuw Nov 5, 2024
c9017ab
Remove allow(unused_imports)
Thomasdezeeuw Nov 5, 2024
570d576
Add back Std{in,out,err}
Thomasdezeeuw Nov 6, 2024
06090f8
Move sys::io files to its own directories
Thomasdezeeuw Nov 6, 2024
7736508
Make NO_COMPLETION_ID unique
Thomasdezeeuw Nov 30, 2024
5a77e57
Make is_send_and_sync for Direct Linux only
Thomasdezeeuw Nov 30, 2024
cdc02d3
Add more read tests
Thomasdezeeuw Nov 30, 2024
398e368
Add general public type for Config
Thomasdezeeuw Nov 30, 2024
f65ad4d
Split queued_operations config from submission queue size
Thomasdezeeuw Nov 30, 2024
16a4eba
Remove Unpin requirement from Operation future
Thomasdezeeuw Dec 1, 2024
788b407
Add back AsyncFd::read_n
Thomasdezeeuw Dec 1, 2024
4b55dbf
Add Io(Mut)Slice types
Thomasdezeeuw Dec 1, 2024
7d723b8
Add const generic in op_future!
Thomasdezeeuw Dec 1, 2024
2877652
Enable buffer group assertions
Thomasdezeeuw Dec 1, 2024
3048c01
Port back part of the cancel module
Thomasdezeeuw Dec 15, 2024
57c0306
Add back read_vectored(_at)
Thomasdezeeuw Dec 15, 2024
d563cc5
Don't implement Unpin for ReadVectored
Thomasdezeeuw Dec 15, 2024
83d952f
Move State creation into a new function
Thomasdezeeuw Dec 15, 2024
f5d4176
Add back Extract trait
Thomasdezeeuw Dec 15, 2024
756038a
Export Cancel trait at the root of crate
Thomasdezeeuw Dec 15, 2024
6e3940f
Add back Ring::enable
Thomasdezeeuw Dec 15, 2024
78f6307
Add AsyncFd::try_clone
Thomasdezeeuw Dec 15, 2024
babbed4
Add back AsyncFd::to_direct_descriptor
Thomasdezeeuw Dec 15, 2024
6f429e5
Add back AsyncFd::to_file_descriptor
Thomasdezeeuw Dec 15, 2024
121787d
Remove io_uring::Op::check_result
Thomasdezeeuw Dec 15, 2024
cec7ede
Move sys::io modules
Thomasdezeeuw Dec 15, 2024
914b313
Improve AsyncFd docs
Thomasdezeeuw Dec 15, 2024
c2c1ad4
Improve all_bufs macro
Thomasdezeeuw Dec 15, 2024
1c813d3
Move poll op::State to method
Thomasdezeeuw Dec 15, 2024
0706998
Rename sys::CancelAll to CancelAllOp
Thomasdezeeuw Dec 15, 2024
8bbcb8a
Rename sys::Read to ReadOp
Thomasdezeeuw Dec 15, 2024
37d8c13
Rename sys::ReadVectored to ReadVectoredOp
Thomasdezeeuw Dec 15, 2024
0c0eb65
Prefix Operation and Op with Fd
Thomasdezeeuw Dec 15, 2024
8f5828c
Add skeleton for Operation type
Thomasdezeeuw Dec 15, 2024
726894a
Add Op trait not-fd version of FdOp
Thomasdezeeuw Dec 15, 2024
28e0f92
Add op::State::poll
Thomasdezeeuw Dec 15, 2024
86a35f0
Rename op_future to fd_operation
Thomasdezeeuw Dec 15, 2024
2914f16
Ordering of types in op module
Thomasdezeeuw Dec 15, 2024
79f2681
Add must_use to all fd_operation Futures
Thomasdezeeuw Dec 15, 2024
9b4b960
Add io_uring and kqueue Op traits
Thomasdezeeuw Dec 15, 2024
0dcf94c
Add operation macro
Thomasdezeeuw Dec 15, 2024
43ac3ea
Add back Cancel::cancel
Thomasdezeeuw Dec 15, 2024
644e5f8
Implement Cancel for all FdOperations
Thomasdezeeuw Dec 15, 2024
c19e538
Add FIXME
Thomasdezeeuw Dec 15, 2024
1520acb
Start adding back fs module
Thomasdezeeuw Dec 15, 2024
0149ab9
Add back fs::OpenOptions and fs::Open
Thomasdezeeuw Dec 15, 2024
ab9d6cb
Pass a reference to SubmissionQueue in Op::map_result
Thomasdezeeuw Dec 15, 2024
85a7e96
Add back some more fs types
Thomasdezeeuw Dec 15, 2024
b4eb336
Add more API to QueueFull error
Thomasdezeeuw Dec 27, 2024
523a955
Add back ReadBufPool types
Thomasdezeeuw Dec 27, 2024
9778965
Add mem module back
Thomasdezeeuw Dec 27, 2024
c15218d
Fix and ignore various Clippy lints
Thomasdezeeuw Dec 27, 2024
b5f4713
Rename sys::mem::Advise to AdviseOp
Thomasdezeeuw Dec 27, 2024
e83d78f
Add back AsyncFd::sync_{all,data}
Thomasdezeeuw Dec 27, 2024
0f9ca8c
Add back AsyncFd::metadata
Thomasdezeeuw Dec 27, 2024
030152e
Add back AsyncFd::advise
Thomasdezeeuw Dec 27, 2024
cb37976
Add back AsyncFd::allocate
Thomasdezeeuw Dec 27, 2024
5e1aee1
Add back AsyncFd::truncate
Thomasdezeeuw Dec 27, 2024
0ed389e
Add back fs::create_dir
Thomasdezeeuw Dec 27, 2024
185aa42
Add back fs::rename
Thomasdezeeuw Dec 27, 2024
944ff9a
Add back fs::remove_{file,dir}
Thomasdezeeuw Dec 27, 2024
34c51b5
Match ordering in fs module
Thomasdezeeuw Dec 27, 2024
cc73170
Export fd::{ToDirect, ToFd}
Thomasdezeeuw Dec 27, 2024
c06d404
Fix two doc links
Thomasdezeeuw Dec 27, 2024
d847164
Implement Copy for RemoveFlag and SyncDataFlag
Thomasdezeeuw Dec 27, 2024
88c3c64
Add back AsyncFd::read_n_vectored(_at)
Thomasdezeeuw Dec 27, 2024
56da87e
Add back AsyncFd::write(_at)
Thomasdezeeuw Dec 27, 2024
92791fe
Add FdOpExtract trait
Thomasdezeeuw Dec 27, 2024
8e1c1d1
Implement FdOpExtract for WriteOp
Thomasdezeeuw Dec 27, 2024
656f390
Support implementing Extract in fd_operation!
Thomasdezeeuw Dec 27, 2024
5d799e0
Implement Extract for io::Write
Thomasdezeeuw Dec 27, 2024
5711bc2
Add back AsyncFd::write_all
Thomasdezeeuw Dec 27, 2024
f12c4f7
Support Extract method in operation! macro
Thomasdezeeuw Dec 27, 2024
f3f939d
Implement Extract for fs::CreateDir
Thomasdezeeuw Dec 27, 2024
17cccd2
Implement Extract for fs::Rename
Thomasdezeeuw Dec 27, 2024
272e599
Implement Extract for fs::Delete
Thomasdezeeuw Dec 27, 2024
07e0d72
Implement Extract for fs::Open
Thomasdezeeuw Dec 27, 2024
8369ef7
Remove io_uring::Submission methods
Thomasdezeeuw Dec 27, 2024
71db84a
Add back AsyncFd::write_vectored(_at)
Thomasdezeeuw Dec 27, 2024
6e51a54
Add back AsyncFd::write_all_vectored(_at)
Thomasdezeeuw Dec 27, 2024
7d769dc
Add back AsyncFd::splice*
Thomasdezeeuw Dec 27, 2024
f243983
Add back AsyncFd::close
Thomasdezeeuw Dec 27, 2024
78af9f9
add back process:wait
Thomasdezeeuw Dec 28, 2024
873372d
Add back process::Signals
Thomasdezeeuw Dec 28, 2024
8071eb6
Always intralink Future in (fd_)operation! macro
Thomasdezeeuw Dec 28, 2024
ddf1c7f
Refact op module
Thomasdezeeuw Dec 28, 2024
981abad
Implement Cancel for operation! macro
Thomasdezeeuw Dec 28, 2024
e462cd6
Implement Cancel for various io Futures
Thomasdezeeuw Dec 28, 2024
f6064e4
Merge operation and fd_operation macros
Thomasdezeeuw Dec 28, 2024
ad58b0f
Use UnsafeCell in StatOp
Thomasdezeeuw Dec 28, 2024
e7670a1
Fix and silence various Clippy lints
Thomasdezeeuw Dec 28, 2024
fc573a3
Fix various doc links
Thomasdezeeuw Dec 28, 2024
7502b62
Add sq::Queue::queue(_mulitshot)
Thomasdezeeuw Dec 28, 2024
d111fc8
Use level 1 header for Examples
Thomasdezeeuw Dec 29, 2024
0a60c66
Add back net::socket
Thomasdezeeuw Dec 29, 2024
a7c4a12
Add android cfgs
Thomasdezeeuw Dec 29, 2024
f14bdaf
Add back SocketAddress trait and implementations
Thomasdezeeuw Dec 29, 2024
bd724cf
Rewrite SocketAddress trait
Thomasdezeeuw Dec 29, 2024
1b15a1a
Add back AsyncFd::connect
Thomasdezeeuw Dec 29, 2024
af81e87
Add back AsyncFd::send(_zc)
Thomasdezeeuw Dec 29, 2024
026509c
Add back AsyncFd::recv
Thomasdezeeuw Dec 29, 2024
4d4d898
Add back AsyncFd::recv_n
Thomasdezeeuw Dec 29, 2024
9765827
Remove double UnsafeCell
Thomasdezeeuw Dec 30, 2024
1c9e953
Remove fmt::Debug trait bounds
Thomasdezeeuw Dec 30, 2024
4caea42
Add sq::Queue::cancel
Thomasdezeeuw Dec 30, 2024
1917e1b
Implement DropWake for more types
Thomasdezeeuw Dec 30, 2024
08b84d0
Wrap all I/O buffers in a Buffer type
Thomasdezeeuw Dec 30, 2024
02e51d4
Implement DropWake for Buffer
Thomasdezeeuw Dec 30, 2024
f289680
Remove unused DropWake implementations
Thomasdezeeuw Dec 30, 2024
1352e26
Remove (Fd)Op::Resources to be DropWake
Thomasdezeeuw Dec 30, 2024
eb81855
Cancel in progress operations if their Futures are dropped
Thomasdezeeuw Dec 30, 2024
a720817
Rename SocketAddress::as_storage to into_storage
Thomasdezeeuw Dec 30, 2024
88e7909
Fix & ignore more Clippy lints
Thomasdezeeuw Dec 30, 2024
93ca721
Remove test example
Thomasdezeeuw Dec 30, 2024
a645ac9
Add getrandom test dependency
Thomasdezeeuw Dec 30, 2024
8ef8c13
Rename Config::_build to build_sys
Thomasdezeeuw Dec 30, 2024
9ddddf6
Update Clippy lints
Thomasdezeeuw Dec 30, 2024
2bb002f
Fix Clippy lints
Thomasdezeeuw Dec 30, 2024
e44eb0a
Set Rust version to 1.84
Thomasdezeeuw Dec 30, 2024
0c3fbfb
Use ptr::from_{ref,mut} everywhere
Thomasdezeeuw Dec 30, 2024
05fa7c6
Change CancelOperationOp arguments
Thomasdezeeuw Dec 30, 2024
6a24c8d
Reuse cancel::operation in Submissions::cancel
Thomasdezeeuw Dec 30, 2024
08d4193
Manually implement CancelOperation
Thomasdezeeuw Dec 30, 2024
9629163
Rename AsyncFd::owned_fd to fd_ref
Thomasdezeeuw Dec 30, 2024
d3bdad9
Remove unimplemented code
Thomasdezeeuw Dec 30, 2024
fd25651
Remove SOCKET_URING_OP_* constant from build.rs
Thomasdezeeuw Dec 30, 2024
493c074
Update to binggen v0.71
Thomasdezeeuw Dec 30, 2024
9d0217a
Remove reference to delete kqueue modules
Thomasdezeeuw Dec 30, 2024
f643369
Update io_uring headers
Thomasdezeeuw Dec 30, 2024
fe4dbd6
Make Future impl optional in new_operation!
Thomasdezeeuw Dec 31, 2024
950ac71
Rename with Extract to impl Extract
Thomasdezeeuw Dec 31, 2024
8383216
Implement DropWake for ReadBufPool
Thomasdezeeuw Dec 31, 2024
2dd4794
Add fd_iter_operation! macro
Thomasdezeeuw Dec 31, 2024
174749f
Add back AsyncFd::multishot_recv
Thomasdezeeuw Dec 31, 2024
f686351
Add back AsyncFd::send_all
Thomasdezeeuw Dec 31, 2024
36614b4
Make trait bound optional in operation macros
Thomasdezeeuw Dec 31, 2024
c0c25ac
Add back AsyncFd::socket_option
Thomasdezeeuw Dec 31, 2024
47ee968
Add back AsyncFd::set_socket_option
Thomasdezeeuw Dec 31, 2024
63f8071
Fix optional trait bound in new_operation! macro
Thomasdezeeuw Dec 31, 2024
1a43d93
Add back AsyncFd::shutdown
Thomasdezeeuw Dec 31, 2024
7c7685e
Add AsyncFd reference to FdOp::map_ok
Thomasdezeeuw Dec 31, 2024
a8bf5f9
Add back AsyncFd::accept
Thomasdezeeuw Dec 31, 2024
a41bd1d
Remove SubmissionQueue as resource for To{Direct,Fd}
Thomasdezeeuw Dec 31, 2024
038a304
Remove DropWake impl for SubmissionQueue
Thomasdezeeuw Dec 31, 2024
388dec8
Add back AsyncFd::multishot_accept(4)
Thomasdezeeuw Dec 31, 2024
c8ecd39
Add back AsyncFd::recv_vectored
Thomasdezeeuw Dec 31, 2024
da95039
Add back AsyncFd::recv_n_vectored
Thomasdezeeuw Dec 31, 2024
26c7474
Move filling of msghdr to io_uring code
Thomasdezeeuw Dec 31, 2024
a66d47d
Allow multiple generic is operation macros
Thomasdezeeuw Dec 31, 2024
9e44501
Add back AsyncFd::recv_from
Thomasdezeeuw Dec 31, 2024
ee1ebbc
Move iovecs to heap allocation in RecvVectoredOp
Thomasdezeeuw Dec 31, 2024
79949fa
Add back AsyncFd::recv_from_vectored
Thomasdezeeuw Dec 31, 2024
47a99cc
Add fill_recvmsg_submission
Thomasdezeeuw Dec 31, 2024
54ba90a
Remove PhantomPinned from various io_uring net ops
Thomasdezeeuw Dec 31, 2024
b1a338a
Order send calls after recv calls
Thomasdezeeuw Dec 31, 2024
eef364e
Add back AsyncFd::send_vectored
Thomasdezeeuw Dec 31, 2024
ae3157c
Add back AsyncFd::send_vectored_zc
Thomasdezeeuw Dec 31, 2024
5486475
Add AsyncFd::send_all_vectored(_zc)
Thomasdezeeuw Dec 31, 2024
1cae6c5
Add Address to SendOp
Thomasdezeeuw Dec 31, 2024
dee06f4
Add AsyncFd::send_to(_zc)
Thomasdezeeuw Dec 31, 2024
baf2ef1
Add back AsyncFd::send_to_vectored(_zc)
Thomasdezeeuw Dec 31, 2024
bfa894d
Fix Clippy lints
Thomasdezeeuw Dec 31, 2024
2b6c346
Add back poll module
Thomasdezeeuw Dec 31, 2024
d9066e7
Add poll::oneshot_poll
Thomasdezeeuw Dec 31, 2024
5c60033
Add iter_operation! macro
Thomasdezeeuw Dec 31, 2024
1d8b758
Add back multishot_poll
Thomasdezeeuw Dec 31, 2024
d21b4eb
Fix doc link in poll module docs
Thomasdezeeuw Dec 31, 2024
8cd213c
Make poll_next public
Thomasdezeeuw Dec 31, 2024
009efd0
Add msg module
Thomasdezeeuw Dec 31, 2024
4c660ae
Add msg_listener
Thomasdezeeuw Dec 31, 2024
d6fc715
Add try_send_msg
Thomasdezeeuw Dec 31, 2024
6680fdf
Add back send_msg
Thomasdezeeuw Dec 31, 2024
ca7e83f
Fix Clippy lints
Thomasdezeeuw Dec 31, 2024
2d29fd8
Use correct submit for AsyncIter operations
Thomasdezeeuw Dec 31, 2024
4c5bb64
Remove unused code
Thomasdezeeuw Dec 31, 2024
40d4535
Check queue space waking blocked futures
Thomasdezeeuw Dec 31, 2024
2107c59
Add AsyncFd::send_all_zc
Thomasdezeeuw Jan 1, 2025
81a7047
Use correct submission and completion sizes
Thomasdezeeuw Jan 1, 2025
94cffc9
Update HTTP client example
Thomasdezeeuw Jan 1, 2025
e471284
Move setting of Descriptor flags to Drop impl
Thomasdezeeuw Jan 1, 2025
1514af5
Return AsyncFd in Extract impl for fs::Open
Thomasdezeeuw Jan 1, 2025
294aff9
Fix AsyncFd::to_direct_descriptor
Thomasdezeeuw Jan 1, 2025
3cf9b7f
Properly close direct descriptors
Thomasdezeeuw Jan 1, 2025
178bfe0
Remove unused lifetime
Thomasdezeeuw Jan 1, 2025
038dad5
Fix async fd fs test compiling
Thomasdezeeuw Jan 1, 2025
3c32f11
Heap allocate iovecs in {Read,Write}VectoredOp
Thomasdezeeuw Jan 1, 2025
ad2087c
Update net tests
Thomasdezeeuw Jan 1, 2025
ee92026
Remove connect_extractor
Thomasdezeeuw Jan 1, 2025
4fab261
Update async_fd io tests
Thomasdezeeuw Jan 1, 2025
023437b
Update ring tests to new API
Thomasdezeeuw Jan 1, 2025
6e00dad
Update async fd I/O tests' testing buffers
Thomasdezeeuw Jan 1, 2025
39d4ef4
Fix async fd net tests
Thomasdezeeuw Jan 1, 2025
5347490
Add MsgHeader wrapper types
Thomasdezeeuw Jan 1, 2025
555ff2e
Ignore Clippy lint
Thomasdezeeuw Jan 1, 2025
998f48b
Fix wake_blocked_futures index out of bounds
Thomasdezeeuw Jan 1, 2025
efc89c7
Fix debug assert in IoSlice::set_len
Thomasdezeeuw Jan 1, 2025
c1ede69
Add SendToOp
Thomasdezeeuw Jan 2, 2025
eafe7fa
Fix incorrect boolean for notification completions
Thomasdezeeuw Jan 2, 2025
85699d4
Use correct pointer cast
Thomasdezeeuw Jan 2, 2025
7cbf73e
Don't print entire SubmissionQueue in fmt::Debug of AsyncFd
Thomasdezeeuw Jan 2, 2025
0774789
Fix updating state for multishot operations
Thomasdezeeuw Jan 3, 2025
2bba743
Improve logging of completion events
Thomasdezeeuw Jan 3, 2025
3df009c
Properly cancel operations
Thomasdezeeuw Jan 3, 2025
08e2a12
Only use IORING_CQE_F_MORE as indication of more completions
Thomasdezeeuw Jan 3, 2025
cff81e1
Inline Completion methods
Thomasdezeeuw Jan 3, 2025
927717a
Remove const N from fill_recvmsg_submission
Thomasdezeeuw Jan 3, 2025
38fd3cc
Simplify MsgHeader pointer creation
Thomasdezeeuw Jan 3, 2025
f191be6
Properly handle ReadBufPool in AsyncFd::recv_from
Thomasdezeeuw Jan 3, 2025
c543ca5
Remove unused import
Thomasdezeeuw Jan 3, 2025
c9dfaf3
Update test to new cancel API
Thomasdezeeuw Jan 3, 2025
745dee2
Use correct type in waitid system call
Thomasdezeeuw Jan 3, 2025
e158ad9
Remove wake_ring_before_poll_nop test
Thomasdezeeuw Jan 3, 2025
b507399
Reduce the time is_polling is set
Thomasdezeeuw Jan 4, 2025
5c2ba7d
Pass is_polling Submission::{add, cancel}
Thomasdezeeuw Jan 4, 2025
1c6e5b0
Don't rename io_uring/kqueue to sys
Thomasdezeeuw Jan 4, 2025
9b291ec
Rename all crate::sys imports to io_uring
Thomasdezeeuw Jan 4, 2025
cd7bf49
Rename all crate::sys imports to kqueue
Thomasdezeeuw Jan 4, 2025
ba27285
Return None if AsyncIter is cancelled
Thomasdezeeuw Jan 4, 2025
5ea2051
Update task::Waker between calls to poll
Thomasdezeeuw Jan 4, 2025
04c8935
Remove invalid assertions
Thomasdezeeuw Jan 4, 2025
54e7ce2
Fix Clippy warnings
Thomasdezeeuw Jan 4, 2025
d5b062a
Update license year
Thomasdezeeuw Jan 4, 2025
e7bbb41
Add back Signals::to_direct_descriptor
Thomasdezeeuw Jan 4, 2025
25e6ab5
Don't return Boxed signal info
Thomasdezeeuw Jan 4, 2025
66ea45c
DRY the Drop implementation for (Fd)Operation
Thomasdezeeuw Jan 4, 2025
18a8783
Add back Signals::receive_signals
Thomasdezeeuw Jan 4, 2025
6934823
Add process::ReceiveSignals::into_inner
Thomasdezeeuw Jan 4, 2025
6afbd98
Implement Unpin for AsyncFd
Thomasdezeeuw Jan 4, 2025
19e01e3
Update signal tests to new API
Thomasdezeeuw Jan 4, 2025
8b3329c
Add preliminary changelog for v0.3
Thomasdezeeuw Jan 4, 2025
b5ce3f1
Update Makefile
Thomasdezeeuw Jan 4, 2025
847b7df
Fix Clippy warning
Thomasdezeeuw Jan 4, 2025
765b840
Switch to using Ubuntu 24.04 on CI
Thomasdezeeuw Jan 4, 2025
740d379
Disable testing on stable on CI
Thomasdezeeuw Jan 4, 2025
40c6ee5
Use fs::open_file in tests
Thomasdezeeuw Jan 4, 2025
274f6f9
Remove various TODOs
Thomasdezeeuw Jan 4, 2025
077c945
Properly drop op::State in ReceiveSignals::into_inner
Thomasdezeeuw Jan 5, 2025
2f1a908
Enable CI on stable again
Thomasdezeeuw Jan 10, 2025
3e422b0
Increase MSRV to 1.85
Thomasdezeeuw Jan 25, 2025
4832b9a
Disable stable CI
Thomasdezeeuw Jan 25, 2025
13b9318
Ignore missing-const-for-fn
Thomasdezeeuw Jan 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ permissions:

jobs:
Test:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
if: false # Enable once Rust 1.85 is released.
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@1.85
- name: Run Tests
run: cargo test
- name: Run Tests (release build)
run: cargo test --release
Nightly:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
Expand All @@ -37,7 +38,7 @@ jobs:
- name: Run Tests (nightly feature, release build)
run: cargo test --features nightly --release
Clippy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
Expand All @@ -47,15 +48,15 @@ jobs:
- name: Run Clippy
run: make clippy
Docs:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Check docs
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
Rustfmt:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
Expand All @@ -65,7 +66,7 @@ jobs:
- name: Check formatting
run: cargo fmt --all -- --check
Sanitizer:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5
strategy:
fail-fast: false
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# v0.3.0 (unreleased)

* Complete rewrite of the internals in an attempt to make it easier to port.
* The methods on `Config` are now implementation specific.
* Removed the `AsFd` implementation for `Ring` as that might not always be
possible to provide.
* The `net::SocketAddress` is now implemented for the socket address types for
in the standard library, not in libc.
* `net::Connect` no longer implements `Extract` as all socket address types in
the library are `Copy`.
* The `BufSlice` and `BufMutSlice` types now use `IoSlice` and `IoMutSlice` as
wrapper around `libc::iovec`.
* The `msg` module now uses the `MsgData` type as type for message data, instead
of `u32` (though `MsgData` is also `u32`).
* `process::ReceiveSignals` is now a proper `AsyncIter`.

# v0.2.2

* Fix possible overflow in ReadBuf::release
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[package]
name = "a10"
description = "A10 is an io_uring library."
version = "0.2.2"
version = "0.3.0"
publish = false # In development.
authors = ["Thomas de Zeeuw <[email protected]>"]
license = "MIT"
documentation = "https://docs.rs/a10"
Expand All @@ -11,6 +12,7 @@ keywords = ["io_uring", "io", "async", "non-blocking"]
categories = ["asynchronous"]
include = ["/Cargo.toml", "/src/**/*.rs", "/tests/**/*.rs", "/README.md", "/LICENSE"]
edition = "2021"
rust-version = "1.85"

[features]
default = []
Expand All @@ -25,6 +27,7 @@ log = { version = "0.4.21", default-features = false, features = ["kv_

[dev-dependencies]
std-logger = { version = "0.5.3", default-features = false }
getrandom = { version = "0.2.15", default-features = false }

[[test]]
name = "signals"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2021-2024 Thomas de Zeeuw
Copyright (C) 2021-2025 Thomas de Zeeuw


Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ check:
# Disabled lints:
# * `doc-markdown`: has some annoying false positives.
# * `equatable-if-let`: strongly disagree with this lint.
# * `missing-const-for-fn`: has false positives.
# * `missing-errors-doc`, `missing-panics-doc`: not worth it.
# * `must-use-candidate`: too many bad suggestions.
# * `needless-lifetimes`: lifetimes are additional docs.
# * `option-if-let-else`: don't want to introduce more closures.
# * `redundant-pub-crate`: useless lint.
# * `single-match-else`: prefer match statements over if statements.
# * `use-self`: strongly disagree.
# TODO: resolve `cast-possible-truncation` errors.
# TODO: resolve `manual-c-str-listerals`, `ref-as-ptr` and `inspect_err` once
# the related features are a little older (1.77, 1.76 and 1.75).
# TODO: resolve the lints after the empty line.
lint: clippy
clippy:
cargo clippy --all-features --workspace -- \
Expand All @@ -50,24 +49,23 @@ clippy:
--deny clippy::cargo \
--allow clippy::doc-markdown \
--allow clippy::equatable-if-let \
--allow clippy::manual-c-str-literals \
--allow clippy::missing-const-for-fn \
--allow clippy::missing-errors-doc \
--allow clippy::missing-panics-doc \
--allow clippy::must-use-candidate \
--allow clippy::needless-lifetimes \
--allow clippy::new-without-default \
--allow clippy::option-if-let-else \
--allow clippy::redundant-pub-crate \
--allow clippy::ref-as-ptr \
--allow clippy::single-match-else \
--allow clippy::use-self \
--allow clippy::manual-inspect \
\
--allow clippy::cast-possible-truncation \
--allow clippy::cast-possible-wrap \
--allow clippy::cast-sign-loss \

doc:
cargo doc
cargo doc --all-features

doc_private:
cargo doc --document-private-items
Expand Down
27 changes: 5 additions & 22 deletions examples/http_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::net::{SocketAddr, SocketAddrV4};
use std::{env, io, mem, str};
use std::net::SocketAddr;
use std::{env, io, str};

use a10::net::socket;
use a10::{AsyncFd, Ring, SubmissionQueue};
Expand All @@ -22,13 +22,8 @@ fn main() -> io::Result<()> {

// Get an IPv4 address for the domain (using blocking I/O).
let address = std::net::ToSocketAddrs::to_socket_addrs(&addr_host)?
.filter(SocketAddr::is_ipv4)
.next()
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "failed to lookup ip"))?;
let address = match address {
SocketAddr::V4(address) => address,
SocketAddr::V6(_) => unreachable!(),
};

// Create our future that makes the request.
let request_future = request(ring.submission_queue().clone(), &host, address);
Expand All @@ -50,7 +45,7 @@ fn main() -> io::Result<()> {
}

/// Make a HTTP GET request to `address`.
async fn request(sq: SubmissionQueue, host: &str, address: SocketAddrV4) -> io::Result<Vec<u8>> {
async fn request(sq: SubmissionQueue, host: &str, address: SocketAddr) -> io::Result<Vec<u8>> {
// Create a new TCP, IPv4 socket.
let domain = libc::AF_INET;
let r#type = libc::SOCK_STREAM | libc::SOCK_CLOEXEC;
Expand All @@ -59,14 +54,13 @@ async fn request(sq: SubmissionQueue, host: &str, address: SocketAddrV4) -> io::
let socket: AsyncFd = socket(sq, domain, r#type, protocol, flags).await?;

// Connect.
let addr = to_sockaddr_storage(address);
socket.connect(addr).await?;
socket.connect(address).await?;

// Send a HTTP GET / request to the socket.
let host = host.split_once(':').map(|(h, _)| h).unwrap_or(host);
let version = env!("CARGO_PKG_VERSION");
let request = format!("GET / HTTP/1.1\r\nHost: {host}\r\nUser-Agent: A10-example/{version}\r\nAccept: */*\r\n\r\n");
socket.send(request, 0).await?;
socket.send_all(request, 0).await?;

// Receiving the response.
let recv_buf = socket.recv(Vec::with_capacity(8192), 0).await?;
Expand All @@ -77,14 +71,3 @@ async fn request(sq: SubmissionQueue, host: &str, address: SocketAddrV4) -> io::

Ok(recv_buf)
}

fn to_sockaddr_storage(addr: SocketAddrV4) -> libc::sockaddr_in {
// SAFETY: a `sockaddr_in` of all zeros is valid.
let mut storage: libc::sockaddr_in = unsafe { mem::zeroed() };
storage.sin_family = libc::AF_INET as _;
storage.sin_port = addr.port().to_be();
storage.sin_addr = libc::in_addr {
s_addr: u32::from_ne_bytes(addr.ip().octets()),
};
storage
}
Loading