Re: Large file support available

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Large file support available
Date: 2002-08-24 11:43:24
Message-ID: 200208241143.g7OBhPL20616@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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_t
typedef quad_t off_t;

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2002-08-24 14:51:30 Re: [GENERAL] PostgreSQL 7.2.2: Security Release
Previous Message Bruce Momjian 2002-08-24 11:27:56 Re: Delayed...