View | Details | Raw Unified | Return to bug 3748
Collapse All | Expand All

(-)sysdeps/posix/getaddrinfo.c (-4 / +6 lines)
Lines 2031-2041 getaddrinfo (const char *name, const cha Link Here
2031
  if (naddrs > 1)
2031
  if (naddrs > 1)
2032
    {
2032
    {
2033
      /* Read the config file.  */
2033
      /* Read the config file.  */
2034
      void _gaiconf_reload (void)
2035
	{
2036
	  if (gaiconf_reload_flag)
2037
	    gaiconf_reload ();
2038
	}
2034
      __libc_once_define (static, once);
2039
      __libc_once_define (static, once);
2035
      __typeof (once) old_once = once;
2040
      __libc_once_else (once, gaiconf_init, _gaiconf_reload);
2036
      __libc_once (once, gaiconf_init);
2037
      if (old_once && gaiconf_reload_flag)
2038
	gaiconf_reload ();
2039
2041
2040
      /* Sort results according to RFC 3484.  */
2042
      /* Sort results according to RFC 3484.  */
2041
      struct sort_result results[nresults];
2043
      struct sort_result results[nresults];
(-)bits/libc-lock.h (-2 / +12 lines)
Lines 1-5 Link Here
1
/* libc-internal interface for mutex locks.  Stub version.
1
/* libc-internal interface for mutex locks.  Stub version.
2
   Copyright (C) 1996,97,99,2000-2002,2003 Free Software Foundation, Inc.
2
   Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2006
3
     Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
   This file is part of the GNU C Library.
4
5
5
   The GNU C Library is free software; you can redistribute it and/or
6
   The GNU C Library is free software; you can redistribute it and/or
Lines 89-95 Link Here
89
/* Define once control variable.  */
90
/* Define once control variable.  */
90
#define __libc_once_define(CLASS, NAME) CLASS int NAME = 0
91
#define __libc_once_define(CLASS, NAME) CLASS int NAME = 0
91
92
92
/* Call handler iff the first call.  */
93
/* Call INIT_FUNCTION iff the first call.  */
93
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
94
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
94
  do {									      \
95
  do {									      \
95
    if ((ONCE_CONTROL) == 0) {						      \
96
    if ((ONCE_CONTROL) == 0) {						      \
Lines 98-103 Link Here
98
    }									      \
99
    }									      \
99
  } while (0)
100
  } while (0)
100
101
102
/* Call INIT_FUNCTION iff the first call.  Otherwise call ELSE_FUNCTION.  */
103
#define __libc_once_else(ONCE_CONTROL, INIT_FUNCTION, ELSE_FUNCTION) \
104
  do {									      \
105
    if ((ONCE_CONTROL) == 1)						      \
106
      (ELSE_FUNCTION) ();						      \
107
    else								      \
108
      __libc_once (ONCE_CONTROL, INIT_FUNCTION);			      \
109
  } while (0)
110
101
111
102
/* Start a critical region with a cleanup function */
112
/* Start a critical region with a cleanup function */
103
#define __libc_cleanup_region_start(DOIT, FCT, ARG)			    \
113
#define __libc_cleanup_region_start(DOIT, FCT, ARG)			    \
(-)sysdeps/mach/bits/libc-lock.h (-2 / +11 lines)
Lines 105-112 struct __libc_once Link Here
105
#define __libc_once_define(CLASS,NAME) \
105
#define __libc_once_define(CLASS,NAME) \
106
  CLASS struct __libc_once NAME = { MUTEX_INITIALIZER, 0 }
106
  CLASS struct __libc_once NAME = { MUTEX_INITIALIZER, 0 }
107
107
108
108
/* Call INIT_FUNCTION iff the first call.  */
109
/* Call handler iff the first call.  */
110
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
109
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
111
  do {									      \
110
  do {									      \
112
    __libc_lock_lock (ONCE_CONTROL.lock);				      \
111
    __libc_lock_lock (ONCE_CONTROL.lock);				      \
Lines 116-121 struct __libc_once Link Here
116
    __libc_lock_unlock (ONCE_CONTROL.lock);				      \
115
    __libc_lock_unlock (ONCE_CONTROL.lock);				      \
117
  } while (0)
116
  } while (0)
118
117
118
/* Call INIT_FUNCTION iff the first call.  Otherwise call ELSE_FUNCTION.  */
119
#define __libc_once_else(ONCE_CONTROL, INIT_FUNCTION, ELSE_FUNCTION) \
120
  do {									      \
121
    if (ONCE_CONTROL.done == 1)						      \
122
      (ELSE_FUNCTION) ();						      \
123
    else								      \
124
      __libc_once (ONCE_CONTROL, INIT_FUNCTION);			      \
125
  } while (0)
126
127
119
#ifdef _LIBC
128
#ifdef _LIBC
120
/* We need portable names for some functions.  E.g., when they are
129
/* We need portable names for some functions.  E.g., when they are
121
   used as argument to __libc_cleanup_region_start.  */
130
   used as argument to __libc_cleanup_region_start.  */
(-)sysdeps/mach/hurd/bits/libc-lock.h (-1 / +11 lines)
Lines 175-181 struct __libc_once Link Here
175
#define __libc_once_define(CLASS,NAME) \
175
#define __libc_once_define(CLASS,NAME) \
176
  CLASS struct __libc_once NAME = { MUTEX_INITIALIZER, 0 }
176
  CLASS struct __libc_once NAME = { MUTEX_INITIALIZER, 0 }
177
177
178
/* Call handler iff the first call.  */
178
/* Call INIT_FUNCTION iff the first call.  */
179
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
179
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
180
  do {									      \
180
  do {									      \
181
    __libc_lock_lock (ONCE_CONTROL.lock);				      \
181
    __libc_lock_lock (ONCE_CONTROL.lock);				      \
Lines 185-190 struct __libc_once Link Here
185
    __libc_lock_unlock (ONCE_CONTROL.lock);				      \
185
    __libc_lock_unlock (ONCE_CONTROL.lock);				      \
186
  } while (0)
186
  } while (0)
187
187
188
/* Call INIT_FUNCTION iff the first call.  Otherwise call ELSE_FUNCTION.  */
189
#define __libc_once_else(ONCE_CONTROL, INIT_FUNCTION, ELSE_FUNCTION) \
190
  do {									      \
191
    if (ONCE_CONTROL.done == 1)						      \
192
      ELSE_FUNCTION ();							      \
193
    else								      \
194
      __libc_once (ONCE_CONTROL, INIT_FUNCTION);			      \
195
  } while (0)
196
197
188
#ifdef _LIBC
198
#ifdef _LIBC
189
/* We need portable names for some functions.  E.g., when they are
199
/* We need portable names for some functions.  E.g., when they are
190
   used as argument to __libc_cleanup_region_start.  */
200
   used as argument to __libc_cleanup_region_start.  */
(-)nptl/sysdeps/pthread/bits/libc-lock.h (-1 / +10 lines)
Lines 350-356 typedef pthread_key_t __libc_key_t; Link Here
350
  CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
350
  CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
351
#endif
351
#endif
352
352
353
/* Call handler iff the first call.  */
353
/* Call INIT_FUNCTION iff the first call.  */
354
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
354
#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
355
  do {									      \
355
  do {									      \
356
    if (PTF(__pthread_once) != NULL)					      \
356
    if (PTF(__pthread_once) != NULL)					      \
Lines 361-366 typedef pthread_key_t __libc_key_t; Link Here
361
    }									      \
361
    }									      \
362
  } while (0)
362
  } while (0)
363
363
364
/* Call INIT_FUNCTION iff the first call.  Otherwise call ELSE_FUNCTION.  */
365
#define __libc_once_else(ONCE_CONTROL, INIT_FUNCTION, ELSE_FUNCTION) \
366
  do {									      \
367
    if ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)				      \
368
      (ELSE_FUNCTION) ();						      \
369
    else								      \
370
      __libc_once (ONCE_CONTROL, INIT_FUNCTION);			      \
371
  } while (0)
372
364
373
365
/* Note that for I/O cleanup handling we are using the old-style
374
/* Note that for I/O cleanup handling we are using the old-style
366
   cancel handling.  It does not have to be integrated with C++ snce
375
   cancel handling.  It does not have to be integrated with C++ snce

Return to bug 3748