Re: SEEK_HOLE at EOF

From: Steffen Nurpmeso <steffen_at_sdaoden.eu>
Date: Thu, 04 Apr 2024 22:16:29 UTC
Rick Macklem wrote in
 <CAM5tNy5btZGYz3Ya-8qFObycdmyWZEnuAOHquW6FNWjcL8_DuA@mail.gmail.com>:
 |On Thu, Apr 4, 2024 at 1:59 PM Alan Somers <asomers@freebsd.org> wrote:
 |>
 |> On Thu, Apr 4, 2024 at 2:56 PM Rick Macklem <rick.macklem@gmail.com> \
 |> wrote:
 |>>
 |>> On Thu, Apr 4, 2024 at 11:15 AM Alan Somers <asomers@freebsd.org> wrote:
 ...
 |>> Here's what it says about SEEK_HOLE and offset:
 |>> If whence is SEEK_HOLE, the file offset shall be set to the smallest
 |>> location of a byte within a hole and not less than offset, except that
 |>> if offset falls within the last hole, then the file offset may be set
 |>> to the file size instead. It shall be an error if offset is greater
 |>> or equal to the size of the file.
 |>>
 |>> I'd suggest we follow this, since it is the closest to a standard \
 |>> that there is.
 |>
 |> That sounds like behavior 2: return ENXIO at EOF.  For reference, do
 |> you have a link to that somewhere?
 |0000415: add SEEK_HOLE, SEEK_DATA to lseek - Austin Group Defect
 |Tracker (austingroupbugs.net)
 |If this doesn't give you a link (gmail never shows the raw url for me)
 |just google
 |"SEEK_HOLE austin group".

just a few lines further below


46396               [ENXIO]                  The whence argument is SEEK_HOLE or SEEK_DATA, and offset is greater
46397                                        than or equal to the file size; or the whence argument is SEEK_DATA and the
46398                                        offset falls beyond the last byte not within a hole.

  ...
 --End of <CAM5tNy5btZGYz3Ya-8qFObycdmyWZEnuAOHquW6FNWjcL8_DuA@mail.gmail\
 .com>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)