liburing icon indicating copy to clipboard operation
liburing copied to clipboard

-1 offset and non-seekable files

Open fkm3 opened this issue 3 years ago • 2 comments

The io_uring_enter manual states that for IORING_OP_WRITEV

If the file is not seekable, off must be set to zero.

and for IORING_OP_WRITE

If fd does not refer to a seekable file, off must be set to zero. If offs is set to -1 , the offset will use (and advance) the file position, like the read(2) and write(2) system calls.

A strict reading seems to imply that off == -1 is illegal for a non-seekable file, but it seems to work in practice and generally seems useful if, for example, you are trying to read from an arbitrary file which may or may not be seekable.

What's the intended behavior? Thanks!

fkm3 avatar Aug 22 '22 18:08 fkm3

Also meant to ask, IORING_OP_WRITEV seems to support a -1 offset but doesn't mention it. Is that OK to rely on?

fkm3 avatar Aug 22 '22 18:08 fkm3

Any thoughts? Thanks

fkm3 avatar Sep 23 '22 02:09 fkm3