]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Hurd: libc_once_get
authorThomas Schwinge <thomas@schwinge.name>
Thu, 10 May 2012 21:50:14 +0000 (14:50 -0700)
committerRoland McGrath <roland@hack.frob.com>
Thu, 10 May 2012 22:57:24 +0000 (15:57 -0700)
ChangeLog
bits/libc-lock.h
nptl/ChangeLog
nptl/sysdeps/pthread/bits/libc-lockP.h
sysdeps/mach/bits/libc-lock.h
sysdeps/mach/hurd/bits/libc-lock.h
sysdeps/posix/getaddrinfo.c

index 279fbd6b3c4be87aef37c8c7cb1a7328acb79e3a..fea15ee5ddda3be7a78207744476314a0452691c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
 
+       [BZ #3748]
+       * bits/libc-lock.h (__libc_once_get): New macro.
+       * sysdeps/mach/bits/libc-lock.h: Likewise.
+       * sysdeps/mach/hurd/bits/libc-lock.h: Likewise.
+       * sysdeps/posix/getaddrinfo.c (getaddrinfo): Use __libc_once_get
+       instead of using implementation details.
+
        * libio/fileops.c: Unconditionally include <kernel-features.h>.
        * libio/freopen.c: Likewise.
        * libio/freopen64.c: Likewise.
index 4f0029fa2b6a461fdf26ac1f8eeff93cefcbf3ed..d7c49e7bb54f426c676fd62c7e77bd84ec85a444 100644 (file)
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  Stub version.
-   Copyright (C) 1996,97,99,2000-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -97,6 +97,9 @@
     }                                                                        \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL) \
+  ((ONCE_CONTROL) == 1)
 
 /* Start a critical region with a cleanup function */
 #define __libc_cleanup_region_start(DOIT, FCT, ARG)                        \
index 7e17ca010c7f33f856a2ff606f9a0be2a5b67c7c..905a6beb643bd068f9a047cb4fcee3e55c02c035 100644 (file)
@@ -1,3 +1,8 @@
+2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
+
+       [BZ #3748]
+       * sysdeps/pthread/bits/libc-lockP.h (__libc_once_get): New macro.
+
 2012-05-09  Chung-Lin Tang  <cltang@codesourcery.com>
 
        * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index d08fb9db3c75a1b97425398b212bf1859ee56bfe..0ebac917d7526b13e393a01963888f7c477bdadd 100644 (file)
@@ -257,6 +257,8 @@ typedef pthread_key_t __libc_key_t;
     }                                                                        \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL)  ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
 
 /* Note that for I/O cleanup handling we are using the old-style
    cancel handling.  It does not have to be integrated with C++ snce
index 0a627e75ff836e0a78ca1dc102885643cc7068a5..110e25e9656424d9d363b2d793897e1a35f1a906 100644 (file)
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  Mach cthreads version.
-   Copyright (C) 1996,97,98,2000,01, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -115,6 +115,9 @@ struct __libc_once
     __libc_lock_unlock (ONCE_CONTROL.lock);                                  \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL)  ((ONCE_CONTROL).done != 0)
+
 #ifdef _LIBC
 /* We need portable names for some functions.  E.g., when they are
    used as argument to __libc_cleanup_region_start.  */
index af531da54f8cf10369348dfcb16461053bf9596c..d18a10c457bfa67f19942baac1ffd06934dbcc57 100644 (file)
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  Hurd version using Mach cthreads.
-   Copyright (C) 1996,97,98,2000,01, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -187,6 +187,9 @@ struct __libc_once
     __libc_lock_unlock (ONCE_CONTROL.lock);                                  \
   } while (0)
 
+/* Get once control variable.  */
+#define __libc_once_get(ONCE_CONTROL)  ((ONCE_CONTROL).done != 0)
+
 #ifdef _LIBC
 /* We need portable names for some functions.  E.g., when they are
    used as argument to __libc_cleanup_region_start.  */
index 1a023f91f52c21c42ad572eaaef5a304040aa2f7..2eca2ae0e406474191a03634897e2ec0a11a598a 100644 (file)
@@ -2604,7 +2604,7 @@ getaddrinfo (const char *name, const char *service,
          __libc_lock_define_initialized (static, lock);
 
          __libc_lock_lock (lock);
-         if (old_once && gaiconf_reload_flag)
+         if (__libc_once_get (old_once) && gaiconf_reload_flag)
            gaiconf_reload ();
          qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src);
          __libc_lock_unlock (lock);