Re: Large file support available - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Large file support available
Date
Msg-id 200208241143.g7OBhPL20616@candle.pha.pa.us
Whole thread Raw
In response to Re: Large file support available  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Large file support available
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I see:
> >      The fseeko() function is identical to fseek(), except it takes an off_t
> >      argument instead of a long.  Likewise, the ftello() function is identical
> >      to ftell(), except it returns an off_t.
> 
> Indeed.  Notice the complete lack of any commitment about the size of
> off_t ...
> 
> > while fsetpos() is:
> >      fsetpos(FILE *stream, const fpos_t *pos);
> 
> ... or the size of fpos_t.
> 
> You might find it illuminating to read this random extract from the
> HPUX 10.20 man pages:
...
> I don't see any reason to believe that fgetpos buys us anything but
> notational inconvenience.  It certainly doesn't buy large file support,
> at least not without the same behind-the-scenes redefinitions needed for
> fseek/fseeko and friends...

Clearly there is the issues that fseek uses long, which isn't enough for
large file support.  On BSD/OS, we have fsetpos, which is the way we do
large file support:
    int    fseek(FILE *stream, long offset, int whence);
    int    fsetpos(FILE *stream, const fpos_t *pos);

My point is that it seems fsetpos is the approved way of accessing large
files, rather than fseeko.  In fact, I don't have fseeko here but I do
have fsetpos, and it does handle large files because my includes have
this:typedef off_t fpos_ttypedef quad_t off_t;

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Delayed...
Next
From: Vince Vielhaber
Date:
Subject: Re: [GENERAL] PostgreSQL 7.2.2: Security Release