Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2011 14:21:31 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Tim Kientzle <tim@kientzle.com>
Cc:        freebsd-hackers@freebsd.org, Juergen Lock <nox@jelal.kn-bremen.de>
Subject:   Re: easy way to determine if a stream or fd is seekable
Message-ID:  <20111120142131.GA64913@freebsd.org>
In-Reply-To: <20111120140450.GA62286@freebsd.org>
References:  <20111116102239.GA2687@britannica.bec.de> <20111116131428.GA40723@freebsd.org> <20111116232152.GC21793@britannica.bec.de> <20111117002438.GA55931@freebsd.org> <201111172055.pAHKtZso061118@triton8.kn-bremen.de> <B06B2304-A1BC-49A3-A811-F05625138D58@kientzle.com> <20111118203122.GA9508@freebsd.org> <E693FAEB-1D8D-41A0-AEB7-3EB00419F432@kientzle.com> <20111120124034.GA54811@freebsd.org> <20111120140450.GA62286@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun Nov 20 11, Alexander Best wrote:
> On Sun Nov 20 11, Alexander Best wrote:
> > On Sat Nov 19 11, Tim Kientzle wrote:
> > > 
> > > On Nov 18, 2011, at 12:31 PM, Alexander Best wrote:
> > > 
> > > > On Fri Nov 18 11, Tim Kientzle wrote:
> > > >> 

[snip]

> 
> so...any thoughts regarding this man page patch?

here's a revised patch.

cheers.
alex

> 
> cheers.
> alex
> 
> i was also wondering, wether the limits of lseek() - being, it cannot guarantee
> that s seek operation was actually successful - also apply to all of the
> libc functions in the fseek(3) man page, being:
> 
> fseek(), ftell(), rewind(), fgetpos(), fsetpos(), fseeko() and ftello().
> 
> if that is the case, a similar not should also be added to the fseek(3) man
> page, imo.
> 
> > 

[snip]


--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="lseek2.diff"

diff --git a/lib/libc/sys/lseek.2 b/lib/libc/sys/lseek.2
index 874c523..76102cd 100644
--- a/lib/libc/sys/lseek.2
+++ b/lib/libc/sys/lseek.2
@@ -28,7 +28,7 @@
 .\"     @(#)lseek.2	8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd April 5, 2007
+.Dd November 20, 2011
 .Dt LSEEK 2
 .Os
 .Sh NAME
@@ -113,10 +113,9 @@ of the existing end-of-file of the file.
 If data is later written
 at this point, subsequent reads of the data in the gap return
 bytes of zeros (until data is actually written into the gap).
-.Pp
-Some devices are incapable of seeking.
-The value of the pointer
-associated with such a device is undefined.
+However, the
+.Fn lseek
+system call does not, by itself, extend the size of a file.
 .Pp
 A
 .Qq hole
@@ -197,12 +196,28 @@ is associated with a pipe, socket, or FIFO.
 The
 .Fn lseek
 system call is expected to conform to
-.St -p1003.1-90 .
+.St -p1003.1-2008 .
+.Pp
+The
+.Dv SEEK_HOLE
+and
+.Dv SEEK_DATA
+directives, along with the
+.Er ENXIO
+error, are extensions to the specification.
 .Sh HISTORY
 The
 .Fn lseek
 function appeared in
 .At v7 .
+.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.
+The value of the pointer associated with such a device is undefined.
+Device types which can be incapable of seeking include,
+but are not limited to, tape drives.
 .Sh BUGS
 This document's use of
 .Fa whence

--17pEHd4RhPHOinZp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111120142131.GA64913>