Closed withoutboats closed 4 years ago
Wow! Very very nice! I was just reading about the provide_buffers
API the other day and it's exciting to see the implementation :)
Wow! Very very nice! I was just reading about the provide_buffers API the other day and it's exciting to see the implementation :)
There's two different APIs for registering buffers: the io_uring_register-based "register buffers" API and the "provide buffers" SQE operation. They're confusingly similar, but different. :sweat_smile:
This only works for the READ_FIXED/WRITE_FIXED operations, in which you still select the buffer you're doing IO in in the user program, just the kernel already has it mmaped into its memory space. On the other hand, with the provide buffers API you give the kernel a bunch of buffers and then it selects one to write in and tells the userspace program which buffer to look in.
cc @mxxo
Generalizes
RegisteredFd
to also supportRegisteredBuf
with a similar strategy. Now, users can pre-register both FDs and buffers and pass either toprep_read
andprep_write
to get a correctly prepared IO event.