[developer] Re: SEEK_DATA should fail at EOF

Bill Sommerfeld sommerfeld@hamachi.org
Sat Feb 15 16:28:30 GMT 2025


On 2/14/25 23:42, Cedric Blancher wrote:
> cc: illumos-dev@ list. How does Solaris or Illumos behave? SUN/Solaris
> invented SEEK_DATA/SEEK_HOLE, so this should be - aside from looking
> at the OpenGroup/POSIX specs - the reference implementation.

Thanks for asking.
On Illumos, SEEK_DATA fails with ENXIO at EOF, and more generally fails 
with ENXIO if there are no non-hole regions in the file after the passed 
offset -- a file may end in a hole, so you may also get ENXIO for 
offsets less than the file's length.
The lseek manpage says:
...
ERRORS
 The lseek() function will fail if:
...
 ENXIO
 For SEEK_DATA, there are no more data regions past the
 supplied offset. For SEEK_HOLE, there are no more holes
 past the supplied offset.
						- Bill


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /