Re: RFC: should lseek(SEEK_DATA/SEEK_HOLE) return ENOTTY?

From: Gary Jennejohn <gljennjohn_at_gmail.com>
Date: Sun, 11 Aug 2019 09:04:05 +0200
On Sun, 11 Aug 2019 02:03:10 +0000
Rick Macklem <rmacklem_at_uoguelph.ca> wrote:

> Hi,
> 
> I've noticed that, if you do a lseek(SEEK_DATA/SEEK_HOLE) on a file that
> resides in a file system that does not support holes, ENOTTY is returned.
> 
> This error isn't listed for lseek() and seems a liitle weird.
> 

ENOTTY is the standard error return for an unimplemented ioctl(2),
and SEEK_HOLE ultimately becomes a call to fo_ioctl().

> I can see a couple of alternatives to this:
> 1 - Return a different error. Maybe ENXIO?
> or
> 2 - Have lseek() do the trivial implementation when the VOP_IOCTL() fails.
>    - For SEEK_DATA, just return the offset given as argument and for SEEK_HOLE
>       return the file's size as the offset.
> 
> What do others think? rick
> ps: The man page should be updated, whatever is done w.r.t. this.
> 

I also vote for option 2

-- 
Gary Jennejohn
Received on Sun Aug 11 2019 - 05:04:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:21 UTC