Author emptysquare
Recipients emptysquare, ned.deily, ronaldoussoren
Date 2016-01-06.15:15:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452093353.66.0.467733860865.issue25924@psf.upfronthosting.co.za>
In-reply-to
Content
In Apple's Libinfo version 222.4.12 (corresponding to the last OS X 10.4 release), the man page says getaddrinfo isn't thread-safe:

http://www.opensource.apple.com/source/Libinfo/Libinfo-222.4.12/lookup.subproj/getaddrinfo.3

And here's its source:

http://www.opensource.apple.com/source/Libinfo/Libinfo-222.4.12/lookup.subproj/getaddrinfo.c

Glancing at the source naïvely, I might see the data race: getaddrinfo calls gai_lookupd, which reads and writes the global static variable "gai_proc". I can't see what will go wrong as a result of the race, but it sure LOOKS bad.

In the next release, version 278 (OS X 10.5.0), the thread-safety warning is gone from the man page:

http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.3

And getaddrinfo is largely rewritten:

http://www.opensource.apple.com/source/Libinfo/Libinfo-278/lookup.subproj/getaddrinfo.c

It calls a new function, "ds_getaddrinfo". But ds_getaddrinfo still accesses the global static variable "gai_proc"; I wonder why this is considered thread-safe now?
History
Date User Action Args
2016-01-06 15:15:53emptysquaresetrecipients: + emptysquare, ronaldoussoren, ned.deily
2016-01-06 15:15:53emptysquaresetmessageid: <1452093353.66.0.467733860865.issue25924@psf.upfronthosting.co.za>
2016-01-06 15:15:53emptysquarelinkissue25924 messages
2016-01-06 15:15:53emptysquarecreate