Skip to content

add async_uring_cmd#4

Closed
wokron wants to merge 3 commits into
masterfrom
support-uring-cmd
Closed

add async_uring_cmd#4
wokron wants to merge 3 commits into
masterfrom
support-uring-cmd

Conversation

@wokron
Copy link
Copy Markdown
Member

@wokron wokron commented Jan 9, 2026

for linux 6.19

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for two new async io_uring operations: async_uring_cmd (a generic uring command operation) and async_cmd_getsockname (to get socket name information). Both operations support fixed file descriptors and are conditionally compiled for io_uring version 2.13 and later.

Key changes:

  • Adds async_uring_cmd as a flexible template function that allows custom command operations with user-provided callback
  • Adds async_cmd_getsockname wrapper for the io_uring getsockname command
  • Includes comprehensive test coverage for both operations with regular and fixed file descriptors

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
include/condy/async_operations.hpp Implements async_uring_cmd and async_cmd_getsockname functions with appropriate version guards and fixed fd support
tests/test_async_operations.cpp Adds four test cases covering basic and fixed fd scenarios for both new operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_async_operations.cpp Outdated
Comment thread tests/test_async_operations.cpp Outdated
Comment thread tests/test_async_operations.cpp Outdated
Comment thread tests/test_async_operations.cpp Outdated
Comment thread include/condy/async_operations.hpp
Comment thread include/condy/async_operations.hpp
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +841 to +848
inline auto async_uring_cmd(int cmd_op, Fd fd, CmdFunc &&cmd_func) {
auto prep_func = [cmd_func = std::forward<CmdFunc>(cmd_func)](
io_uring_sqe *sqe, int cmd_op_inner, int fd_inner) {
io_uring_prep_uring_cmd(sqe, cmd_op_inner, fd_inner);
cmd_func(sqe);
};
auto op = make_op_awaiter(std::move(prep_func), cmd_op, fd);
return detail::maybe_flag_fixed_fd(std::move(op), fd);
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async_uring_cmd routes the user-supplied cmd_func through make_op_awaiter, which ultimately calls it from a const lambda. This implicitly requires cmd_func to be const-invocable; passing a callable with a non-const operator() (e.g., a mutable lambda) will fail to compile. Consider constructing the final SQE-prep lambda directly (capturing cmd_op, fd, and a decayed cmd_func) so the callback can be invoked without the extra wrapper and without the const-invocable restriction.

Copilot uses AI. Check for mistakes.
Comment thread tests/test_async_operations.4.cpp
Comment thread tests/test_async_operations.4.cpp
@wokron wokron marked this pull request as draft February 10, 2026 11:22
@wokron wokron changed the title add async_uring_cmd and async_cmd_getsockname add async_uring_cmd Feb 10, 2026
@wokron
Copy link
Copy Markdown
Member Author

wokron commented Feb 13, 2026

New version #42

@wokron wokron closed this Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants