-
I tried looking through the docs and the test suite but I wasn't really able to find something that I can use. I'm wondering, is it possible to take a normal FD and then register it with io_uring? Right now, I have an application which registers a sparse file table with the ring and then I use the correct indices for I feel like I should be using Is there an example or test I can look at? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Yes, you want to use io_uring_register_files_update() for that case. It basically just replaces an existing fixed file slot with whatever you provide. If the slot is currently empty (eg holds -1, sparse), then the sparse entry is replaced with the file you specify and put into the given offset. There are really two ways to turn a normal file descriptor into a regular one - either register it like that in the first place, eg when you register the table, or do it via io_uring_register_files_update. The test cases have some usage of it, here's a bare bones example of registering a sparse table and then later putting a pipe fd in there:
|
Beta Was this translation helpful? Give feedback.
Yes, you want to use io_uring_register_files_update() for that case. It basically just replaces an existing fixed file slot with whatever you provide. If the slot is currently empty (eg holds -1, sparse), then the sparse entry is replaced with the file you specify and put into the given offset.
There are really two ways to turn a normal file descriptor into a regular one - either register it like that in the first place, eg when you register the table, or do it via io_uring_register_files_update.
The test cases have some usage of it, here's a bare bones example of registering a sparse table and then later putting a pipe fd in there: