chiark / gitweb /
eglibc (2.11.3-4+deb6u3) squeeze-lts; urgency=medium
[eglibc.git] / debian / patches / hurd-i386 / submitted-libc_once.diff
1 2007-10-28  Aurelien Jarno  <aurelien@aurel32.net>
2
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.
10
11 ---
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(-)
18
19 --- a/bits/libc-lock.h
20 +++ b/bits/libc-lock.h
21 @@ -98,6 +98,9 @@
22      }                                                                        \
23    } while (0)
24  
25 +/* Get once control variable.  */
26 +#define __libc_once_get(ONCE_CONTROL) \
27 +  ((ONCE_CONTROL) == 1)
28  
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
33 @@ -242,6 +242,9 @@
34      }                                                                        \
35    } while (0)
36  
37 +/* Get once control variable.  */
38 +#define __libc_once_get(ONCE_CONTROL) \
39 +  ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
40  
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
45 @@ -451,6 +451,9 @@
46      }                                                                        \
47    } while (0)
48  
49 +/* Get once control variable.  */
50 +#define __libc_once_get(ONCE_CONTROL) \
51 +  ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
52  
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
57 @@ -188,6 +188,10 @@
58      __libc_lock_unlock (ONCE_CONTROL.lock);                                  \
59    } while (0)
60  
61 +/* Get once control variable.  */
62 +#define __libc_once_get(ONCE_CONTROL) \
63 +  (!ONCE_CONTROL.done)
64 +
65  #ifdef _LIBC
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
70 @@ -2335,7 +2335,7 @@
71           __libc_lock_define_initialized (static, lock);
72  
73           __libc_lock_lock (lock);
74 -         if (old_once && gaiconf_reload_flag)
75 +         if (__libc_once_get(old_once) && gaiconf_reload_flag)
76             gaiconf_reload ();
77           qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src);
78           __libc_lock_unlock (lock);