Skip to content

Conversation

@Berrysoft
Copy link
Member

Would benefit #608

Copy link
Contributor

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 operations that need to wait on two file descriptors simultaneously, specifically enabling the splice system call to properly wait for both the input fd (readable) and output fd (writable) before executing. This addresses the requirements of #608 for implementing zero-copy file splicing.

  • Introduces Decision::Wait2 and OpType::Fd2 to handle operations polling two file descriptors
  • Updates the Splice operation to wait on both input and output fds instead of only the input fd
  • Refactors the polling and cancellation logic to support two-fd operations

Reviewed changes

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

File Description
compio-driver/src/sys/poll/op.rs Updates Splice OpCode implementation to wait for both input and output fds, and refactors the operate method to use the syscall! macro consistently
compio-driver/src/sys/poll/mod.rs Adds Decision::Wait2 and OpType::Fd2 variants, introduces helper method poll_fd to handle fd polling, and updates cancel and poll methods to support two-fd operations

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

@George-Miao
Copy link
Member

What about we unify them into one Wait(SmallVec<[WaitArg;1]>) (or something similar if you don't want to introduce additional dependency)?

@Berrysoft
Copy link
Member Author

If we meet a case that needs to wait for 3 fds in the future, that should be correct time to unify them, I think:)

@George-Miao
Copy link
Member

George-Miao commented Jan 7, 2026

If we meet a case that needs to wait for 3 fds in the future, that should be correct time to unify them, I think:)

Okay.. what about an enum { One(T), Two(T, T) } that implements Iterator<T>? Two separate branch feels sooooo odd

@George-Miao
Copy link
Member

Also please add a test for two fd scenario

@Berrysoft
Copy link
Member Author

Too hard for me to handle multiple coming events. Help wanted.

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