4 ms·
I am not sure if there were any practical async apis for files. There was only for networking I believe?
by jakjak123 3y ago
I am not sure if there were any practical async apis for files. There was only for networking I believe?
- riku_iki 3y agoI am not an expert, but my reading is that epoll operates on file descriptors.
- jen20 3y agoThis is highly dependent on the filesystem - as far as I know, basically only XFS works, and only for a small subset of operations, and everything else just blocks. Tokio's filesystem handling in Rust is the same way by default - a pool of IO threads. Edit: I just remembered that Avi Kivity (of KVM and ScyllaDB fame) wrote a tool to detect this: https://github.com/avikivity/fsqual https://github.com/avikivity/fsqual
- gpderetta 3y agoReadiness notification, like epoll, is not really suitable for file backed IO. A file on disk is not a FIFO that you can wait for data to be available; what would even mean for notification to be ready to read for a file fd? Consider that reads can be at any offset. You need completion notifications instead (like IOCP or io_uring or POSIX aio). You could in principle start an async splice from an FD into a pipe and then poll for the pipe to be ready to read, but IIRC there is no async splice.
- deleted 3y ago[deleted]
- saati 3y agoThey are always "ready" and they block when you use them.
- formerly_proven 3y agoSure, in the sense that files are always ready for I/O.