Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Kurt Roeckx <Q(at)ping(dot)be>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Lee Kindness <lkindness(at)csl(dot)co(dot)uk>, "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>, Larry Rosenman <ler(at)lerctr(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Date: 2003-09-01 01:10:59
Message-ID: 200309010110.h811AxI22640@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kurt Roeckx wrote:
> On Sun, Aug 31, 2003 at 12:04:58PM +0200, Peter Eisentraut wrote:
> > Lee Kindness writes:
> >
> > > You don't... and you simply shouldn't care. If there is a_r version
> > > available then we should use it - even if the plain version is "safe".
> >
> > The problem with this is that the automatic determination (in configure)
> > whether there is a xxx_r() version is, in general, fragile. We cannot
> > rely on configure saying that xxx_r() doesn't exist, so the plain xxx()
> > should be good enough. Else, we'd be shipping claimed-to-be-thread-safe
> > libraries that might trigger bugs that will be hard to track down.
>
> I think you missed a part of his email. He says that if xxx_r()
> isn't available, we should provide an xxx_r() ourself.

The big problem there is that many platforms don't have *_r functions,
and their normal library functions are thread-safe, even if they return
pointers to static memory area. See the comment at the top of
src/port/thread.c.

Looking at our current setup in src/template:

bsdi:NEED_REENTRANT_FUNC_NAMES=no
freebsd:NEED_REENTRANT_FUNC_NAMES=no
linux:NEED_REENTRANT_FUNC_NAMES=yes
netbsd:NEED_REENTRANT_FUNC_NAMES=no
osf:NEED_REENTRANT_FUNC_NAMES=no
unixware:NEED_REENTRANT_FUNC_NAMES=yes

So, the only OS's that want any *_r functions are linux and unixware.
Linux wants all of them, and Unixware wants (and has) only one of them.

I am leaning to doing an OS define test in thread.c to prevent usage of
the *_r functions they don't have, and mentioning it as a comment in the
template file (until I find another OS that needs this customization).

--
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 Bruce Momjian 2003-09-01 01:23:16 Re: massive quotes?
Previous Message Andrew Dunstan 2003-09-01 00:57:16 Re: massive quotes?