There should no longer be any - read - write - connect - sendmsg - recvmsg - accept calls in the codebase. Previously we were using a mix of io_uring and these calls which had some negative effects: Since we were using the old system calls, we had to set the file descriptors to non-blocking. But our io_uring code did not handle EAGAIN. This lead to programs sometimes being killed when the wayland IO was actually blocking. Now all file descriptors are set to blocking, but io_uring makes it non-blocking from our perspective. The one exception are evdev files because they are read via libinput and libinput uses the old system calls.
31 lines
772 B
Rust
31 lines
772 B
Rust
use {crate::io_uring::IoUringError, thiserror::Error};
|
|
pub use {
|
|
buf_in::BufFdIn,
|
|
buf_out::{BufFdOut, OutBuffer, OutBufferSwapchain},
|
|
formatter::MsgFormatter,
|
|
parser::{MsgParser, MsgParserError},
|
|
};
|
|
|
|
mod buf_in;
|
|
mod buf_out;
|
|
mod formatter;
|
|
mod parser;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum BufFdError {
|
|
#[error("An IO error occurred")]
|
|
Io(#[source] IoUringError),
|
|
#[error("An io-uring error occurred")]
|
|
Ring(#[from] IoUringError),
|
|
#[error("The peer did not send a file descriptor")]
|
|
NoFd,
|
|
#[error("The peer sent too many file descriptors")]
|
|
TooManyFds,
|
|
#[error("The peer closed the connection")]
|
|
Closed,
|
|
#[error("The connection timed out")]
|
|
Timeout,
|
|
}
|
|
|
|
const BUF_SIZE: usize = 4096;
|
|
const MAX_IN_FD: usize = 32;
|