Re: [GENERAL] Linux Largefile Support In Postgresql RPMS - Mailing list pgsql-hackers

From Oliver Elphick
Subject Re: [GENERAL] Linux Largefile Support In Postgresql RPMS
Date
Msg-id 1029241101.1135.560.camel@linda
Whole thread Raw
In response to Re: [GENERAL] Linux Largefile Support In Postgresql RPMS  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: [GENERAL] Linux Largefile Support In Postgresql RPMS  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, 2002-08-12 at 21:07, Peter Eisentraut wrote:

> This is not the only issue.  You really need to check all uses of off_t
> (for example printf("%ld", off_t) will crash) and all places where off_t
> should have been used in the first place.  Furthermore you might need to
> replace ftell() and fseek() by ftello() and fseeko(), especially if you
> want pg_dump to support large archives.

Searching for fseek, ftell and off_t yields only 12 files in the whole
source tree, so fortunately the impact is not enormous.  As expected,
pg_dump is the main program involved.

There seem to be several places in the pg_dump code where int is used
instead of long int to receive the output of ftell().  I presume these
ought to be cleaned up as well.

Looking at how to deal with this, is the following going to be
portable?:      in pg_dump/Makefile:   CFLAGS += -D_LARGEFILE_SOURCE -D_OFFSET_BITS=64      in pg_dump.h:   #ifdef
_LARGEFILE_SOURCE    #define FSEEK fseeko     #define FTELL ftello     #define OFF_T_FORMAT %Ld     typedef off_t
OFF_T;  #else     #define FSEEK fseek     #define FTELL ftell     #define OFF_T_FORMAT %ld     typedef long int OFF_T;
#endif      In pg_dump/*.c:       change relevant occurrences of fseek and ftell to FSEEK and       FTELL
changeall file offset parameters used or returned by fseek and       ftell to OFF_T (usually from int)
constructprintf formats with OFF_T_FORMAT in appropriate places
 

> Still, most of the configuration work is already done in Autoconf (see
> AC_FUNC_FSEEKO and AC_SYS_LARGEFILE), so the work might be significantly
> less than the time spent debating the merits of large files on these
> lists. ;-)

Since running autoconf isn't part of a normal build, I'm not familiar
with that.  Can autoconf make any of the above unnecessary?

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                            
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "Watch ye therefore, and pray always, that ye may be      accounted worthy
toescape all these things that shall     come to pass, and to stand before the Son of man."
    Luke 21:36 
 



pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: db partial dumping with pg_dump
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql-server/src backend/tcop/postgres.cbacke