Re: [COMMITTERS] pgsql-server/src/include/port hpux.h

Lists: pgsql-committerspgsql-hackers
From: petere(at)postgresql(dot)org (Peter Eisentraut - PostgreSQL)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql-server/src/include/port hpux.h
Date: 2002-08-29 22:09:23
Message-ID: 20020829220923.1B0FF4767DC@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

CVSROOT: /cvsroot
Module name: pgsql-server
Changes by: petere(at)postgresql(dot)org 02/08/29 18:09:23

Modified files:
src/include/port: hpux.h

Log message:
Workaround for broken large file support on HP-UX


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql-server/src/include/port hpux.h
Date: 2002-08-30 02:09:45
Message-ID: 21234.1030673385@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

petere(at)postgresql(dot)org (Peter Eisentraut - PostgreSQL) writes:
> Modified files:
> src/include/port: hpux.h
> Log message:
> Workaround for broken large file support on HP-UX

Good try but it didn't help. After looking more closely I've realized
that HP's system headers are just hopelessly broken, at least on HPUX
10.20 (which, to be fair, is well behind the curve now). There is just
no way to compile 64-bit support without drawing warnings in
-Wmissing-declarations mode, because they've simply not included all
the declarations that should be there. _LARGEFILE64_SOURCE was a red
herring --- I forgot to count underscores carefully, and I now see that
the declarations that _LARGEFILE64_SOURCE exposes aren't the ones that
gcc is complaining about the lack of.

What I'm currently thinking we should do is default largefile support to
off in HPUX < 11.0; is there a convenient way to accomplish that in
autoconf?

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql-server/src/include/port hpux.h
Date: 2002-09-02 18:02:23
Message-ID: Pine.LNX.4.44.0209021945340.918-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Tom Lane writes:

> What I'm currently thinking we should do is default largefile support to
> off in HPUX < 11.0; is there a convenient way to accomplish that in
> autoconf?

Something like this maybe (before AC_SYS_LARGEFILE):

case $host_os in hpuxZYX*)
if test "${enable_largefile+set}" != set; then
enable_largefile=no
fi
esac

I found an HP whitepaper on the large file support and it seems they don't
have the problem of missing declarations.

http://docs.hp.com/hpux/onlinedocs/os/lgfiles4.pdf

Note the example in section 6.4.1. On page 37 they grep the preprocessed
source and somehow manage to get a declaration of __lseek64() in there.
Maybe it's a later OS release.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql-server/src/include/port hpux.h
Date: 2002-09-04 16:32:40
Message-ID: 15070.1031157160@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> I found an HP whitepaper on the large file support and it seems they don't
> have the problem of missing declarations.
> http://docs.hp.com/hpux/onlinedocs/os/lgfiles4.pdf
> Note the example in section 6.4.1. On page 37 they grep the preprocessed
> source and somehow manage to get a declaration of __lseek64() in there.

Yeah, but you'll notice they *have to* declare __lseek64(), 'cause the
compiler will otherwise assume it returns int. I've been through these
files now and it seems that they've very carefully included only the
minimal declarations they absolutely had to. What's really annoying
is that the prototypes are there --- but #ifdef'd out of sight:

# if defined(_FILE64)
# ifndef __cplusplus
extern off_t __lseek64();
# ifdef __STDC_EXT__
static truncate(a,b) const char *a; off_t b; { return __truncate64(a,b); }
# else
static truncate(a,b) off_t b; { return __truncate64(a,b); }
# endif /* __STDC_EXT__ */
static int prealloc(a,b) off_t b; { return __prealloc64(a,b); }
static int lockf(a,b,c) off_t c; { return __lockf64(a,b,c); }
static int ftruncate(a,b) off_t b; { return __ftruncate64(a,b); }
static off_t lseek(a,b,c) off_t b; { return __lseek64(a,b,c); }
# else /* __cplusplus */
extern off_t __lseek64(int, off_t, int);
extern int __truncate64(const char *, off_t);
extern int __prealloc64(int, off_t);
extern int __lockf64(int, int, off_t);
extern int __ftruncate64(int, off_t);
inline int truncate(const char *a, off_t b) { return __truncate64(a,b); }
inline int prealloc(int a, off_t b) { return __prealloc64(a,b); }
inline int lockf(int a, int b, off_t c) { return __lockf64(a,b,c); }
inline int ftruncate(int a, off_t b) { return __ftruncate64(a,b); }
inline off_t lseek(int a, off_t b, int c) { return __lseek64(a,b,c); }
# endif /* __cplusplus */
# endif /* _FILE64 */

The bottom line is that large file support does work on HPUX 10.20, but
it will generate a ton of warning messages if you build using gcc and
-Wmissing-declarations.

I'm now thinking that I will just edit my local copies of the system
headers to add the missing declarations so that I don't see these
warnings. Turning off largefile support is probably too high a price
for users to pay just so Tom Lane doesn't have to see warnings ;-)

regards, tom lane