Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1d4e58

Browse files
committed
Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on
current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis.
1 parent f1d371b commit e1d4e58

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ Library
227227
- Issue #25924: Avoid unnecessary serialization of getaddrinfo(3) calls on
228228
OS X versions 10.5 or higher. Original patch by A. Jesse Jiryu Davis.
229229

230+
- Issue #26406: Avoid unnecessary serialization of getaddrinfo(3) calls on
231+
current versions of OpenBSD and NetBSD. Patch by A. Jesse Jiryu Davis.
232+
230233
Documentation
231234
-------------
232235

Modules/socketmodule.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ if_indextoname(index) -- return the corresponding interface name\n\
184184
# define USE_GETHOSTBYNAME_LOCK
185185
#endif
186186

187-
/* To use __FreeBSD_version */
187+
/* To use __FreeBSD_version, __OpenBSD__, and __NetBSD_Version__ */
188188
#ifdef HAVE_SYS_PARAM_H
189189
#include <sys/param.h>
190190
#endif
@@ -195,15 +195,21 @@ if_indextoname(index) -- return the corresponding interface name\n\
195195
a mix of code including an unsafe implementation from an old BSD's
196196
libresolv. In 10.5 Apple reimplemented it as a safe IPC call to the
197197
mDNSResponder process. 10.5 is the first be UNIX '03 certified, which
198-
includes the requirement that getaddrinfo be thread-safe.
198+
includes the requirement that getaddrinfo be thread-safe. See issue #25924.
199199
200-
See issue #25924 for details.
200+
It's thread-safe in OpenBSD starting with 5.4, released Nov 2013:
201+
http://www.openbsd.org/plus54.html
202+
203+
It's thread-safe in NetBSD starting with 4.0, released Dec 2007:
204+
205+
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&r2=1.83
201206
*/
202207
#if defined(WITH_THREAD) && ( \
203208
(defined(__APPLE__) && \
204209
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) || \
205210
(defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \
206-
defined(__OpenBSD__) || defined(__NetBSD__) || \
211+
(defined(__OpenBSD__) && OpenBSD+0 < 201311) || \
212+
(defined(__NetBSD__) && __NetBSD_Version__+0 < 400000000) || \
207213
!defined(HAVE_GETADDRINFO))
208214
#define USE_GETADDRINFO_LOCK
209215
#endif

0 commit comments

Comments
 (0)