1 2007-10-28 Aurelien Jarno <aurelien@aurel32.net>
3 * bits/libc-lock.h (__libc_once_get): New definiton.
4 * linuxthreads/sysdeps/pthread/bits/libc-lock.h: Likewise
5 * nptl/sysdeps/pthread/bits/libc-lock.h: Likewise.
6 * sysdeps/mach/bits/libc-lock.h: Likewise.
7 * sysdeps/mach/hurd/bits/libc-lock.h: Likewise.
8 * sysdeps/posix/getaddrinfo.c (getaddrinfo): Use __libc_once_get
9 instead of using implementational details.
12 bits/libc-lock.h | 3 +++
13 linuxthreads/sysdeps/pthread/bits/libc-lock.h | 3 +++
14 nptl/sysdeps/pthread/bits/libc-lock.h | 3 +++
15 sysdeps/mach/hurd/bits/libc-lock.h | 4 ++++
16 sysdeps/posix/getaddrinfo.c | 2 +-
17 5 files changed, 14 insertions(+), 1 deletion(-)
19 --- a/bits/libc-lock.h
20 +++ b/bits/libc-lock.h
25 +/* Get once control variable. */
26 +#define __libc_once_get(ONCE_CONTROL) \
27 + ((ONCE_CONTROL) == 1)
29 /* Start a critical region with a cleanup function */
30 #define __libc_cleanup_region_start(DOIT, FCT, ARG) \
31 --- a/linuxthreads/sysdeps/pthread/bits/libc-lock.h
32 +++ b/linuxthreads/sysdeps/pthread/bits/libc-lock.h
37 +/* Get once control variable. */
38 +#define __libc_once_get(ONCE_CONTROL) \
39 + ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
41 /* Start critical region with cleanup. */
42 #define __libc_cleanup_region_start(DOIT, FCT, ARG) \
43 --- a/nptl/sysdeps/pthread/bits/libc-lock.h
44 +++ b/nptl/sysdeps/pthread/bits/libc-lock.h
49 +/* Get once control variable. */
50 +#define __libc_once_get(ONCE_CONTROL) \
51 + ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
53 /* Note that for I/O cleanup handling we are using the old-style
54 cancel handling. It does not have to be integrated with C++ snce
55 --- a/sysdeps/mach/hurd/bits/libc-lock.h
56 +++ b/sysdeps/mach/hurd/bits/libc-lock.h
58 __libc_lock_unlock (ONCE_CONTROL.lock); \
61 +/* Get once control variable. */
62 +#define __libc_once_get(ONCE_CONTROL) \
63 + (!ONCE_CONTROL.done)
66 /* We need portable names for some functions. E.g., when they are
67 used as argument to __libc_cleanup_region_start. */
68 --- a/sysdeps/posix/getaddrinfo.c
69 +++ b/sysdeps/posix/getaddrinfo.c
71 __libc_lock_define_initialized (static, lock);
73 __libc_lock_lock (lock);
74 - if (old_once && gaiconf_reload_flag)
75 + if (__libc_once_get(old_once) && gaiconf_reload_flag)
77 qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src);
78 __libc_lock_unlock (lock);