Update.
[kopensolaris-gnu/glibc.git] / nptl / ChangeLog
1 2003-01-14  Ulrich Drepper  <drepper@redhat.com>
2
3         * sem_open.c (sem_open): Return SEM_FAILED if existing semaphore
4         must be used and mapping failed.
5         Reported by Luke Elliott <luke.elliott@activfinancial.com>.
6
7         * Makefile (CFLAGS-pthread_self.os): Define this, not
8         CFLAGS-pthread_self.c.
9
10 2003-01-13  Ulrich Drepper  <drepper@redhat.com>
11
12         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Don't export
13         lll_unlock_wake_cb.
14
15         * Makefile (libpthread-routines): Add version.  Add rules to build
16         version.os and banner.h.
17         * version.c: New file.
18
19 2003-01-13  Jakub Jelinek  <jakub@redhat.com>
20
21         * pthread_mutex_lock.c (__pthread_mutex_lock_internal): Make
22         the alias unconditional.
23         * pthread_mutex_unlock.c  (__pthread_mutex_unlock_internal): Likewise.
24
25 2003-01-13  Ulrich Drepper  <drepper@redhat.com>
26
27         * Makefile (CFLAGS-pthread_self.c): New definition.
28
29 2003-01-06  Jakub Jelinek  <jakub@redhat.com>
30
31         * sysdeps/pthread/pthread_sigmask.c (pthread_sigmask): Add
32         INTERNAL_SYSCALL_DECL, add err argument to INTERNAL_SYSCALL* macros.
33         * sysdeps/unix/sysv/linux/raise.c (raise): Likewise.
34         * init.c (__pthread_initialize_minimal_internal): Likewise.
35
36 2003-01-07  Jakub Jelinek  <jakub@redhat.com>
37
38         * pthreadP.h (__pthread_cond_timedwait): Add prototype.
39
40         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h
41         (RTLD_CORRECT_DYNAMIC_WEAK): Remove.
42         (DL_SYSINFO_IMPLEMENTATION): Change into .text section and back.
43         * sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h
44         (RTLD_CORRECT_DYNAMIC_WEAK): Remove.
45         (DL_SYSINFO_IMPLEMENTATION): Change into .text section and back.
46
47 2003-01-06  Jakub Jelinek  <jakub@redhat.com>
48
49         * pthreadP.h (LIBC_CANCEL_HANDLED): Define.
50         * pt-system.c (LIBC_CANCEL_HANDLED): Add.
51         * tst-cancel-wrappers.sh: Remove all exceptions.
52
53 2003-01-05  Ulrich Drepper  <drepper@redhat.com>
54
55         * tst-cancel-wrappers.sh: Invoke gawk not awk since we use GNU awk
56         features.  Reported by Marijn Ros <marijn@mad.scientist.com>.
57
58         * sysdeps/unix/sysv/linux/jmp-unwind.c: Include <pthread-functions.h>.
59         Use __libc_pthread_functions array if SHARED.
60
61         * pthreadP.h: Move pthread_cond_2_0_t definition to...
62         * sysdeps/unix/sysv/linux/internaltypes.h: ...here.
63
64         * sysdeps/pthread/bits/libc-lock.h (__libc_ptf_call): New #define.
65         (__libc_rwlock_rdlock, __libc_rwlock_wrlock, __libc_rwlock_unlock,
66         __libc_key_create, __libc_getspecific, __libc_setspecific): Use
67         __libc_ptf_call instead of __libc_maybe_call.
68         (PTF): New #define.
69         (__libc_cleanup_region_start): Wrap function name with PTF call.
70         (__libc_cleanup_region_end): Likewise.
71         (__libc_cleanup_end): Likewise.
72
73         * pthread_getspecific.c: Add __pthread_getspecific_internal alias.
74         * pthread_setspecific.c: Add __pthread_setspecific_internal alias.
75         * pthread_key_create.c: Add __pthread_key_create_internal alias.
76         * pthreadP.h: Add prototypes.
77
78         * sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S: Add
79         __pthread_rwlock_rdlock, __pthread_rwlock_wrlock, and
80         __pthread_rwlock_unlock aliases.
81         * pthreadP.h: Add prototypes for new aliases.
82
83         * pthreadP.h (struct pthead_functions): Moved to...
84         * sysdeps/pthread/pthread-functions.h: ...here.  New file.
85         * init.c (pthread_functions): Add initializers for new elements.
86
87         * cleanup_defer.c: Add __pthread_cleanup_push_defer and
88         __pthread_cleanup_pop_restore aliases.
89         * pthreadP.h: Add prototypes.
90
91         * cleanup.c: Rename _GI_pthread_cleanup_push to __pthread_cleanup_push
92         and _GI_pthread_cleanup_pop to __pthread_cleanup_pop.
93         * sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S: Adjust caller.
94         * sysdeps/unix/sysv/linux/i386/pthread_once.S: Likewise.
95         * sysdeps/unix/sysv/linux/x86_64/pthread_once.S: Likewise.
96         * pthreadP.h: Adjust prototypes and callers.
97
98 2003-01-04  Ulrich Drepper  <drepper@redhat.com>
99
100         * Makefile (tests): Add tst-cancel7.
101         (tst-cancel7-ARGS): New variable.
102         * tst-cancel7.c: New file.
103
104         * old_pthread_cond_broadcast.c: Optimize initialization a bit to work
105         around gcc defficiencies.
106         * old_pthread_cond_signal.c: Likewise.
107         * old_pthread_cond_timedwait.c: Likewise.
108         * old_pthread_cond_wait.c: Likewise.
109
110         * pthreadP.h (pthread_cond_2_0_t): Remove unneeded lock element.
111
112 2003-01-03  Ulrich Drepper  <drepper@redhat.com>
113
114         * Makefile (tests): Add tst-cond7.
115         * tst-cond7.c: New file.
116
117         * sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S
118         (condvar_cleanup): Get condvar address from the right place.
119
120         * atomic.h: Correct definitions of atomic_full_barrier,
121         atomic_read_barrier, atomic_write_barrier.
122
123         * old_pthread_cond_broadcast.c: Make memory allocate and initialization
124         race-free.
125         * old_pthread_cond_signal.c: Likewise.
126         * old_pthread_cond_timedwait.c: Likewise.
127         * old_pthread_cond_wait.c: Likewise.
128
129 2003-01-03  Jakub Jelinek  <jakub@redhat.com>
130
131         * Makefile ($(objpfx)libpthread.so): Depend on ld.so.
132
133 2003-01-03  Ulrich Drepper  <drepper@redhat.com>
134
135         * pthreadP.h (pthread_cond_2_0_t): New type.
136         (struct pthread_functions): Use new type for 2.0 condvar callbacks.
137         Use new type for the 2.0 condvar function prototypes.
138         * forward.c: Use pthread_cond_2_0_t for 2.0 condvar functions.
139         * old_pthread_cond_init.c: Use pthread_cond_2_0_t for condvar
140         parameter.
141         * old_pthread_cond_destroy.c: Likewise.
142         * old_pthread_cond_broadcast.c: Likewise.  Lock appropriately.
143         * old_pthread_cond_signal.c: Likewise.
144         * old_pthread_cond_timedwait.c: Likewise.
145         * old_pthread_cond_wait.c: Likewise.
146
147         * sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S
148         (__pthread_cond_wait): Don't save cancellation mode and seq value
149         in same location.
150
151         * herrno.c (__h_errno_location): Don't define as weak.
152
153 2003-01-02  Jakub Jelinek  <jakub@redhat.com>
154
155         * Versions [libc] (GLIBC_2.3.2): Export pthread_cond_broadcast,
156         pthread_cond_destroy, pthread_cond_init, pthread_cond_signal
157         and pthread_cond_wait.
158         * old_pthread_cond_broadcast.c (__old_pthread_cond_broadcast):
159         Renamed to...
160         (__pthread_cond_broadcast_2_0): ... this.
161         * old_pthread_cond_destroy.c (__old_pthread_cond_destroy):
162         Renamed to...
163         (__pthread_cond_destroy_2_0): ... this.
164         * old_pthread_cond_init.c (__old_pthread_cond_init):
165         Renamed to...
166         (__pthread_cond_init_2_0): ... this.
167         * old_pthread_cond_signal.c (__old_pthread_cond_signal):
168         Renamed to...
169         (__pthread_cond_signal_2_0): ... this.
170         * old_pthread_cond_wait.c (__old_pthread_cond_wait):
171         Renamed to...
172         (__pthread_cond_wait_2_0): ... this.
173         * pthread_cond_destroy.c: Include shlib-compat.h.
174         (pthread_cond_destroy): Change strong_alias into versioned_symbol.
175         * pthread_cond_init.c: Include shlib-compat.h.
176         (pthread_cond_init): Change strong_alias into versioned_symbol.
177         * pthreadP.h (struct pthread_functions): Rename ptr_pthread_cond_*
178         fields to ptr___pthread_cond_* and add ptr___pthread_cond_*_2_0
179         fields.
180         (__pthread_cond_broadcast_2_0, __pthread_cond_destroy_2_0,
181         __pthread_cond_init_2_0, __pthread_cond_signal_2_0,
182         __pthread_cond_wait_2_0): New prototypes.
183         (__old_pthread_cond_broadcast, __old_pthread_cond_destroy,
184         __old_pthread_cond_init, __old_pthread_cond_signal,
185         __old_pthread_cond_wait): Removed.
186         * init.c: Include shlib-compat.h.
187         (pthread_functions): Guard ptr___pthread_attr_init_2_0
188         initialization with SHLIB_COMPAT (GLIBC_2_0, GLIBC_2_1).
189         Rename ptr_pthread_cond_* to ptr___pthread_cond_*, initialize
190         ptr___pthread_cond_*_2_0 fields.
191         * forward.c: Export both pthread_cond_*@@GLIBC_2.3.2 and
192         pthread_cond_*@GLIBC_2.0 compatibility symbols.
193
194         * sysdeps/pthread/sigaction.c (SIGCANCEL): Only define if
195         LIBC_SIGACTION was not yet defined.
196         [!defined LIBC_SIGACTION]: Define LIBC_SIGACTION, #include self.
197         [!defined LIBC_SIGACTION] (__sigaction): New function and
198         libc_hidden_weak.
199         [!defined LIBC_SIGACTION] (sigaction): New weak_alias.
200         [defined LIBC_SIGACTION]: #include_next <sigaction.c>.
201
202 2003-01-02  Jakub Jelinek  <jakub@redhat.com>
203
204         * Makefile (CFLAGS-pthread_atfork.c): Add -DNOT_IN_libc.
205
206 2003-01-02  Ulrich Drepper  <drepper@redhat.com>
207
208         * sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h (pthread_cond_t):
209         New, larger type definition.
210         * sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S: New condvar
211         implementation.
212         * Versions [libpthread]: Add definitions for new pthread_cond_*
213         interfaces for version GLIBC_2.3.2.
214         * pthread_cond_init.c: Update initialization for new type definition.
215         * Makefile (libpthread-routines): Remove pthread_cond_wait,
216         pthread_cond_timedwait, pthread_cond_signal, and
217         pthread_cond_broadcast.  Add old_pthread_cond_init,
218         old_pthread_cond_destroy, old_pthread_cond_wait,
219         old_pthread_cond_timedwait, old_pthread_cond_signal, and
220         old_pthread_cond_broadcast.
221         * old_pthread_cond_broadcast.c: New file.
222         * old_pthread_cond_destroy.c: New file.
223         * old_pthread_cond_init.c: New file.
224         * old_pthread_cond_signal.c: New file.
225         * old_pthread_cond_timedwait.c: New file.
226         * old_pthread_cond_wait.c: New file.
227         * pthreadP.h: Add prototypes for the compatibility interfaces.
228
229         * pthread_cond_destroy.c: Don't include <errno.h>.
230
231 2003-01-01  Ulrich Drepper  <drepper@redhat.com>
232
233         * sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S: Avoid
234         unnecessary zero offset when addressing MUTEX.
235
236 2002-12-31  Ulrich Drepper  <drepper@redhat.com>
237
238         * sysdeps/unix/sysv/linux/fork.h: Add libc_hidden_proto for
239         __register_atfork.
240         * sysdeps/unix/sysv/linux/register-atfork.c: Add libc_hidden_def
241         for __register_atfork.
242
243 2002-12-31  Jakub Jelinek  <jakub@redhat.com>
244
245         * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Use __ASSEMBLER__
246         instead of ASSEMBLER test macro.
247
248         * sysdeps/unix/sysv/linux/allocrtsig.c (__libc_current_sigrtmin,
249         __libc_current_sigrtmax): Add libc_hidden_def.
250
251         * sysdeps/pthread/list.h: Remove assert.h include.
252
253 2002-12-31  Ulrich Drepper  <drepper@redhat.com>
254
255         * sysdeps/pthread/pt-initfini.c (call_initialize_minimal): Use
256         __pthread_initialize_minimal_internal not
257         __pthread_initialize_minimal.
258
259 2002-12-30  Ulrich Drepper  <drepper@redhat.com>
260
261         * sysdeps/pthread/pt-initfini.c (call_initialize_minimal): Mark
262         __pthread_initialize_minimal as hidden.
263
264         * init.c (__pthread_initialize_minimal_internal): Don't mark as
265         constructor.
266
267 2002-12-31  Jakub Jelinek  <jakub@redhat.com>
268
269         * Makefile ($(inst_libdir)/libpthread.so): Depend on
270         $(common-objpfx)format.lds, include that into the output script.
271         Fix comment.
272         (extra-B-pthread.so): Change linuxthreads/ into nptl/.
273
274 2002-12-28  Andreas Jaeger  <aj@suse.de>
275
276         * sysdeps/unix/sysv/linux/xstatconv.c (xstat_conv): Adjust for
277         nsec resolution changes.
278         (xstat64_conv): Likewise.
279         (xstat32_conv): Likewise.
280         * sysdeps/unix/sysv/linux/kernel_stat.h: Add nsec resolution for
281         struct kernel_stat.
282         * sysdeps/unix/sysv/linux/bits/stat.h: Add nsec resolution for
283         structs stat and stat64.
284         * time/time.h (__timespec_defined): Define for __USE_MISC.
285         * io/sys/stat.h [__USE_MISC]: Define __need_timespec for struct stat.
286
287 2002-12-30  Jakub Jelinek  <jakub@redhat.com>
288
289         * forward.c (FORWARD2): Renamed from FORWARD3.  Remove unused export
290         argument.
291         (pthread_attr_init_2_0, pthread_attr_init_2_1): Use FORWARD macro.
292         (pthread_exit): Use strong_alias to avoid warnings.
293         * pthreadP.h (struct pthread_functions): Rename ptr_pthread_exit
294         and ptr_pthread_attr_init_2_* to ptr___pthread_exit and
295         ptr___pthread_attr_init_2_*.
296         * init.c (pthread_functions): Adjust.
297
298 2002-12-29  Ulrich Drepper  <drepper@redhat.com>
299
300         * forward.c: Make all functions available by default again.  It
301         caused too much trouble.
302
303         * pt-siglongjmp.c: Removed.
304
305 2002-12-28  Jakub Jelinek  <jakub@redhat.com>
306
307         * sysdeps/i386/tls.h: Include tcb-offsets.h in assembler.
308         (SYSINFO_OFFSET, MULTIPLE_THREADS_OFFSET): Remove.
309         * sysdeps/i386/Makefile: New file.
310         * sysdeps/i386/tcb-offsets.sym: New file.
311         * sysdeps/pthread/tcb-offsets.h: New file.
312         * sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
313         Remove MULTIPLE_THREADS_OFFSET and SYSINFO_OFFSET checks.
314
315         * sysdeps/unix/sysv/linux/Versions [libc] (GLIBC_PRIVATE): Move
316         __register_atfork...
317         (GLIBC_2.3.2): ...here.
318
319 2002-12-28  Ulrich Drepper  <drepper@redhat.com>
320
321         * sysdeps/pthread/pthread.h: Mark pthread_attr_getstackaddr and
322         pthread_attr_setstackaddr with __attribute_deprecated__.
323
324 2002-12-27  Jakub Jelinek  <jakub@redhat.com>
325
326         * pt-system.c (system): Remove cancellation handling.
327         * tst-cancel-wrappers.sh: Allow pt-system.o* to not use the
328         cancellation routines.
329
330 2002-12-28  Ulrich Drepper  <drepper@redhat.com>
331
332         * descr.h: Include <dl-sysdep.h>.
333         (struct pthread): Move header.data.list to the back of the struct.
334         * sysdeps/i386/tls.h (tcbhead_t): Move list to the back of the struct.
335         (MULTIPLE_THREADS_OFFSET): Adjust offset.
336         (SYSINFO_OFFSEET): Likewise.
337
338 2002-12-27  Jakub Jelinek  <jakub@redhat.com>
339
340         * sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h (USE_DL_SYSINFO):
341         Define.
342         (DL_SYSINFO_DEFAULT): Cast to uintptr_t to avoid warnings.
343         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h (NEED_DL_SYSINFO,
344         DL_SYSINFO_DEFAULT, DL_SYSINFO_IMPLEMENTATION): Define.
345         (USE_DL_SYSINFO): Undef.
346
347 2002-12-22  Jakub Jelinek  <jakub@redhat.com>
348
349         * Makefile (tests-reverse): Use $(objpfx)../libc.so instead of
350         $(common-objpfx)libc.so.
351         * tst-cancel4.c (tf_write, tf_writev): Increase buf sizes so that
352         it is bigger than pipe buffer size even on arches with bigger
353         page size.
354         (tf_usleep): Cast usleep argument to useconds_t to avoid warnings.
355
356 2002-12-25  Ulrich Drepper  <drepper@redhat.com>
357
358         * sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Implement
359         correct errno access for case that USE___THREAD is not defined.
360
361 2002-12-24  Ulrich Drepper  <drepper@redhat.com>
362
363         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h: Add missing #endif.
364         Patch by Marijn Ros <marijn@mad.scientist.com>.
365
366 2002-12-22  Roland McGrath  <roland@redhat.com>
367
368         * Makefile (omit-deps): Add $(unix-syscalls:%=ptw-%).
369
370 2002-12-20  Ulrich Drepper  <drepper@redhat.com>
371
372         * sysdeps/pthread/bits/stdio-lock.h (_IO_lock_inexpensive): Define.
373
374 2002-12-19  Ulrich Drepper  <drepper@redhat.com>
375
376         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h: Don't define
377         NEED_DL_SYSINFO since no processor < i686 had the sysenter opcode.
378         * sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h: New file.
379
380         * sysdeps/unix/sysv/linux/i386/pthread_once.S: Use ENTER_KERNEL instead
381         of int $0x80.
382         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
383         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S: Likewise.
384         * sysdeps/unix/sysv/linux/i386/i486/lowlevelcond.S: Likewise.
385         * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
386         * sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S: Likewise.
387         * sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S: Likewise.
388         * sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Likewise.
389         * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.
390
391         * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Add support for using
392         sysenter.
393         * sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Likewise.
394
395         * sysdeps/i386/tls.h: Unconditionally include <dl-sysdep.h>.
396
397         * allocatestack.c (allocate_stack) [NEED_DL_SYSINFO]: Set sysinfo
398         in new TCB.
399         * sysdeps/unix/sysv/linux/i386/createthread.c (create_thread): Check
400         that sysinfo is properly initialized.
401         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h: Define RTLD_PRIVATE_ERRNO
402         to 1 only for ld.so.
403
404         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h: Define
405         RTLD_CORRECT_DYNAMIC_WEAK.
406
407 2002-12-19  Jakub Jelinek  <jakub@redhat.com>
408
409         * forward.c (pthread_attr_init_2_0, pthread_attr_init_2_1):
410         Use return 0 as 6th argument to FORWARD4.
411         * pthread_equal.c: Include pthreadP.h instead of pthread.h.
412
413 2002-12-18  Ulrich Drepper  <drepper@redhat.com>
414
415         * descr.h (struct pthread) [NEED_DL_SYSINFO]: Add sysinfo member.
416         * sysdeps/i386/tls.h (tcbhead_t): Add sysinfo member.
417         Define SYSINFO_OFFSEET if NEED_DL_SYSINFO is defined.
418         (INIT_SYSINFO): New #define.
419         (TLS_TP_INIT): Use INIT_SYSINFO.
420         * sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
421         At test to make sure SYSINFO_OFFSET value is correct.
422         * sysdeps/unix/sysv/linux/i386/dl-sysdep.h: New file.
423
424 2002-12-18  Jakub Jelinek  <jakub@redhat.com>
425
426         * sysdeps/pthread/flockfile.c (flockfile): Change into weak alias.
427         * sysdeps/unix/sysv/linux/raise.c (gsignal): Add weak alias to raise.
428         * Versions [libc: GLIBC_2.0]: Add pthread_attr_init.
429         [libpthread: GLIBC_2.1]: Remove __pthread_rwlock_init,
430         __pthread_rwlock_destroy, __pthread_rwlock_rdlock,
431         __pthread_rwlock_wrlock, __pthread_rwlock_unlock,
432         __pthread_rwlock_tryrdlock and __pthread_rwlock_trywrlock.
433
434 2002-12-18  Ulrich Drepper  <drepper@redhat.com>
435
436         * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Use ENTER_KERNEL
437         macro instead of using int $0x80 directly.
438
439         * sysdeps/pthread/bits/stdio-lock.h: New file.
440         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevelmutex.S: New file.
441         * sysdeps/unix/sysv/linux/i386/i586/libc-lowlevelmutex.S: New file.
442         * sysdeps/unix/sysv/linux/i386/i686/libc-lowlevelmutex.S: New file.
443         * Makefile (routines): Add libc-lowlevelmutex.
444
445         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Remove
446         __i686.get_pc_thunk.dx.
447
448 2002-12-17  Jakub Jelinek  <jakub@redhat.com>
449
450         * Makefile (libpthread-shared-only-routines): Add pt-allocrtsig.
451         (tests): Depend on $(objpfx)tst-cancel-wrappers.out.
452         ($(objpfx)tst-cancel-wrappers.out): New rule.
453         * tst-cancel-wrappers.sh: New test.
454         * tst-locale1.c: Include signal.h.
455         (uselocale): Test static linking of __libc_current_sigrt*.
456
457 2002-12-17  Ulrich Drepper  <drepper@redhat.com>
458
459         * Makefile (tests): Add tst-cancel6.
460         * tst-cancel6.c: New file
461
462 2002-12-17  Jakub Jelinek  <jakub@redhat.com>
463
464         * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (SINGLE_THREAD_P):
465         Define meaningfully for assembler as well.
466         * pthreadP.h (struct pthread_functions): Remove
467         ptr_pthread_attr_init field.  Add ptr_pthread_attr_init_2_0
468         and ptr_pthread_attr_init_2_1 fields.
469         * init.c (pthread_functions): Initialize ptr_pthread_attr_init_2_0
470         and ptr_pthread_attr_init_2_1 instead of ptr_pthread_attr_init.
471         * forward.c (FORWARD4): Renamed from FORWARD3. Add export argument.
472         (FORWARD3): Define using FORWARD4.
473         (pthread_attr_init): Provide both @GLIBC_2.0 and @@GLIBC_2.1
474         versions.
475         * pt-system.c: Remove duplicate stdlib.h include.
476
477 2002-12-16  Ulrich Drepper  <drepper@redhat.com>
478
479         * sem_init.c: Define sem_init@GLIBC_2.0.
480         * sem_destroy.c: Define sem_destroy@GLIBC_2.0.
481         * sem_getvalue.c: Define sem_getvalue@GLIBC_2.0.
482
483         * flockfile.c: Moved to...
484         * sysdeps/pthread/flockfile.c: ...here.  New file.
485         * funlockfile.c: Moved to...
486         * sysdeps/pthread/funlockfile.c: ...here.  New file.
487         * ftrylockfile.c: Moved to...
488         * sysdeps/pthread/ftrylockfile.c: ...here.  New file.
489
490 2002-12-16  Jakub Jelinek  <jakub@redhat.com>
491
492         * libc-cancellation.c: Guard both function with
493         #if !defined NOT_IN_libc.
494         * Makefile (libpthread-routines): Use ptw-, not pt- prefix for the
495         automatically provided pthread wrappers.
496         * pthreadP.h (LIBC_CANCEL_ASYNC, LIBC_CANCEL_RESET): Define to
497         CANCEL_* if IS_IN_libpthread and to dummy versions if not in libc
498         nor in libpthread.
499         * pt-open.c: Removed.
500         * pt-fcntl.c: Removed.
501         * pt-fsync.c: Removed.
502         * pt-lseek.c: Removed.
503         * pt-msgrcv.c: Removed.
504         * pt-msgsnd.c: Removed.
505         * pt-msync.c: Removed.
506         * pt-nanosleep.c: Removed.
507         * pt-open64.c: Removed.
508         * pt-pause.c: Removed.
509         * pt-pread.c: Removed.
510         * pt-pread64.c: Removed.
511         * pt-pwrite.c: Removed.
512         * pt-pwrite64.c: Removed.
513         * pt-read.c: Removed.
514         * pt-recv.c: Removed.
515         * pt-recvfrom.c: Removed.
516         * pt-recvmsg.c: Removed.
517         * pt-send.c: Removed.
518         * pt-sendto.c: Removed.
519         * pt-sigtimedwait.c: Removed.
520         * pt-sigwait.c: Removed.
521         * pt-wait.c: Removed.
522         * pt-waitpid.c: Removed.
523         * pt-write.c: Removed.
524         * pt-accept.c: Removed.
525         * pt-close.c: Removed.
526         * pt-connect.c: Removed.
527         * pt-lseek64.c: Removed.
528         * pt-sendmsg.c: Removed.
529         * pt-tcdrain.c: Removed.
530
531 2002-12-15  Ulrich Drepper  <drepper@redhat.com>
532
533         * init.c (__pthread_initialize_minimal_internal): Renamed from
534         __pthread_initialize_minimal.  Make old name an alias.  This
535         converts a normal relocation into a relative relocation.
536
537         * pt-fcntl.c (__fcntl): Use fcntl64 syscall, not fcntl.
538
539         * Versions [libpthread: GLIBC_2.3.2]: Remove creat, poll, pselect,
540         readv, select, sigpause, sigsuspend, sigwaitinfo, waitid, writev.
541         * Makefile (libpthread-routines): Remove pt-creat, pt-poll,
542         pt-pselect, pt-readv, pt-select, pt-sigpause, pt-sigsuspend,
543         pt-sigwaitinfo, pt-waitid, and pt-writev.
544         * pt-creat.c: Removed.
545         * pt-poll.c: Removed.
546         * pt-pselect.c: Removed.
547         * pt-readv.c: Removed.
548         * pt-select.c: Removed.
549         * pt-sigpause.c: Removed.
550         * pt-sigsuspend.c: Removed.
551         * pt-sigwaitinfo.c: Removed.
552         * pt-waitid.c: Removed.
553         * pt-writev.c: Removed.
554
555         * init.c (pthread_functions): New variable.
556         (__pthread_initialize_minimal): Pass pointer to pthread_functions
557         (or NULL) to __libc_pthread_init.
558         * forward.c: Rewrite to use __libc:pthread_functions array to get
559         function addresses.
560         * sysdeps/unix/sysv/linux/fork.h: Remove __libc_pthread_init
561         prototype.
562         * sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
563         Take new parameter.  Copy content of variable pointed to by it
564         to __libc_pthread_init.
565
566         * pthreadP.h (struct pthread_functions): New type.
567         (__libc_pthread_init): Declare.
568
569         * pthread_attr_destroy.c: Add namespace protected alias.
570         * pthread_attr_getdetachstate.c: Likewise.
571         * pthread_attr_getinheritsched.c: Likewise.
572         * pthread_attr_getschedparam.c: Likewise.
573         * pthread_attr_getschedpolicy.c: Likewise.
574         * pthread_attr_getscope.c: Likewise.
575         * pthread_attr_setdetachstate.c: Likewise.
576         * pthread_attr_setinheritsched.c: Likewise.
577         * pthread_attr_setschedparam.c: Likewise.
578         * pthread_attr_setschedpolicy.c: Likewise.
579         * pthread_attr_setscope.c: Likewise.
580         * pthread_cond_broadcast.c: Likewise.
581         * pthread_cond_destroy.c: Likewise.
582         * pthread_cond_init.c: Likewise.
583         * pthread_cond_signal.c: Likewise.
584         * pthread_cond_wait.c: Likewise.
585         * pthread_condattr_destroy.c: Likewise.
586         * pthread_condattr_init.c: Likewise.
587         * pthread_equal.c: Likewise.
588         * pthread_exit.c: Likewise.
589         * pthread_getschedparam.c: Likewise.
590         * pthread_self.c: Likewise.
591         * pthread_setcancelstate.c: Likewise.
592         * pthread_setschedparam.c: Likewise.
593         * pthread_mutex_destroy.c: Likewise.
594         * pthread_mutex_init.c: Likewise.
595         * pthreadP.h: Add prototypes for the aliases.
596
597         * sysdeps/unix/sysv/linux/i386/createthread.c (create_thread): Set
598         multiple_threads member in correct TCB to 1.
599
600         * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Define
601         SINGLE_THREAD_P.  If in libc or libpthread examine multiple_thread
602         member of thread decriptor, otherwise return unconditionally 1.
603
604 2002-12-14  Ulrich Drepper  <drepper@redhat.com>
605
606         * sysdeps/unix/sysv/linux/i386/pt-socket.S: Changes folded into the
607         regular Linux version.  Remove file.
608         * sysdeps/unix/sysv/linux/connect.S: Likewise.  Remove file.
609         * sysdeps/unix/sysv/linux/llseek.c: Likewise.  Remove file.
610         * sysdeps/unix/sysv/linux/msgrcv.c: Likewise.  Remove file.
611         * sysdeps/unix/sysv/linux/msgsnd.c: Likewise.  Remove file.
612         * sysdeps/unix/sysv/linux/open64.c: Likewise.  Remove file.
613         * sysdeps/unix/sysv/linux/poll.c: Likewise.  Remove file.
614         * sysdeps/unix/sysv/linux/pread.c: Likewise.  Remove file.
615         * sysdeps/unix/sysv/linux/pread64.c: Likewise.  Remove file.
616         * sysdeps/unix/sysv/linux/pselect.c: Likewise.  Remove file.
617         * sysdeps/unix/sysv/linux/pwrite.c: Likewise.  Remove file.
618         * sysdeps/unix/sysv/linux/pwrite64.c: Likewise.  Remove file.
619         * sysdeps/unix/sysv/linux/readv.c: Likewise.  Remove file.
620         * sysdeps/unix/sysv/linux/recv.S: Likewise.  Remove file.
621         * sysdeps/unix/sysv/linux/recvfrom.S: Likewise.  Remove file.
622         * sysdeps/unix/sysv/linux/recvmsg.S: Likewise.  Remove file.
623         * sysdeps/unix/sysv/linux/send.S: Likewise.  Remove file.
624         * sysdeps/unix/sysv/linux/sendmsg.S: Likewise.  Remove file.
625         * sysdeps/unix/sysv/linux/sendto.S: Likewise.  Remove file.
626         * sysdeps/unix/sysv/linux/sigpause.c: Likewise.  Remove file.
627         * sysdeps/unix/sysv/linux/sigsuspend.c: Likewise.  Remove file.
628         * sysdeps/unix/sysv/linux/sigtimedwait.c: Likewise.  Remove file.
629         * sysdeps/unix/sysv/linux/sigwait.c: Likewise.  Remove file.
630         * sysdeps/unix/sysv/linux/sigwaitinfo.c: Likewise.  Remove file.
631         * sysdeps/unix/sysv/linux/system.c: Likewise.  Remove file.
632         * sysdeps/unix/sysv/linux/tcdrain.c: Likewise.  Remove file.
633         * sysdeps/unix/sysv/linux/wait.c: Likewise.  Remove file.
634         * sysdeps/unix/sysv/linux/waitid.c: Likewise.  Remove file.
635         * sysdeps/unix/sysv/linux/waitpid.c: Likewise.  Remove file.
636         * sysdeps/unix/sysv/linux/writev.c: Likewise.  Remove file.
637         * sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise.  Remove file.
638
639 2002-12-14  Jakub Jelinek  <jakub@redhat.com>
640
641         * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: New file.
642         * sysdeps/unix/sysv/linux/open.c: Removed.
643         * sysdeps/unix/sysv/linux/fsync.c: Removed.
644         * sysdeps/unix/sysv/linux/lseek.c: Removed.
645         * sysdeps/unix/sysv/linux/msync.c: Removed.
646         * sysdeps/unix/sysv/linux/read.c: Removed.
647         * sysdeps/unix/sysv/linux/close.c: Removed.
648         * sysdeps/unix/sysv/linux/creat.c: Removed.
649         * sysdeps/unix/sysv/linux/nanosleep.c: Removed.
650         * sysdeps/unix/sysv/linux/pause.c: Removed.
651         * sysdeps/unix/sysv/linux/select.c: Removed.
652         * sysdeps/unix/sysv/linux/write.c: Removed.
653
654 2002-12-14  Ulrich Drepper  <drepper@redhat.com>
655
656         * sysdeps/unix/sysv/linux/i386/pt-socket.S: Check multiple_threads
657         element in TCB to see whether locking is needed.
658
659         * sysdeps/unix/sysv/linux/libc_pthread_init.c: Check that
660         MULTIPLE_THREADS_OFFSET value is correct.
661
662         * sysdeps/unix/sysv/linux/close.c: New file.
663         * sysdeps/unix/sysv/linux/connect.S: New file.
664         * sysdeps/unix/sysv/linux/creat.c: New file.
665         * sysdeps/unix/sysv/linux/fsync.c: New file.
666         * sysdeps/unix/sysv/linux/llseek.c: New file.
667         * sysdeps/unix/sysv/linux/lseek.c: New file.
668         * sysdeps/unix/sysv/linux/msgrcv.c: New file.
669         * sysdeps/unix/sysv/linux/msgsnd.c: New file.
670         * sysdeps/unix/sysv/linux/msync.c: New file.
671         * sysdeps/unix/sysv/linux/nanosleep.c: New file.
672         * sysdeps/unix/sysv/linux/open.c: New file.
673         * sysdeps/unix/sysv/linux/open64.c: New file.
674         * sysdeps/unix/sysv/linux/pause.c: New file.
675         * sysdeps/unix/sysv/linux/poll.c: New file.
676         * sysdeps/unix/sysv/linux/pread.c: New file.
677         * sysdeps/unix/sysv/linux/pread64.c: New file.
678         * sysdeps/unix/sysv/linux/pselect.c: New file.
679         * sysdeps/unix/sysv/linux/pwrite.c: New file.
680         * sysdeps/unix/sysv/linux/pwrite64.c: New file.
681         * sysdeps/unix/sysv/linux/readv.c: New file.
682         * sysdeps/unix/sysv/linux/recv.S: New file.
683         * sysdeps/unix/sysv/linux/recvfrom.S: New file.
684         * sysdeps/unix/sysv/linux/recvmsg.S: New file.
685         * sysdeps/unix/sysv/linux/select.c: New file.
686         * sysdeps/unix/sysv/linux/send.S: New file.
687         * sysdeps/unix/sysv/linux/sendmsg.S: New file.
688         * sysdeps/unix/sysv/linux/sendto.S: New file.
689         * sysdeps/unix/sysv/linux/sigpause.c: New file.
690         * sysdeps/unix/sysv/linux/sigsuspend.c: New file.
691         * sysdeps/unix/sysv/linux/sigtimedwait.c: New file.
692         * sysdeps/unix/sysv/linux/sigwait.c: New file.
693         * sysdeps/unix/sysv/linux/sigwaitinfo.c: New file.
694         * sysdeps/unix/sysv/linux/system.c: New file.
695         * sysdeps/unix/sysv/linux/tcdrain.c: New file.
696         * sysdeps/unix/sysv/linux/wait.c: New file.
697         * sysdeps/unix/sysv/linux/waitid.c: New file.
698         * sysdeps/unix/sysv/linux/waitpid.c: New file.
699         * sysdeps/unix/sysv/linux/writev.c: New file.
700         * sysdeps/unix/sysv/linux/i386/fcntl.c: New file.
701
702         * pt-readv.c: Fix comment.
703
704 2002-12-14  Jakub Jelinek  <jakub@redhat.com>
705
706         * tst-cleanup1.c: Include stdlib.h.
707
708         * tst-cancel5.c: New test.
709         * Makefile (tests): Add tst-cancel5.
710         (tst-cancel5): Link against libc.so libpthread.so in that order.
711
712 2002-12-13  Ulrich Drepper  <drepper@redhat.com>
713
714         * forward.c (test_loaded): Prevent recursive calls.
715
716         * Makefile (routines): Add libc-cancellation.
717         * libc-cancellation.c: New file.
718         * descr.h (struct pthread): Add multiple_threads field.
719         * allocatestack.c (allocate_stack): Initialize multiple_header field of
720         new thread descriptor to 1.
721         * sysdeps/unix/sysv/linux/i386/createthread.c (create_thread):
722         Initialize multiple_thread field after successful thread creation.
723         * cancellation.c (__do_cancel): Move to pthreadP.h.
724         (__pthread_enable_asynccancel): Remove parameter from __do_cancel call.
725         (__pthread_disable_asynccancel): Add internal_function attribute.
726         * init.c (sigcancel_handler): Remove parameter from __do_cancel call.
727         * pthread_setcancelstate.c: Likewise.
728         * pthread_setcanceltype.c: Likewise.
729         * pthread_exit.c: Likewise.
730         * pthreadP.h (CANCELLATION_P): Likewise.
731         (__do_cancel): Define as static inline.
732         (LIBC_CANCEL_ASYNC, LIBC_CANCEL_RESET): New #defines.
733         (__libc_enable_asynccancel, __libc_disable_asynccancel): New
734         declarations.
735         * sysdeps/i386/tls.h (tcbhead_t): Add list and multiple_threads
736         fields.  Define MULTIPLE_THREADS_OFFSET.
737         * sysdeps/pthread/bits/libc-lock.h: Remove __libc_locking_needed
738         declaration.
739         * sysdeps/unix/sysv/linux/accept.S: New file.
740         * sysdeps/unix/sysv/linux/read.c: New file.
741         * sysdeps/unix/sysv/linux/write.c: New file.
742         * sysdeps/unix/sysv/linux/i386/pt-socket.S: New file.
743         * sysdeps/unix/sysv/linux/libc_pthread_init.c: Remove definition and
744         initialization of __libc_locking_needed.
745         * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Don't use
746         __libc_locking_needed, use multiple_threads field in TCB.
747         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
748
749 2002-12-12  Ulrich Drepper  <drepper@redhat.com>
750
751         * sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S: Use i486
752         version.
753         * sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S: Likewise.
754
755         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Correct
756         access to __libc_locking_needed for PIC.
757
758 2002-12-12  Jakub Jelinek  <jakub@redhat.com>
759
760         * sysdeps/pthread/bits/libc-lock.h (__libc_locking_needed): Only
761         declare for libc.so.
762         (__libc_lock_init, __libc_lock_init_recursive): Change into comma
763         expression.
764         (__libc_lock_lock): Put into statement expression.
765         (__libc_lock_unlock): Remove trailing semicolon.
766         * sysdeps/unix/sysv/linux/fork.h (__libc_pthread_init): Fix typo.
767
768 2002-12-12  Roland McGrath  <roland@redhat.com>
769
770         * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Use asm operand with
771         "m" constraint to refer to __libc_locking_needed.  Declare it here.
772
773 2002-12-12  Ulrich Drepper  <drepper@redhat.com>
774
775         * sysdeps/unix/sysv/linux/fork-gen.c: Renamed to...
776         * sysdeps/unix/sysv/linux/libc_pthread_init.c: ...this.
777         Initialize __libc_locking_needed.
778         * init.c (__pthread_initialize_minimal): Call __libc_pthread_init
779         instead of __register_pthread_fork_handler.
780         * sysdeps/pthread/bits/libc-lock.h: Declare __libc_locking_needed.
781         * sysdeps/unix/sysv/linux/Makefile (sysdep_routimes): Replace
782         fork-gen with libc_pthread_init.
783         * sysdeps/unix/sysv/linux/Versions: Use __libc_pthread_init instead
784         of __register_pthread_fork_handler.
785         * sysdeps/unix/sysv/linux/fork.h: Declare __libc_pthread_init instead
786         of __register_pthread_fork_handler.
787         * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Use
788         __libc_locking_needed to determine whether lock prefix can be avoided.
789         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Likewise.
790
791 2002-12-11  Ulrich Drepper  <drepper@redhat.com>
792
793         * Makefile (tests): Add tst-cleanup1.
794         * tst-cleanup1.c: New file.
795         * cancellation.c (__cleanup_thread): Removed.
796         (__do_cancel): Remove call to __cleanup_thread.
797         * pthreadP.h: Remove __cleanup_thread prorotype.
798
799         * sysdeps/pthread/bits/libc-lock.h (__libc_cleanup_region_start):
800         Remember function and argument even if cancellation handler
801         function is not available.
802         (__libc_cleanup_region_end): Execute registered function directly if
803         pthread functions are not available.
804         (__libc_cleanup_end): Likewise.
805
806         * init.c (__pthread_initialize_minimal): Fix initialization in
807         static lib by preventing gcc from being too clever.
808
809 2002-12-10  Ulrich Drepper  <drepper@redhat.com>
810
811         * init.c (__pthread_initialize_minimal): Remove unneccesary
812         sigaddset call.
813
814         * Makefile (tests): We can run tst-locale2 now.
815
816 2002-12-09  Ulrich Drepper  <drepper@redhat.com>
817
818         * Versions: Remove duplicated sigwait entry.
819
820 2002-12-08  Ulrich Drepper  <drepper@redhat.com>
821
822         * pthreadP.h: Enable pthread_cleanup_{push,pop} optimizations only
823         inside libpthread.
824
825         * pt-fcntl.c (__fcntl): Initialize oldtype to avoid warning.
826
827         * pthreadP.h: Declare __pthread_enable_asynccancel and
828         __pthread_disable_asynccancel.
829         (CANCEL_ASYNC): Use __pthread_enable_asynccancel.
830         (CANCEL_RESET): Use __pthread_disable_asynccancel.
831         * cancellation.c (__pthread_enable_asynccancel): New function.
832         (__pthread_disable_asynccancel): New function.
833         * pt-accept.c: Adjust for CANCEL_ASYNC and CANCEL_RESET change.
834         * pt-close.c: Likewise.
835         * pt-connect.c: Likewise.
836         * pt-creat.c: Likewise.
837         * pt-fcntl.c: Likewise.
838         * pt-fsync.c: Likewise.
839         * pt-lseek.c: Likewise.
840         * pt-lseek64.c: Likewise.
841         * pt-msgrcv.c: Likewise.
842         * pt-msgsnd.c: Likewise.
843         * pt-msync.c: Likewise.
844         * pt-nanosleep.c: Likewise.
845         * pt-open.c: Likewise.
846         * pt-open64.c: Likewise.
847         * pt-pause.c: Likewise.
848         * pt-poll.c: Likewise.
849         * pt-pread.c: Likewise.
850         * pt-pread64.c: Likewise.
851         * pt-pselect.c: Likewise.
852         * pt-pwrite.c: Likewise.
853         * pt-pwrite64.c: Likewise.
854         * pt-read.c: Likewise.
855         * pt-readv.c: Likewise.
856         * pt-recv.c: Likewise.
857         * pt-recvfrom.c: Likewise.
858         * pt-recvmsg.c: Likewise.
859         * pt-select.c: Likewise.
860         * pt-send.c: Likewise.
861         * pt-sendmsg.c: Likewise.
862         * pt-sendto.c: Likewise.
863         * pt-sigpause.c: Likewise.
864         * pt-sigsuspend.c: Likewise.
865         * pt-sigtimedwait.c: Likewise.
866         * pt-sigwait.c: Likewise.
867         * pt-sigwaitinfo.c: Likewise.
868         * pt-system.c: Likewise.
869         * pt-tcdrain.c: Likewise.
870         * pt-wait.c: Likewise.
871         * pt-waitid.c: Likewise.
872         * pt-waitpid.c: Likewise.
873         * pt-write.c: Likewise.
874         * pt-writev.c: Likewise.
875         * pthread_join.c: Likewise.
876         * pthread_timedjoin.c: Likewise.
877
878         * pt-sigpause.c (sigsuspend): Call __sigsuspend.
879         (__xpg_sigpause): New function.
880         * Versions (libpthread:GLIBC_2.3.2): Add __xpg_sigpause.
881
882 2002-12-07  Ulrich Drepper  <drepper@redhat.com>
883
884         * Makefile (CFLAGS-ftrylockfile.c): Add -D_IO_MTSAFE_IO.
885
886         * cleanup.c: Move declarations of _GI_pthread_cleanup_push and
887         _GI_pthread_cleanup_pop to pthreadP.h.
888
889         * ftrylockfile.c: Use _IO_lock_trylock instead of
890         pthread_mutex_trylock.
891
892         * pthreadP.h (CANCEL_ASYNC): Use __pthread_setcanceltype.
893         (CANCEL_RESET): Likewise.
894         (__pthread_setcanceltype_): Declare.
895         (__pthread_mutex_lock_internal): Declare.
896         (__pthread_mutex_unlock_internal): Declare.
897         (__pthread_once_internal): Declare.
898         (pthread_cleanup_push): Redefine using _GI_pthread_cleanup_push.
899         (pthread_cleanup_pop): Redefine using _GI_pthread_cleanup_pop.
900
901         * pthread_cond_timedwait.c: Use INTUSE is calls to pthread_mutex_lock
902         and pthread_mutex_unlock.
903         * pthread_cond_wait.c: Likewise.
904         * pthread_mutex_lock.c: Use INTDEF to define alias if needed.
905         * pthread_mutex_unlock.c: Likewise.
906
907         * pthread_setcanceltype.c: Add additional alias
908         __pthread_setcanceltype.
909
910         * sem_unlink.c (sem_unlink): Use __pthread_once with INTDEF.
911         * sem_open.c (sem_open): Likewise.
912         Use __libc_open, __libc_write, and __libc_close instead of
913         open, write, and close respectively.
914
915         * sysdeps/pthread/bits/libc-lock.h (__libc_lock_trylock_internal):
916         Rewrite as statement expression since it must return a value.
917
918         * pthread_cancel.c: Use __pthread_kill instead of pthread_kill.
919         * sysdeps/unix/sysv/linux/pthread_kill.c: Define additional alias
920         __pthread_kill.
921
922         * sysdeps/unix/sysv/linux/i386/pthread_once.S: Define additional
923         alias __pthread_once_internal.
924
925         * sysdeps/unix/sysv/linux/raise.c: Use libc_hidden_def for raise.
926
927 2002-12-06  Ulrich Drepper  <drepper@redhat.com>
928
929         * Makefile (tests): Add tst-stdio1 and tst-stdio2.
930         * tst-stdio1.c: New file.
931         * tst-stdio2.c: New file.
932
933         * init.c (__pthread_initialize_minimal): Correct INIT_LIST_HEAD use.
934
935         * Makefile (tests): Comment out tst-locale2 for now.
936         (CFLAGS-flockfile.c, CFLAGS-funlockfile.c): Define to -D_IO_MTSAFE_IO.
937
938         * sysdeps/unix/sysv/linux/Makefile: Define CFLAGS-fork.c to
939         -D_IO_MTSAFE_IO.
940         * sysdeps/unix/sysv/linux/fork.c: Include <bits/stdio-lock.h>.
941         Use _IO_lock_init instead of explicit assignment.
942
943         * sysdeps/pthread/bits/libc-lock.h: Define __rtld_lock_* macros.
944         Define __libc_lock_* and __libc_lock_recursive macros with
945         lowlevellock macros, not pthread mutexes.
946
947         * flockfile.c: Include <bits/stdio-lock.h>.  Use _IO_lock_lock instead
948         of pthread_mutex_lock.
949         * funlockfile.c: Include <bits/stdio-lock.h>.  Use _IO_lock_unlock
950         instead of pthread_mutex_unlock.
951
952 2002-12-06  Roland McGrath  <roland@redhat.com>
953
954         * allocatestack.c (__stack_user): Use uninitialized defn.
955         * init.c (__pthread_initialize_minimal): Initialize it here.
956
957 2002-12-05  Roland McGrath  <roland@redhat.com>
958
959         * sysdeps/i386/tls.h (TLS_INIT_TP): Make it return zero or an error
960         string.
961         * sysdeps/x86_64/tls.h (TLS_INIT_TP): Likewise.
962
963         * sysdeps/unix/sysv/linux/i386/createthread.c (create_thread): Add
964         missing & here too.
965
966 2002-12-05  Ulrich Drepper  <drepper@redhat.com>
967
968         * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
969         lowlevellock.
970         * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: New file.
971         * sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S: New file.
972         * sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S: New file.
973         * sysdeps/pthread/bits/libc-lock.h: Use lowlevellock implementation
974         for __libc_lock_* macros.
975         * Makefile (routines): Add libc-lowlevellock.
976
977 2002-10-09  Roland McGrath  <roland@redhat.com>
978
979         * sysdeps/pthread/bits/libc-lock.h (__libc_maybe_call): New macro.
980         Under [__PIC__], call the function via the pointer fetched for
981         comparison rather than a call by name that uses the PLT.
982         (__libc_lock_init, __libc_rwlock_init, __libc_lock_fini)
983         (__libc_rwlock_fini, __libc_lock_lock, __libc_rwlock_rdlock)
984         (__libc_rwlock_wrlock, __libc_lock_trylock, __libc_rwlock_tryrdlock)
985         (__libc_rwlock_trywrlock, __libc_lock_unlock, __libc_rwlock_unlock)
986         (__libc_key_create, __libc_getspecific, __libc_setspecific): Use it.
987
988 2002-12-04  Roland McGrath  <roland@redhat.com>
989
990         * forward.c (pthread_self): Use FORWARD3 macro to correct return type.
991
992         * sysdeps/i386/td_ta_map_lwp2thr.c: Moved from ../nptl_db.
993         * sysdeps/generic/td_ta_map_lwp2thr.c: New file.
994
995         * pthread_create.c (start_thread): Add missing & on __nptl_last_event.
996
997 2002-12-04  Ulrich Drepper  <drepper@redhat.com>
998
999         * sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Make pthread_t
1000         a completely opaque, non-integer type.
1001         * sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.
1002
1003 2002-12-05  Jakub Jelinek  <jakub@redhat.com>
1004
1005         * sysdeps/i386/tls.h: Include stdlib.h.
1006         * sysdeps/x86_64/tls.h: Likewise.
1007
1008 2002-12-04  Ulrich Drepper  <drepper@redhat.com>
1009
1010         * Makefile (tests): Add tst-locale2.
1011         (tests-static): Likewise.
1012         * tst-locale2.c: New file.
1013
1014         * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Mark asms as
1015         volatile and add memory clobbers to lock operations.
1016
1017 2002-12-03  Ulrich Drepper  <drepper@redhat.com>
1018
1019         * sysdeps/i386/i686/bits/atomic.h: Use i486 version.
1020         * sysdeps/i386/i486/bits/atomic.h: New file.
1021         * sysdeps/i386/i586/bits/atomic.h: New file.
1022         * sysdeps/i386/i686/pthread_spin_trylock.S: Define HAVE_CMOV and
1023         include i486 version.
1024         * sysdeps/i386/i486/pthread_spin_trylock.S: New file.
1025         * sysdeps/i386/i586/pthread_spin_trylock.S: New file.
1026         Patch by Marijn Ros <marijn@mad.scientist.com>.
1027
1028         * allocatestack.c (get_cached_stack): Don't crash if we first
1029         found a stack with a larger size then needed.
1030         Reported by Hui Huang <hui.huang@sun.com>.
1031
1032         * Makefile (tests): Add tst-sysconf.
1033         * tst-sysconf.c: New file.
1034
1035         * sysdeps/unix/sysv/linux/bits/local_lim.h: Undefine
1036         PTHREAD_THREADS_MAX.
1037
1038 2002-12-02  Roland McGrath  <roland@redhat.com>
1039
1040         * pthreadP.h (__stack_user, __nptl_create_event, __nptl_death_event):
1041         Declare using hidden_proto instead of attribute_hidden, so there are
1042         non-.hidden static symbols for gdb to find.
1043         (__pthread_keys): Likewise.
1044         * events.c (__nptl_create_event, __nptl_death_event): Add hidden_def.
1045         * allocatestack.c (__stack_user): Likewise.
1046         * pthread_create.c (__pthread_keys): Likewise.
1047         (__nptl_threads_events, __nptl_last_event): Make these static instead
1048         of hidden.
1049         * pthread_key_create.c (__pthread_pthread_keys_max,
1050         __pthread_pthread_key_2ndlevel_size): Renamed from __linuxthreads_*.
1051
1052 2002-12-02  Ulrich Drepper  <drepper@redhat.com>
1053
1054         * Makefile (tests): Add tst-locale1.  If buid-static is yes link
1055         statically.
1056         * tst-locale1.c: New file.
1057
1058         * pthread_cond_timedwait.c: Include <stdlib.h>.
1059
1060         * Makefile (tests): Add tst-fork2 and tst-fork3.
1061         * tst-fork2.c: New file.
1062         * tst-fork3.c: New file.
1063
1064 2002-11-28  Ulrich Drepper  <drepper@redhat.com>
1065
1066         * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: New file.
1067
1068         * sysdeps/unix/sysv/linux/bits/posix_opt.h: Define macros which
1069         require it to 200112L.
1070
1071         * sysdeps/unix/sysv/linux/i386/i486/lowlevelrwlock.S: Use cmov
1072         instruction only if HAVE_CMOV is defined.
1073         * sysdeps/unix/sysv/linux/i386/i686/lowlevelrwlock.S: Define HAVE_CMOV.
1074
1075         * sysdeps/unix/sysv/linux/x86_64/bits/semaphore.h: New file.
1076
1077         * sysdeps/unix/sysv/linux/x86_64/pthread_once.S: New file.
1078
1079         * sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: New file.
1080
1081         * sysdeps/unix/sysv/linux/x86_64/pt-vfork.S: New file.
1082
1083 2002-11-27  Ulrich Drepper  <drepper@redhat.com>
1084
1085         * sysdeps/x86_64/bits/atomic.h: New file.
1086
1087         * sysdeps/i386/i686/bits/atomic.h: Fix asm syntax for 8- and
1088         16-bit operations.
1089
1090         * sysdeps/unix/sysv/linux/raise.c (raise): Use INTERNAL_SYSCALL if
1091         possible since gettid cannot fail.
1092
1093         * sysdeps/x86_64/pthreaddef.h: New file.
1094
1095         * sysdeps/i386/pthreaddef.h (gettid): Removed.
1096
1097         * sysdeps/x86_64/pthread_spin_init.c: New file.
1098         * sysdeps/x86_64/pthread_spin_lock.c: New file.
1099         * sysdeps/x86_64/pthread_spin_trylock.c: New file.
1100         * sysdeps/x86_64/pthread_spin_unlock.c: New file.
1101
1102         * sysdeps/i386/i686/pthread_spin_trylock.S (pthread_spin_trylock):
1103         Add missing lock prefix.  Minute optimization.
1104
1105         * tst-spin2.c (main): Also check successful trylock call.
1106
1107         * sysdeps/pthread/pthread_sigmask.c (pthread_sigmask): Use correct
1108         syscall.  Fix typo in case INTERNAL_SYSCALL is not used.
1109
1110         * sysdeps/i386/pthread_spin_destroy.c: Moved to...
1111         * sysdeps/pthread/pthread_spin_destroy.c: ...here.  New file.
1112
1113         * sysdeps/i386/pthread_sigmask.c: Removed.  Use the generic code.
1114         * sysdeps/pthread/pthread_sigmask.c (pthread_sigmask): Return correct
1115         value in case of an error.  Add support for INTERNAL_SYSCALL.
1116
1117         * sysdeps/i386/pthread_sigmask.c (pthread_sigmask): Return correct
1118         value in case of an error.
1119
1120         * sysdeps/x86_64/tls.h: New file.
1121
1122 2002-11-26  Ulrich Drepper  <drepper@redhat.com>
1123
1124         * sysdeps/i386/tls.h (THREAD_GETMEM_NC): Change interface.  It now
1125         takes the array member name and the index as parameters.
1126         (THREAD_SETMEM_NC): Likewise.
1127         * pthread_getspecific.c: Use new THREAD_GETMEM_NC interface.
1128         * pthread_setspecific.c: Use new THREAD_GETMEM_NC and THREAD_SETMEM_NC
1129         interfaces.
1130
1131         * sysdeps/i386/tls.h (THREAD_SETMEM): Use size of member element
1132         to decide which code to use.
1133         (THREAD_SETMEM_NC): Likewise.
1134
1135         * allocatestack.c (queue_stack): Don't remove stack from list here.
1136         Do it in the caller.  Correct condition to prematurely terminate
1137         loop to free stacks.
1138         (__deallocate_stack): Remove stack from list here.
1139
1140 2002-11-26  Ulrich Drepper  <drepper@redhat.com>
1141
1142         * Makefile (tests): Add tst-stack1.
1143         * tst-stack1.c: New file.
1144
1145         * allocatestack.c (allocate_stack): Initialize the TCB on a user
1146         provided stack.
1147
1148         * pthread_attr_getstack.c: Return bottom of the thread area.
1149
1150 2002-11-25  Ulrich Drepper  <drepper@redhat.com>
1151
1152         * Makefile (libpthread-routines): Add pt-allocrtsig and
1153         pthread_kill_other_threads.
1154         * pt-allocrtsig.c: New file.
1155         * pthread_kill_other_threads.c: New file.
1156         * sysdeps/unix/sysv/linux/allocrtsig.c: Add additional aliases for
1157         all three functions.
1158         * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
1159         allocrtsig.
1160         * sysdeps/unix/sysv/linux/Versions (libc:GLIBC_PRIVATE): Export
1161         __libc_current_sigrtmin_private, __libc_current_sigrtmax_private,
1162         and __libc_allocate_rtsig_private.
1163         * Versions (libpthread): Export pthread_kill_other_threads_np,
1164         __libc_current_sigrtmin, and __libc_current_sigrtmax.
1165
1166 2002-11-24  Ulrich Drepper  <drepper@redhat.com>
1167
1168         * allocatestack.c (allocate_stack): stackaddr in attribute points to
1169         the end of the stack.  Adjust computations.
1170         When mprotect call fails dequeue stack and free it.
1171         * pthread_attr_setstack.c: Store top of the stack in stackaddr
1172         attribute.
1173         * pthread_getattr_np.c: Likewise.
1174
1175         * descr.h (IS_DETACHED): Add some more parenthesis to prevent
1176         surprises.
1177
1178 2002-11-23  Ulrich Drepper  <drepper@redhat.com>
1179
1180         * sysdeps/pthread/pthread.h (pthread_self): __THROW must come before
1181         attribute definitions.  Patch by Luca Barbieri <ldb@ldb.ods.org>.
1182
1183 2002-11-22  Ulrich Drepper  <drepper@redhat.com>
1184
1185         * pthread_getspecific.c: Optimize access to first 2nd-level array.
1186         * pthread_setspecific.c: Likewise.
1187
1188 2002-11-21  Ulrich Drepper  <drepper@redhat.com>
1189
1190         * sysdeps/unix/sysv/linux/i386/createthread.c: Remove CLONE_ flags
1191         definitions.  Get them from the official place.
1192         * sysdeps/unix/sysv/linux/i386/fork.c: Likewise.
1193
1194         * sysdeps/unix/sysv/linux/i386/createthread.c: Update CLONE_* flags.
1195         Use new CLONE_ flags in clone() calls.
1196
1197         * sysdeps/unix/sysv/linux/fork.c: Use ARCH_FORK to actually fork.
1198         * sysdeps/unix/sysv/linux/i386/fork.c: New file.
1199
1200         * Versions: Add pthread_* functions for libc.
1201         * forward.c: New file.
1202
1203         * sysdeps/pthread/Makefile (libpthread-sysdeps_routines): Add
1204         errno-loc.
1205         * herrno.c: New file.
1206         * res.c: New file.
1207
1208         * Makefile (libpthread-routines): Remove sem_post, sem_wait,
1209         sem_trywait, and sem_timedwait.  Add herrno and res.
1210         * sem_init.c: Don't initialize lock and waiters members.
1211         * sem_open.c: Likewise.
1212         * sem_post.c: Removed.
1213         * sem_wait.c: Removed.
1214         * sem_trywait.c: Removed.
1215         * sem_timedwait.c: Removed.
1216         * sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Complete rewrite.
1217         Includes full implementations of sem_post, sem_wait, sem_trywait,
1218         and sem_timedwait.
1219         * sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Adjust
1220         for new implementation.
1221         * sysdeps/unix/sysv/linux/internaltypes.h (struct sem): Remove lock
1222         and waiters fields.
1223
1224         * tst-sem3.c: Improve error message.
1225         * tst-signal3.c: Likewise.
1226
1227         * init.c (__pthread_initialize_minimal): Use set_tid_address syscall
1228         to tell the kernel about the termination futex and to initialize tid
1229         member.  Don't initialize main_thread.
1230         * descr.h (struct pthread): Remove main_thread member.
1231         * cancelllation.c (__do_cancel): Remove code handling main thread.
1232         The main thread is not special anymore.
1233
1234         * allocatestack.c (__reclaim_stacks): Mark stacks as unused.  Add
1235         size of the stacks to stack_cache_actsize.
1236
1237         * pt-readv.c: Add missing "defined".
1238         * pt-sigwait.c: Likewise.
1239         * pt-writev.c: Likewise.
1240
1241 2002-11-09  Ulrich Drepper  <drepper@redhat.com>
1242
1243         * Versions: Export __connect from libpthread.
1244         Patch by Luca Barbieri <ldb@ldb.ods.org>.
1245
1246         * Makefile (libpthread-routines): Add pt-raise.
1247         * sysdeps/unix/sysv/linux/raise.c: New file.
1248         * sysdeps/unix/sysv/linux/pt-raise.c: New file.
1249         * sysdeps/generic/pt-raise.c: New file.
1250
1251         * pthread_cond_init.c: Initialize all data elements of the condvar
1252         structure.  Patch by Luca Barbieri <ldb@ldb.ods.org>.
1253
1254         * pthread_attr_init.c: Actually implement 2.0 compatibility version.
1255         * pthread_create.c: Likewise.
1256
1257         * Makefile (tests): Add tst-key1, tst-key2, tst-key3.
1258         * tst-key1.c: New file.
1259         * tst-key2.c: New file.
1260         * tst-key3.c: New file.
1261
1262         * Versions: Export pthread_detach for version GLIBC_2.0.
1263         Reported by Saurabh Desai <sdesai@austin.ibm.com>.
1264
1265 2002-11-08  Ulrich Drepper  <drepper@redhat.com>
1266
1267         * pthread_key_create.c: Terminate search after an unused key was found.
1268         Patch by Luca Barbieri <ldb@ldb.ods.org>.
1269
1270         * sysdeps/unix/sysv/linux/i386/pthread_once.S: Return zero.
1271         Patch by Luca Barbieri <ldb@ldb.ods.org>.
1272
1273 2002-10-10  Ulrich Drepper  <drepper@redhat.com>
1274
1275         * sysdeps/unix/sysv/linux/i386/i486/lowlevelsem.S: Use slow generic
1276         dynamic lookup for errno in PIC.
1277
1278         * allocatestack.c (get_cached_stack): Rearrange code slightly to
1279         release the stack lock as soon as possible.
1280         Call _dl_allocate_tls_init for TCB from the cache to re-initialize
1281         the static TLS block.
1282         (allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
1283
1284         * cancellation.c: Renamed from cancelation.c.
1285         * Makefile: Adjust accordingly.
1286         * pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
1287         * cleanup_defer.c: Use CANCELLATION_P.
1288         * pthread_testcancel.c: Likewise.
1289         * descr.h: Fix spelling in comments.
1290         * init.c: Likewise.
1291         * pthread_getattr_np.c: Likewise.
1292         * pthread_getschedparam.c: Likewise.
1293         * pthread_setschedparam.c: Likewise.
1294         * Versions: Likewise.
1295
1296         * pt-pselect.c: New file.
1297         * Makefile (libpthread-routines): Add pt-pselect.
1298         * Versions: Add pselect.
1299
1300         * tst-cancel4.c: New file.
1301         * Makefile (tests): Add tst-cancel4.
1302
1303 2002-10-09  Ulrich Drepper  <drepper@redhat.com>
1304
1305         * pthread_mutex_lock.c: Always record lock ownership.
1306         * pthread_mutex_timedlock.c: Likewise.
1307         * pthread_mutex_trylock.c: Likewise.
1308
1309         * pt-readv.c: New file.
1310         * pt-writev.c: New file.
1311         * pt-creat.c: New file.
1312         * pt-msgrcv.c: New file.
1313         * pt-msgsnd.c: New file.
1314         * pt-poll.c: New file.
1315         * pt-select.c: New file.
1316         * pt-sigpause.c: New file.
1317         * pt-sigsuspend.c: New file.
1318         * pt-sigwait.c: New file.
1319         * pt-sigwaitinfo.c: New file.
1320         * pt-waitid.c: New file.
1321         * Makefile (libpthread-routines): Add pt-readv, pt-writev, pt-creat,
1322         pt-msgrcv, pt-msgsnd, pt-poll, pt-select, pt-sigpause, pt-sigsuspend,
1323         pt-sigwait, pt-sigwaitinfo, and pt-waitid.
1324         * Versions: Add all the new functions.
1325
1326         * tst-exit1.c: New file.
1327         * Makefile (tests): Add tst-exit1.
1328
1329         * sem_timedwait.c: Minor optimization for more optimal fastpath.
1330
1331 2002-10-08  Ulrich Drepper  <drepper@redhat.com>
1332
1333         * pt-fcntl.c: Only enable asynchronous cancellation for F_SETLKW.
1334
1335         * pthread_join.c: Enable asynchronous cancellation around lll_wait_tid
1336         call.  pthread_join is an official cancellation point.
1337         * pthread_timedjoin.c: Likewise.
1338
1339         * pthread_cond_wait.c: Revert order in which internal lock are dropped
1340         and the condvar's mutex are retrieved.
1341         * pthread_cond_timedwait.c: Likewise.
1342         Reported by dice@saros.East.Sun.COM.
1343
1344 2002-10-07  Ulrich Drepper  <drepper@redhat.com>
1345
1346         * pthreadP.h: Cut out all type definitions and move them...
1347         * sysdeps/unix/sysv/linux/internaltypes.h: ...here.  New file.
1348         * pthreadP.h: Include <internaltypes.h>.
1349
1350         * sysdeps/unix/sysv/linux/i386/lowlevelsem.h (lll_sem_post): Little
1351         performance tweaks.
1352
1353         * sem_trywait.c: Shuffle #includes around to get right order.
1354         * sem_timedwait.c: Likewise.
1355         * sem_post.c: Likewise.
1356         * sem_wait.c: Likewise.
1357
1358         * nptl 0.3 released.
1359
1360         * Makefile (tests): Add tst-signal3.
1361         * tst-signal3.c: New file.
1362
1363 2002-10-05  Ulrich Drepper  <drepper@redhat.com>
1364
1365         * sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Tell the compiler that
1366         the asms modify the sem object.
1367         (__lll_sem_timedwait): Now takes struct sem* as first parameter.
1368
1369         * sysdeps/unix/sysv/linux/i386/bits/semaphore.h (sem_t): Don't expose
1370         the actual members.
1371         * pthreadP.h (struct sem): New type.  Actual semaphore type.
1372         * semaphoreP.h: Include pthreadP.h.
1373         * sem_getvalue.c: Adjust to sem_t change.
1374         * sem_init.c: Likewise.
1375         * sem_open.c: Likewise.
1376         * sem_post.c: Likewise.
1377         * sem_timedwait.c: Likewise.
1378         * sem_trywait.c: Likewise.
1379         * sem_wait.c: Likewise.
1380
1381 2002-10-04  Ulrich Drepper  <drepper@redhat.com>
1382
1383         * Makefile (tests): Add tst-basic2, tst-exec1, tst-exec3, tst-exec3.
1384         * tst-basic2.c: New file.
1385         * tst-exec1.c: New file.
1386         * tst-exec2.c: New file.
1387         * tst-exec3.c: New file.
1388
1389         * tst-fork1.c: Remove extra */.
1390
1391         * nptl 0.2 released.  The API for IA-32 is complete.