Re: POSIX Compliance

Regis Duchesne (
Sat, 5 Apr 1997 01:05:46 +0200 (CEST)

On Thu, 3 Apr 1997, Richard B. Johnson wrote:

> dev_end = lseek(fd, 0, SEEK_END);
> Returns the file size or the device size (if a disk or disk partition)
> on my Sun running SunOs 5.5.1.
> On Linux machines of various versions, including the latest, it returns
> zero (0).

ISO/IEC 9945-1:1996(E)
Std 1003.1, 1996 Edition

specifies at paragraph line 563 :
"Some devices are incapable of seeking. [...] The behavior of the lseek()
function on such devices is implementation defined. [...] If fd refers to
a shared memory object, the result of the lseek() function is

and at paragraph line 583 :
"Upon successful completion, the function shall return the resulting
offset location as measured in bytes from the beginning of the file.
Otherwise, it shall return a value of ((off_t)-1), shall set errno to
indicate the error, and the file offset shall remain unchanged by this
function call"

> I do not know what is correct. However, if POSIX requires the
> observed behavior, I think we no longer have a generic means of finding
> out the size of a disk device or disk partition. This is not good.

Are you sure there is no other way to do this? It seems that my 'df' works
pretty well on various versions of Linux.

Regis "HPReg" DUCHESNE - Engineering Student at ***** ******** *****
(O o) I use Linux & 3Com (1135 Kb/s over 10Mb/s ethernet)