Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Date
Msg-id 200309020404.h8244Zc21140@candle.pha.pa.us
Whole thread Raw
In response to Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)  (Larry Rosenman <ler@lerctr.org>)
Responses Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)  (Larry Rosenman <ler@lerctr.org>)
List pgsql-hackers
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, andfgetpwent, all information is contained in a static area, so
itmust becopied 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.

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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: TCP/IP with 7.4 beta2 broken?
Next
From: Tom Lane
Date:
Subject: Re: TCP/IP with 7.4 beta2 broken?