Can anyone comment on the following results from running a test program we've writen for PostgreSQL? Should the following be thread-safe, either as themselves, or a different function we should be calling? Your gethostbyname() is _not_ thread-safe Your getpwuid() is _not_ thread-safe
> Your gethostbyname() is _not_ thread-safe > Your getpwuid() is _not_ thread-safeboth functions have never been thread safe on Unix. There is getpwuid_r in CURRENT. There is a pr about gethostbyname not being thread safe: http://www.freebsd.org/cgi/query-pr.cgi?pr=18824 I guess for now you'll need to protect them by a mutex manually.
On Sat, Sep 13, 2003 at 10:24:52PM -0300, Marc G. Fournier wrote:> > Can anyone comment on the following results from running a test program > we've writen for PostgreSQL? Should the following be thread-safe, either > as themselves, or a different function we should be calling? > > > Your gethostbyname() is _not_ thread-safeThere is no thread-safe implementation on FreeBSD.> Your getpwuid() is _not_ thread-safegetpwuid_r() Kris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20030913/a9799b9c/attachment.bin
"Marc G. Fournier" <scrappy@hub.org> writes:> Your gethostbyname() is _not_ thread-safeUse getaddrinfo(3) instead. DES -- Dag-Erling Sm?rgrav - des@des.no
from the 5.x man page: BUGS The current implementation is not thread-safe. On Mon, 15 Sep 2003, Dag-Erling [iso-8859-1] Sm?rgrav wrote:> "Marc G. Fournier" <scrappy@hub.org> writes: > > Your gethostbyname() is _not_ thread-safe > > Use getaddrinfo(3) instead. > > DES > -- > Dag-Erling Sm?rgrav - des@des.no >