easy way to determine if a stream or fd is seekable

Benjamin Kaduk kaduk at MIT.EDU
Mon Nov 21 06:20:56 UTC 2011


On Mon, 21 Nov 2011, perryh at pluto.rain.com wrote:

> Alexander Best <arundel at freebsd.org> wrote:
>
>> here's a revised patch.
>> ...
>> +.Sh CAVEATS
>> +If the
>> +.Fn lseek
>> +system call is operating on a device, which is incapable of seeking,
>> +it will request the seek operation and complete successfully.
>
> I think it would be better without the first comma (after "device").

Definitely.

Also,

+.Sh CAVEATS
+If the
+.Fn lseek
+system call is operating on a device, which is incapable of seeking,
+it will request the seek operation and complete successfully.

I would prefer something like "request the seek operation and return as if 
the seek was successful, even though no seek was performed."

+The value of the pointer associated with such a device is undefined.

"Which pointer?"  That it is "the file offset" was clear from context 
where this line was moved from, but is no longer, here.

+Device types which can be incapable of seeking include,
+but are not limited to, tape drives.

This is an awkward phrasing; perhaps just "Many tape drives are incapable 
of seeking and can trigger this bug."?

-Ben Kaduk


More information about the freebsd-hackers mailing list