[GIT PULL] man/io_uring_prep_read.3: Explain unsigned input vs. __s32 output#1570
[GIT PULL] man/io_uring_prep_read.3: Explain unsigned input vs. __s32 output#1570axboe merged 1 commit intoaxboe:masterfrom
Conversation
|
Missing a signed-off-by in the commit. That aside, the main thing here is that no syscalls in Linux ever accept more than |
io_uring_prep_read() reads an unsigned number of bytes, and for short reads it returns the actual number of bytes read. But the return value is __s32, so not all possible values can be represented. Explain this doesn't matter because of limits in the underlying syscall. Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
|
Ah yes, I must have skipped past the explanation in read(2) because I was busy looking for data types instead of maximum values. This version lifts the phrase "the number of bytes actually transferred" from that page, so anyone else who makes the same mistake will know the phrase to search for. |
|
Merged this one, but would actually be interesting to have this blurb in other liburing man pages where a transfer size is used. If you feel so inclined... |
|
Ok, I kinda got sucked into the bigger job :) Before I submit a PR, can you confirm...
(I plan to add a note to the second set of pages saying the issue doesn't apply, and recommend them from the pages where it does apply) Aside: read(2) implies there's a read()-specific limit of 0x7ffff000 bytes (confirmed in a quick test). It's the only page I've found that talks about such a limit, so I'll write different blurbs for read() and non-read() pages. |
The art of maintaining open source software ;-) List looks good to me. There's the
And I think that is it. Thanks again for doing this - not just the first PR, because it is always nice when someone submits a documentation change for something that caused them headache, but also for doing the rest of them. |
Tweak the discussion text from e65a2a0, and replicate it across all read()-based functions. Linux's read() function has special limitations, so the text in these functions should be visibly different to the blurb elsewhere. To achieve that, io_uring_cqe's result code is only discussed explicitly in this commit. Based on a discussion in axboe#1570 Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
Based on a discussion in axboe#1570 Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
Based on a discussion in axboe#1570 Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
io_uring_buf_ring_add(3) does not transfer data, but people reading that page are likely to appreciate a hint about maximum buffer sizes. A quick test shows splice(3) and tee(3) don't return much data per call. If a user saw text in io_uring_prep_splice(3) or io_uring_prep_tee(3) that looked just like the other man pages, they would have the right to be surprised when they found the functions behaved differently. The man pages for splice and tee don't mention any particular limits, so these man pages just say "limits as low as 65536 have been observed" - specific enough to alert the reader, but vague enough not to imply undue certainty. Based on a discussion in axboe#1570 Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
io_uring_prep_read() reads an unsigned number of bytes, and for short reads it returns the actual number of bytes read. But the return value is __s32, so not all possible values can be represented.
Explain that it's impossible to allocate a buffer large enough for this to be a problem.
I'm submitting this as a PR with an answer I think is correct, but could just as easily have raised an issue asking a question. Happy to resubmit if there's an actual bug here, like an architecture with a weird
PTRDIFF_MAXor a way to pass very large buffers toio_uring_prep_read(). Otherwise, this seems like the best way to avoid the next person spending an hour running this one to ground.git request-pull output:
By submitting this pull request, I acknowledge that: