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

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Date: 2003-09-02 05:24:07
Message-ID: 4990000.1062480247@lerlaptop.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

--On Tuesday, September 02, 2003 00:04:35 -0400 Bruce Momjian
<pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:

> Larry Rosenman wrote:
>> >> > Oh, interesting. So you are saying that if the OS supports threads,
>> >> > then we use the *_r if they have them, and assume the non *_r
>> >> > functions are already thread-safe if they don't. Interesting.
>> >> >
>> >> > That seems to be what we have on Unixware, and on BSD/OS I have some
>> >> > *_r functions but not others, but they are all threadsafe, so your
>> >> > plan works there too.
>> >> UnixWare's Kernel is threaded, and I assume anything in libc is
>> >> threadsafe unless
>> >> told otherwise.
>> >
>> > What? You said Unixware needs getpwuid_r. And this has nothing to do
>> > with whether the kernel is threaded.
>> right, getpwuid is not threadsafe, so we use the provided getpwuid_r.
>
> Larry, I read the URL you gave me:
>
> http://www.lerctr.org:8458/en/man/html.3C/getpwent.3C.html
>
> Where does it say that you have to use getpwuid_r() to be thread safe?
> I don't see any mention in the docs. It does say about getpwuid:
>
> For getpwent, getpwuid, getpwnam, setpwent, endpwent, and
> fgetpwent, all information is contained in a static area, so it must be
> copied if it is to be
>
> but that in itself doesn't mean it isn't thread safe. If you are not
> sure, would you write a little thread program to test if it works if two
> threads try it at the same time.
I only have a UP box.

Since the _r version uses OUR OWN buffer, it is safer to use the _r version.

Since we do NOT have the _r alternative for strerror and gethostbyname,
that's the
best we can do.

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2003-09-02 05:29:38 Re: array constructor can't construct empty array
Previous Message Tom Lane 2003-09-02 04:25:24 Re: Need for a 'minor patch person'?