3 ms·
Why you think you can't use epoll with disk files on linux?
by GoblinSlayer 3y ago
Why you think you can't use epoll with disk files on linux?
- mananaysiempre 3y agoPer open(2) [1], you can’t really ask the kernel to not block on regular files: > O_NONBLOCK [...] has no effect for regular files and will (briefly) block when device activity is required, regardless of whether O_NONBLOCK is set. []O_NONBLOCK semantics might eventually be implemented[.] I’m actually not sure if the reported readiness for them is of any use, but the documentation for select(2) [2] doesn’t give me a lot of hope: > A file descriptor is ready for writing if a write operation will not block. However, even if a file descriptor indicates as writable, a large write may still block. This for data operations; if you want open() itself to avoid spelunking through NFS or spinning up optical drives or whatnot, before io_uring you simply had no way to tell that to the kernel—you call open*() or perhaps creat(), which must give you a fd, thus must block until they can do so. (As far as I’ve seen, tutorial documentation usually rounds this down to “you can’t do nonblocking I/O on disk files”.) [1] https://man7.org/linux/man-pages/man2/open.2.html https://man7.org/linux/man-pages/man2/open.2.html [2] https://man7.org/linux/man-pages/man2/select.2.html https://man7.org/linux/man-pages/man2/select.2.html
- GoblinSlayer 3y agoYou use io_uring to spin optical drives?