axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.7k stars 393 forks source link

IORING_OP_TIMEOUT / IORING_OP_TIMEOUT_REMOVE. Consider allowing a single int64 as a timeout. #1118

Open vsolontsov-ll opened 3 months ago

vsolontsov-ll commented 3 months ago

I'm not sure if it's worth the efforts. However it looks a bit quirky that one needs to keep a struct __kernel_timespec alive until the submission is fully done.

I feel it would be nice to have a flag like IORING_TIMEOUT_PURE_NS, and encode its value in the addr field.

An alternative could be normalizing the timespec so that the tv_nsec is less than 999'999'999. We could take it to some i32 field in the sqe. I don't see any use of fields from the union with splice_fd_in for TIMEOUTs...

BTW, unlike timerfd_settime(), the uring implementation is currently not strict and doesn't reject if tv_nsec > 999'999'999. Could it be documented, or you need a freedom to make it stricter in the future?