lkml.org 
[lkml]   [1997]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: POSIX Compliance
    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)
    ANSI/IEEE
    Std 1003.1, 1996 Edition

    specifies at paragraph 6.5.3.2 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
    unspecified."

    and at paragraph 6.5.3.3 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 ***** ******** *****
    www http://www.via.ecp.fr/~regis/
    (O o) I use Linux & 3Com (1135 Kb/s over 10Mb/s ethernet)
    --.oOO--(_)--OOo.-----------------------------------------------------------


    \
     
     \ /
      Last update: 2005-03-22 13:39    [W:3.188 / U:0.956 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site