From a9f5aa1cc96fc2c71f19a9c3e9dcbee0e78f83ca Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 15 Nov 2005 03:13:04 +0000 Subject: rename current stable linuxthreads to linuxthreads.old to prepare for import of latest glibc version --- Rules.mak | 4 + extra/Configs/Config.in | 14 + libpthread/linuxthreads.old/Changes | 85 + libpthread/linuxthreads.old/FAQ.html | 1039 +++++++++++++ libpthread/linuxthreads.old/LICENSE | 501 ++++++ libpthread/linuxthreads.old/Makefile | 15 + libpthread/linuxthreads.old/Makefile.in | 62 + libpthread/linuxthreads.old/README | 166 ++ libpthread/linuxthreads.old/attr.c | 214 +++ libpthread/linuxthreads.old/cancel.c | 184 +++ libpthread/linuxthreads.old/condvar.c | 296 ++++ libpthread/linuxthreads.old/debug.h | 56 + libpthread/linuxthreads.old/errno.c | 37 + libpthread/linuxthreads.old/events.c | 37 + libpthread/linuxthreads.old/internals.h | 518 +++++++ libpthread/linuxthreads.old/join.c | 221 +++ libpthread/linuxthreads.old/linuxthreads.texi | 1627 ++++++++++++++++++++ libpthread/linuxthreads.old/locale.c | 58 + libpthread/linuxthreads.old/lockfile.c | 39 + libpthread/linuxthreads.old/manager.c | 905 +++++++++++ libpthread/linuxthreads.old/mutex.c | 356 +++++ libpthread/linuxthreads.old/oldsemaphore.c | 235 +++ libpthread/linuxthreads.old/pt-machine.c | 22 + libpthread/linuxthreads.old/ptfork.c | 126 ++ libpthread/linuxthreads.old/pthread.c | 1044 +++++++++++++ libpthread/linuxthreads.old/pthread.c-OLDEXAMPLE | 121 ++ libpthread/linuxthreads.old/ptlongjmp.c | 55 + libpthread/linuxthreads.old/queue.h | 61 + libpthread/linuxthreads.old/restart.h | 50 + libpthread/linuxthreads.old/rwlock.c | 486 ++++++ libpthread/linuxthreads.old/semaphore.c | 308 ++++ libpthread/linuxthreads.old/semaphore.h | 87 ++ libpthread/linuxthreads.old/signals.c | 248 +++ libpthread/linuxthreads.old/specific.c | 204 +++ libpthread/linuxthreads.old/spinlock.c | 723 +++++++++ libpthread/linuxthreads.old/spinlock.h | 218 +++ .../linuxthreads.old/sysdeps/alpha/pt-machine.h | 128 ++ .../linuxthreads.old/sysdeps/arm/pt-machine.h | 70 + .../linuxthreads.old/sysdeps/bfin/pt-machine.h | 57 + .../linuxthreads.old/sysdeps/cris/pt-machine.h | 58 + .../linuxthreads.old/sysdeps/frv/pt-machine.h | 68 + .../linuxthreads.old/sysdeps/i386/pt-machine.h | 158 ++ libpthread/linuxthreads.old/sysdeps/i386/tls.h | 185 +++ libpthread/linuxthreads.old/sysdeps/i386/useldt.h | 307 ++++ .../linuxthreads.old/sysdeps/m68k/pt-machine.h | 76 + .../linuxthreads.old/sysdeps/mips/pt-machine.h | 110 ++ .../linuxthreads.old/sysdeps/nios/pt-machine.h | 67 + .../linuxthreads.old/sysdeps/nios2/pt-machine.h | 58 + .../linuxthreads.old/sysdeps/powerpc/pt-machine.h | 103 ++ .../sysdeps/pthread/bits/libc-lock.h | 328 ++++ .../sysdeps/pthread/bits/libc-tsd.h | 66 + .../sysdeps/pthread/bits/pthreadtypes.h | 142 ++ .../linuxthreads.old/sysdeps/pthread/pthread.h | 705 +++++++++ libpthread/linuxthreads.old/sysdeps/pthread/tls.h | 81 + .../linuxthreads.old/sysdeps/sh/pt-machine.h | 81 + libpthread/linuxthreads.old/sysdeps/sh/tls.h | 117 ++ .../linuxthreads.old/sysdeps/sh64/Makefile.arch | 26 + .../linuxthreads.old/sysdeps/sh64/pt-machine.c | 47 + .../linuxthreads.old/sysdeps/sh64/pt-machine.h | 36 + .../linuxthreads.old/sysdeps/sparc/pt-machine.h | 8 + .../sysdeps/sparc/sparc32/pt-machine.h | 83 + .../sysdeps/sparc/sparc64/pt-machine.h | 105 ++ .../linuxthreads.old/sysdeps/v850/pt-machine.h | 46 + .../linuxthreads.old/sysdeps/x86_64/pt-machine.h | 86 ++ libpthread/linuxthreads.old/sysdeps/x86_64/tls.h | 134 ++ libpthread/linuxthreads.old/wrapsyscall.c | 220 +++ libpthread/linuxthreads.old_db/Banner | 1 + libpthread/linuxthreads.old_db/Makefile | 15 + libpthread/linuxthreads.old_db/Makefile.in | 43 + libpthread/linuxthreads.old_db/Versions | 21 + libpthread/linuxthreads.old_db/proc_service.h | 70 + libpthread/linuxthreads.old_db/td_init.c | 32 + libpthread/linuxthreads.old_db/td_log.c | 32 + libpthread/linuxthreads.old_db/td_symbol_list.c | 56 + libpthread/linuxthreads.old_db/td_ta_clear_event.c | 53 + libpthread/linuxthreads.old_db/td_ta_delete.c | 58 + .../linuxthreads.old_db/td_ta_enable_stats.c | 35 + libpthread/linuxthreads.old_db/td_ta_event_addr.c | 73 + .../linuxthreads.old_db/td_ta_event_getmsg.c | 129 ++ .../linuxthreads.old_db/td_ta_get_nthreads.c | 42 + libpthread/linuxthreads.old_db/td_ta_get_ph.c | 36 + libpthread/linuxthreads.old_db/td_ta_get_stats.c | 35 + libpthread/linuxthreads.old_db/td_ta_map_id2thr.c | 79 + libpthread/linuxthreads.old_db/td_ta_map_lwp2thr.c | 91 ++ libpthread/linuxthreads.old_db/td_ta_new.c | 150 ++ libpthread/linuxthreads.old_db/td_ta_reset_stats.c | 35 + libpthread/linuxthreads.old_db/td_ta_set_event.c | 53 + .../linuxthreads.old_db/td_ta_setconcurrency.c | 35 + libpthread/linuxthreads.old_db/td_ta_thr_iter.c | 174 +++ libpthread/linuxthreads.old_db/td_ta_tsd_iter.c | 56 + .../linuxthreads.old_db/td_thr_clear_event.c | 62 + libpthread/linuxthreads.old_db/td_thr_dbresume.c | 30 + libpthread/linuxthreads.old_db/td_thr_dbsuspend.c | 30 + .../linuxthreads.old_db/td_thr_event_enable.c | 57 + .../linuxthreads.old_db/td_thr_event_getmsg.c | 65 + libpthread/linuxthreads.old_db/td_thr_get_info.c | 83 + libpthread/linuxthreads.old_db/td_thr_getfpregs.c | 58 + libpthread/linuxthreads.old_db/td_thr_getgregs.c | 58 + libpthread/linuxthreads.old_db/td_thr_getxregs.c | 30 + .../linuxthreads.old_db/td_thr_getxregsize.c | 30 + libpthread/linuxthreads.old_db/td_thr_set_event.c | 62 + libpthread/linuxthreads.old_db/td_thr_setfpregs.c | 47 + libpthread/linuxthreads.old_db/td_thr_setgregs.c | 47 + libpthread/linuxthreads.old_db/td_thr_setprio.c | 30 + .../linuxthreads.old_db/td_thr_setsigpending.c | 31 + libpthread/linuxthreads.old_db/td_thr_setxregs.c | 30 + libpthread/linuxthreads.old_db/td_thr_sigsetmask.c | 30 + .../linuxthreads.old_db/td_thr_tls_get_addr.c | 70 + libpthread/linuxthreads.old_db/td_thr_tsd.c | 82 + libpthread/linuxthreads.old_db/td_thr_validate.c | 70 + libpthread/linuxthreads.old_db/thread_db.h | 451 ++++++ libpthread/linuxthreads.old_db/thread_dbP.h | 110 ++ libpthread/linuxthreads/Changes | 85 - libpthread/linuxthreads/FAQ.html | 1039 ------------- libpthread/linuxthreads/LICENSE | 501 ------ libpthread/linuxthreads/Makefile | 15 - libpthread/linuxthreads/Makefile.in | 62 - libpthread/linuxthreads/README | 166 -- libpthread/linuxthreads/attr.c | 214 --- libpthread/linuxthreads/cancel.c | 184 --- libpthread/linuxthreads/condvar.c | 296 ---- libpthread/linuxthreads/debug.h | 56 - libpthread/linuxthreads/errno.c | 37 - libpthread/linuxthreads/events.c | 37 - libpthread/linuxthreads/internals.h | 518 ------- libpthread/linuxthreads/join.c | 221 --- libpthread/linuxthreads/linuxthreads.texi | 1627 -------------------- libpthread/linuxthreads/locale.c | 58 - libpthread/linuxthreads/lockfile.c | 39 - libpthread/linuxthreads/manager.c | 905 ----------- libpthread/linuxthreads/mutex.c | 356 ----- libpthread/linuxthreads/oldsemaphore.c | 235 --- libpthread/linuxthreads/pt-machine.c | 22 - libpthread/linuxthreads/ptfork.c | 126 -- libpthread/linuxthreads/pthread.c | 1044 ------------- libpthread/linuxthreads/pthread.c-OLDEXAMPLE | 121 -- libpthread/linuxthreads/ptlongjmp.c | 55 - libpthread/linuxthreads/queue.h | 61 - libpthread/linuxthreads/restart.h | 50 - libpthread/linuxthreads/rwlock.c | 486 ------ libpthread/linuxthreads/semaphore.c | 308 ---- libpthread/linuxthreads/semaphore.h | 87 -- libpthread/linuxthreads/signals.c | 248 --- libpthread/linuxthreads/specific.c | 204 --- libpthread/linuxthreads/spinlock.c | 723 --------- libpthread/linuxthreads/spinlock.h | 218 --- libpthread/linuxthreads/sysdeps/alpha/pt-machine.h | 128 -- libpthread/linuxthreads/sysdeps/arm/pt-machine.h | 70 - libpthread/linuxthreads/sysdeps/bfin/pt-machine.h | 57 - libpthread/linuxthreads/sysdeps/cris/pt-machine.h | 58 - libpthread/linuxthreads/sysdeps/frv/pt-machine.h | 68 - libpthread/linuxthreads/sysdeps/i386/pt-machine.h | 158 -- libpthread/linuxthreads/sysdeps/i386/tls.h | 185 --- libpthread/linuxthreads/sysdeps/i386/useldt.h | 307 ---- libpthread/linuxthreads/sysdeps/m68k/pt-machine.h | 76 - libpthread/linuxthreads/sysdeps/mips/pt-machine.h | 110 -- libpthread/linuxthreads/sysdeps/nios/pt-machine.h | 67 - libpthread/linuxthreads/sysdeps/nios2/pt-machine.h | 58 - .../linuxthreads/sysdeps/powerpc/pt-machine.h | 103 -- .../linuxthreads/sysdeps/pthread/bits/libc-lock.h | 328 ---- .../linuxthreads/sysdeps/pthread/bits/libc-tsd.h | 66 - .../sysdeps/pthread/bits/pthreadtypes.h | 142 -- libpthread/linuxthreads/sysdeps/pthread/pthread.h | 705 --------- libpthread/linuxthreads/sysdeps/pthread/tls.h | 81 - libpthread/linuxthreads/sysdeps/sh/pt-machine.h | 81 - libpthread/linuxthreads/sysdeps/sh/tls.h | 117 -- libpthread/linuxthreads/sysdeps/sh64/Makefile.arch | 26 - libpthread/linuxthreads/sysdeps/sh64/pt-machine.c | 47 - libpthread/linuxthreads/sysdeps/sh64/pt-machine.h | 36 - libpthread/linuxthreads/sysdeps/sparc/pt-machine.h | 8 - .../sysdeps/sparc/sparc32/pt-machine.h | 83 - .../sysdeps/sparc/sparc64/pt-machine.h | 105 -- libpthread/linuxthreads/sysdeps/v850/pt-machine.h | 46 - .../linuxthreads/sysdeps/x86_64/pt-machine.h | 86 -- libpthread/linuxthreads/sysdeps/x86_64/tls.h | 134 -- libpthread/linuxthreads/wrapsyscall.c | 220 --- libpthread/linuxthreads_db/Banner | 1 - libpthread/linuxthreads_db/Makefile | 15 - libpthread/linuxthreads_db/Makefile.in | 43 - libpthread/linuxthreads_db/Versions | 21 - libpthread/linuxthreads_db/proc_service.h | 70 - libpthread/linuxthreads_db/td_init.c | 32 - libpthread/linuxthreads_db/td_log.c | 32 - libpthread/linuxthreads_db/td_symbol_list.c | 56 - libpthread/linuxthreads_db/td_ta_clear_event.c | 53 - libpthread/linuxthreads_db/td_ta_delete.c | 58 - libpthread/linuxthreads_db/td_ta_enable_stats.c | 35 - libpthread/linuxthreads_db/td_ta_event_addr.c | 73 - libpthread/linuxthreads_db/td_ta_event_getmsg.c | 129 -- libpthread/linuxthreads_db/td_ta_get_nthreads.c | 42 - libpthread/linuxthreads_db/td_ta_get_ph.c | 36 - libpthread/linuxthreads_db/td_ta_get_stats.c | 35 - libpthread/linuxthreads_db/td_ta_map_id2thr.c | 79 - libpthread/linuxthreads_db/td_ta_map_lwp2thr.c | 91 -- libpthread/linuxthreads_db/td_ta_new.c | 150 -- libpthread/linuxthreads_db/td_ta_reset_stats.c | 35 - libpthread/linuxthreads_db/td_ta_set_event.c | 53 - libpthread/linuxthreads_db/td_ta_setconcurrency.c | 35 - libpthread/linuxthreads_db/td_ta_thr_iter.c | 174 --- libpthread/linuxthreads_db/td_ta_tsd_iter.c | 56 - libpthread/linuxthreads_db/td_thr_clear_event.c | 62 - libpthread/linuxthreads_db/td_thr_dbresume.c | 30 - libpthread/linuxthreads_db/td_thr_dbsuspend.c | 30 - libpthread/linuxthreads_db/td_thr_event_enable.c | 57 - libpthread/linuxthreads_db/td_thr_event_getmsg.c | 65 - libpthread/linuxthreads_db/td_thr_get_info.c | 83 - libpthread/linuxthreads_db/td_thr_getfpregs.c | 58 - libpthread/linuxthreads_db/td_thr_getgregs.c | 58 - libpthread/linuxthreads_db/td_thr_getxregs.c | 30 - libpthread/linuxthreads_db/td_thr_getxregsize.c | 30 - libpthread/linuxthreads_db/td_thr_set_event.c | 62 - libpthread/linuxthreads_db/td_thr_setfpregs.c | 47 - libpthread/linuxthreads_db/td_thr_setgregs.c | 47 - libpthread/linuxthreads_db/td_thr_setprio.c | 30 - libpthread/linuxthreads_db/td_thr_setsigpending.c | 31 - libpthread/linuxthreads_db/td_thr_setxregs.c | 30 - libpthread/linuxthreads_db/td_thr_sigsetmask.c | 30 - libpthread/linuxthreads_db/td_thr_tls_get_addr.c | 70 - libpthread/linuxthreads_db/td_thr_tsd.c | 82 - libpthread/linuxthreads_db/td_thr_validate.c | 70 - libpthread/linuxthreads_db/thread_db.h | 451 ------ libpthread/linuxthreads_db/thread_dbP.h | 110 -- 222 files changed, 17145 insertions(+), 17127 deletions(-) create mode 100644 libpthread/linuxthreads.old/Changes create mode 100644 libpthread/linuxthreads.old/FAQ.html create mode 100644 libpthread/linuxthreads.old/LICENSE create mode 100644 libpthread/linuxthreads.old/Makefile create mode 100644 libpthread/linuxthreads.old/Makefile.in create mode 100644 libpthread/linuxthreads.old/README create mode 100644 libpthread/linuxthreads.old/attr.c create mode 100644 libpthread/linuxthreads.old/cancel.c create mode 100644 libpthread/linuxthreads.old/condvar.c create mode 100644 libpthread/linuxthreads.old/debug.h create mode 100644 libpthread/linuxthreads.old/errno.c create mode 100644 libpthread/linuxthreads.old/events.c create mode 100644 libpthread/linuxthreads.old/internals.h create mode 100644 libpthread/linuxthreads.old/join.c create mode 100644 libpthread/linuxthreads.old/linuxthreads.texi create mode 100644 libpthread/linuxthreads.old/locale.c create mode 100644 libpthread/linuxthreads.old/lockfile.c create mode 100644 libpthread/linuxthreads.old/manager.c create mode 100644 libpthread/linuxthreads.old/mutex.c create mode 100644 libpthread/linuxthreads.old/oldsemaphore.c create mode 100644 libpthread/linuxthreads.old/pt-machine.c create mode 100644 libpthread/linuxthreads.old/ptfork.c create mode 100644 libpthread/linuxthreads.old/pthread.c create mode 100644 libpthread/linuxthreads.old/pthread.c-OLDEXAMPLE create mode 100644 libpthread/linuxthreads.old/ptlongjmp.c create mode 100644 libpthread/linuxthreads.old/queue.h create mode 100644 libpthread/linuxthreads.old/restart.h create mode 100644 libpthread/linuxthreads.old/rwlock.c create mode 100644 libpthread/linuxthreads.old/semaphore.c create mode 100644 libpthread/linuxthreads.old/semaphore.h create mode 100644 libpthread/linuxthreads.old/signals.c create mode 100644 libpthread/linuxthreads.old/specific.c create mode 100644 libpthread/linuxthreads.old/spinlock.c create mode 100644 libpthread/linuxthreads.old/spinlock.h create mode 100644 libpthread/linuxthreads.old/sysdeps/alpha/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/bfin/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/cris/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/frv/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/i386/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/i386/tls.h create mode 100644 libpthread/linuxthreads.old/sysdeps/i386/useldt.h create mode 100644 libpthread/linuxthreads.old/sysdeps/m68k/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/nios/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/nios2/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/powerpc/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h create mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h create mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/bits/pthreadtypes.h create mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/pthread.h create mode 100644 libpthread/linuxthreads.old/sysdeps/pthread/tls.h create mode 100644 libpthread/linuxthreads.old/sysdeps/sh/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/sh/tls.h create mode 100644 libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch create mode 100644 libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.c create mode 100644 libpthread/linuxthreads.old/sysdeps/sh64/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/sparc32/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/sparc/sparc64/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/v850/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/x86_64/pt-machine.h create mode 100644 libpthread/linuxthreads.old/sysdeps/x86_64/tls.h create mode 100644 libpthread/linuxthreads.old/wrapsyscall.c create mode 100644 libpthread/linuxthreads.old_db/Banner create mode 100644 libpthread/linuxthreads.old_db/Makefile create mode 100644 libpthread/linuxthreads.old_db/Makefile.in create mode 100644 libpthread/linuxthreads.old_db/Versions create mode 100644 libpthread/linuxthreads.old_db/proc_service.h create mode 100644 libpthread/linuxthreads.old_db/td_init.c create mode 100644 libpthread/linuxthreads.old_db/td_log.c create mode 100644 libpthread/linuxthreads.old_db/td_symbol_list.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_clear_event.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_delete.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_enable_stats.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_event_addr.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_event_getmsg.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_get_nthreads.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_get_ph.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_get_stats.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_map_id2thr.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_map_lwp2thr.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_new.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_reset_stats.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_set_event.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_setconcurrency.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_thr_iter.c create mode 100644 libpthread/linuxthreads.old_db/td_ta_tsd_iter.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_clear_event.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_dbresume.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_dbsuspend.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_event_enable.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_event_getmsg.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_get_info.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_getfpregs.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_getgregs.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_getxregs.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_getxregsize.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_set_event.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_setfpregs.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_setgregs.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_setprio.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_setsigpending.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_setxregs.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_sigsetmask.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_tsd.c create mode 100644 libpthread/linuxthreads.old_db/td_thr_validate.c create mode 100644 libpthread/linuxthreads.old_db/thread_db.h create mode 100644 libpthread/linuxthreads.old_db/thread_dbP.h delete mode 100644 libpthread/linuxthreads/Changes delete mode 100644 libpthread/linuxthreads/FAQ.html delete mode 100644 libpthread/linuxthreads/LICENSE delete mode 100644 libpthread/linuxthreads/Makefile delete mode 100644 libpthread/linuxthreads/Makefile.in delete mode 100644 libpthread/linuxthreads/README delete mode 100644 libpthread/linuxthreads/attr.c delete mode 100644 libpthread/linuxthreads/cancel.c delete mode 100644 libpthread/linuxthreads/condvar.c delete mode 100644 libpthread/linuxthreads/debug.h delete mode 100644 libpthread/linuxthreads/errno.c delete mode 100644 libpthread/linuxthreads/events.c delete mode 100644 libpthread/linuxthreads/internals.h delete mode 100644 libpthread/linuxthreads/join.c delete mode 100644 libpthread/linuxthreads/linuxthreads.texi delete mode 100644 libpthread/linuxthreads/locale.c delete mode 100644 libpthread/linuxthreads/lockfile.c delete mode 100644 libpthread/linuxthreads/manager.c delete mode 100644 libpthread/linuxthreads/mutex.c delete mode 100644 libpthread/linuxthreads/oldsemaphore.c delete mode 100644 libpthread/linuxthreads/pt-machine.c delete mode 100644 libpthread/linuxthreads/ptfork.c delete mode 100644 libpthread/linuxthreads/pthread.c delete mode 100644 libpthread/linuxthreads/pthread.c-OLDEXAMPLE delete mode 100644 libpthread/linuxthreads/ptlongjmp.c delete mode 100644 libpthread/linuxthreads/queue.h delete mode 100644 libpthread/linuxthreads/restart.h delete mode 100644 libpthread/linuxthreads/rwlock.c delete mode 100644 libpthread/linuxthreads/semaphore.c delete mode 100644 libpthread/linuxthreads/semaphore.h delete mode 100644 libpthread/linuxthreads/signals.c delete mode 100644 libpthread/linuxthreads/specific.c delete mode 100644 libpthread/linuxthreads/spinlock.c delete mode 100644 libpthread/linuxthreads/spinlock.h delete mode 100644 libpthread/linuxthreads/sysdeps/alpha/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/arm/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/bfin/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/cris/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/frv/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/i386/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/i386/tls.h delete mode 100644 libpthread/linuxthreads/sysdeps/i386/useldt.h delete mode 100644 libpthread/linuxthreads/sysdeps/m68k/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/mips/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/nios/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/nios2/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/powerpc/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/bits/libc-tsd.h delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/pthread.h delete mode 100644 libpthread/linuxthreads/sysdeps/pthread/tls.h delete mode 100644 libpthread/linuxthreads/sysdeps/sh/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/sh/tls.h delete mode 100644 libpthread/linuxthreads/sysdeps/sh64/Makefile.arch delete mode 100644 libpthread/linuxthreads/sysdeps/sh64/pt-machine.c delete mode 100644 libpthread/linuxthreads/sysdeps/sh64/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/v850/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/x86_64/pt-machine.h delete mode 100644 libpthread/linuxthreads/sysdeps/x86_64/tls.h delete mode 100644 libpthread/linuxthreads/wrapsyscall.c delete mode 100644 libpthread/linuxthreads_db/Banner delete mode 100644 libpthread/linuxthreads_db/Makefile delete mode 100644 libpthread/linuxthreads_db/Makefile.in delete mode 100644 libpthread/linuxthreads_db/Versions delete mode 100644 libpthread/linuxthreads_db/proc_service.h delete mode 100644 libpthread/linuxthreads_db/td_init.c delete mode 100644 libpthread/linuxthreads_db/td_log.c delete mode 100644 libpthread/linuxthreads_db/td_symbol_list.c delete mode 100644 libpthread/linuxthreads_db/td_ta_clear_event.c delete mode 100644 libpthread/linuxthreads_db/td_ta_delete.c delete mode 100644 libpthread/linuxthreads_db/td_ta_enable_stats.c delete mode 100644 libpthread/linuxthreads_db/td_ta_event_addr.c delete mode 100644 libpthread/linuxthreads_db/td_ta_event_getmsg.c delete mode 100644 libpthread/linuxthreads_db/td_ta_get_nthreads.c delete mode 100644 libpthread/linuxthreads_db/td_ta_get_ph.c delete mode 100644 libpthread/linuxthreads_db/td_ta_get_stats.c delete mode 100644 libpthread/linuxthreads_db/td_ta_map_id2thr.c delete mode 100644 libpthread/linuxthreads_db/td_ta_map_lwp2thr.c delete mode 100644 libpthread/linuxthreads_db/td_ta_new.c delete mode 100644 libpthread/linuxthreads_db/td_ta_reset_stats.c delete mode 100644 libpthread/linuxthreads_db/td_ta_set_event.c delete mode 100644 libpthread/linuxthreads_db/td_ta_setconcurrency.c delete mode 100644 libpthread/linuxthreads_db/td_ta_thr_iter.c delete mode 100644 libpthread/linuxthreads_db/td_ta_tsd_iter.c delete mode 100644 libpthread/linuxthreads_db/td_thr_clear_event.c delete mode 100644 libpthread/linuxthreads_db/td_thr_dbresume.c delete mode 100644 libpthread/linuxthreads_db/td_thr_dbsuspend.c delete mode 100644 libpthread/linuxthreads_db/td_thr_event_enable.c delete mode 100644 libpthread/linuxthreads_db/td_thr_event_getmsg.c delete mode 100644 libpthread/linuxthreads_db/td_thr_get_info.c delete mode 100644 libpthread/linuxthreads_db/td_thr_getfpregs.c delete mode 100644 libpthread/linuxthreads_db/td_thr_getgregs.c delete mode 100644 libpthread/linuxthreads_db/td_thr_getxregs.c delete mode 100644 libpthread/linuxthreads_db/td_thr_getxregsize.c delete mode 100644 libpthread/linuxthreads_db/td_thr_set_event.c delete mode 100644 libpthread/linuxthreads_db/td_thr_setfpregs.c delete mode 100644 libpthread/linuxthreads_db/td_thr_setgregs.c delete mode 100644 libpthread/linuxthreads_db/td_thr_setprio.c delete mode 100644 libpthread/linuxthreads_db/td_thr_setsigpending.c delete mode 100644 libpthread/linuxthreads_db/td_thr_setxregs.c delete mode 100644 libpthread/linuxthreads_db/td_thr_sigsetmask.c delete mode 100644 libpthread/linuxthreads_db/td_thr_tls_get_addr.c delete mode 100644 libpthread/linuxthreads_db/td_thr_tsd.c delete mode 100644 libpthread/linuxthreads_db/td_thr_validate.c delete mode 100644 libpthread/linuxthreads_db/thread_db.h delete mode 100644 libpthread/linuxthreads_db/thread_dbP.h diff --git a/Rules.mak b/Rules.mak index 7a0c48733..8389f74e5 100644 --- a/Rules.mak +++ b/Rules.mak @@ -333,9 +333,13 @@ endif ifeq ($(UCLIBC_HAS_THREADS),y) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) PTNAME := nptl +else +ifeq ($(LINUXTHREADS_OLD),y) + PTNAME := linuxthreads.old else PTNAME := linuxthreads endif +endif PTDIR := $(TOPDIR)libpthread/$(PTNAME) # set up system dependencies include dirs (NOTE: order matters!) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 891820e7f..e15e9e7b6 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -326,6 +326,20 @@ config PTHREADS_DEBUG_SUPPORT If you are doing development and want to debug applications using uClibc's pthread library, answer Y. Otherwise, answer N. +config LINUXTHREADS_OLD + bool "Use the older (stable) version of linuxthreads" + default y + depends on UCLIBC_HAS_THREADS + help + There are two versions of linuxthreads. The older (stable) version + has been in uClibc for quite a long time but hasn't seen too many + updates other than bugfixes. + + The new version has not been tested much, and lacks ports for arches + which glibc does not support (like bfin/frv/etc...), but is based on + the latest code from glibc, so it may be the only choice for the + newer ports (like alpha/amd64/64bit arches and hppa). + config UCLIBC_HAS_LFS bool "Large File Support" default y diff --git a/libpthread/linuxthreads.old/Changes b/libpthread/linuxthreads.old/Changes new file mode 100644 index 000000000..b213f36c5 --- /dev/null +++ b/libpthread/linuxthreads.old/Changes @@ -0,0 +1,85 @@ +Release 0.9: +- more ports (SH, IA-64, s390) +- many bug fixes +- timed sync object wait functions +- barrier implementation +- spinlocks implementation +- thread register on x86 +- variable stack size and position on some platforms + +Release 0.8: +(ehmm, forgot to update, don't know anymore) + +Release 0.7: +- Destructors for thread-specific data now conform to the POSIX semantics + (call destructors again if non-NULL TSD remains after a round of + destruction). +- Implemented thread-specific data as a sparse array, allows more TSD keys + and smaller thread descriptors (Ulrich Drepper). +- Added "error checking" mutexes. +- Protect against multiple sigwait() on the same signals. +- Simplified implementation of semaphores when compare_and_swap is + not available. +- Fixed bug in fork() where stdin was closed if fork() was called before + the first pthread_create(). +- Fixed bug in the gethostby*_r functions (bad result if null bytes + in addresses). +- Typos in manual pages corrected. +- First cut at a PowerPC port (not working yet, runs into problems + with gcc and with the C library). + +Release 0.6: +- Validation of thread identifiers: no more crashes when operating on + a thread that has exited (based on Pavel Krauz's ideas). +- Added fallback implementation of semaphores for the 386 and the + Sparc. +- Fixed a bug in signal handling causing false restarts of suspended + threads. +- Fixed a bug in realtime scheduling causing all threads to have + default scheduling on Ix86 with libc5. +- With realtime scheduling, unlocking a mutex now restarts the + highest priority thread waiting on the mutex, not the + first-suspended thread (Richard Neitzel). +- Timing a process now returns cumulative times for all threads, not + just times for the initial thread (suggested by Wolfram Gloger). +- Cleaned up name space (internal defs prefixed by __, weak aliases + for non-portable extensions). +- MIPS port (contributed by Ralf Baechle). + +Release 0.5: +- Signal-safe semaphores a la POSIX 1003.1b added. +- Locking bug in pthread_mutex_trylock over recursive mutexes fixed. +- Race conditions in thread cancellation fixed. +- Sparc port (contributed by Miguel de Icaza). +- Support for getpwnam_r and getpwuid_r. +- Added pthread_kill_other_threads_np to be used in conjunction with + exec*(). + +Release 0.4: +- Manual pages for all functions. +- Synchronization bug causing accumulation of zombie processes fixed. +- Race condition in pthread_cond_timedwait fixed. +- Recursive mutexes are back by popular demand. +- Partial support for realtime scheduling (initiated by Richard Neitzel). +- pthread.h cleaned up a lot: now C++ compatible, added missing "const" + qualifiers, added short documentation, put to GNU libc standards + for name space pollution (Ulrich Drepper). +- Motorola 68k port (contributed by Andreas Schwab). +- Interaction with fork(2) cleaned up a lot. + +Release 0.3: +- Thread creation and reclaimation now performed by a centralized + "thread manager" thread. +- Removed recursive mutexes to make regular mutexes more efficient. +- Now available as a shared library (contributed by Richard Henderson). +- Alpha port (contributed by Richard Henderson). +- Fixed many small discrepancies with Posix 1003.1c. +- Put under the LGPL instead of the GPL. + +Release 0.2: +- Reentrant libc functions (adapted from libc 5.3.9 by Peeter Joot) +- pthread_cond_wait did not reacquire the mutex correctly on return +- More efficient pthread_cond_broadcast + +Release 0.1: +- First public release diff --git a/libpthread/linuxthreads.old/FAQ.html b/libpthread/linuxthreads.old/FAQ.html new file mode 100644 index 000000000..21be33ec4 --- /dev/null +++ b/libpthread/linuxthreads.old/FAQ.html @@ -0,0 +1,1039 @@ + + +LinuxThreads Frequently Asked Questions + + +

LinuxThreads Frequently Asked Questions
+ (with answers)

+

[For LinuxThreads version 0.8]

+ +

+ +A. The big picture
+B. Getting more information
+C. Issues related to the C library
+D. Problems, weird behaviors, potential bugs
+E. Missing functions, wrong types, etc
+F. C++ issues
+G. Debugging LinuxThreads programs
+H. Compiling multithreaded code; errno madness
+I. X-Windows and other libraries
+J. Signals and threads
+K. Internals of LinuxThreads

+ +


+

+ +

A. The big picture

+ +

A.1: What is LinuxThreads?

+ +LinuxThreads is a Linux library for multi-threaded programming. +It implements the Posix 1003.1c API (Application Programming +Interface) for threads. It runs on any Linux system with kernel 2.0.0 +or more recent, and a suitable C library (see section C). +

+ +

A.2: What are threads?

+ +A thread is a sequential flow of control through a program. +Multi-threaded programming is, thus, a form of parallel programming +where several threads of control are executing concurrently in the +program. All threads execute in the same memory space, and can +therefore work concurrently on shared data.

+ +Multi-threaded programming differs from Unix-style multi-processing in +that all threads share the same memory space (and a few other system +resources, such as file descriptors), instead of running in their own +memory space as is the case with Unix processes.

+ +Threads are useful for two reasons. First, they allow a program to +exploit multi-processor machines: the threads can run in parallel on +several processors, allowing a single program to divide its work +between several processors, thus running faster than a single-threaded +program, which runs on only one processor at a time. Second, some +programs are best expressed as several threads of control that +communicate together, rather than as one big monolithic sequential +program. Examples include server programs, overlapping asynchronous +I/O, and graphical user interfaces.

+ +

A.3: What is POSIX 1003.1c?

+ +It's an API for multi-threaded programming standardized by IEEE as +part of the POSIX standards. Most Unix vendors have endorsed the +POSIX 1003.1c standard. Implementations of the 1003.1c API are +already available under Sun Solaris 2.5, Digital Unix 4.0, +Silicon Graphics IRIX 6, and should soon be available from other +vendors such as IBM and HP. More generally, the 1003.1c API is +replacing relatively quickly the proprietary threads library that were +developed previously under Unix, such as Mach cthreads, Solaris +threads, and IRIX sprocs. Thus, multithreaded programs using the +1003.1c API are likely to run unchanged on a wide variety of Unix +platforms.

+ +

A.4: What is the status of LinuxThreads?

+ +LinuxThreads implements almost all of Posix 1003.1c, as well as a few +extensions. The only part of LinuxThreads that does not conform yet +to Posix is signal handling (see section J). Apart +from the signal stuff, all the Posix 1003.1c base functionality, +as well as a number of optional extensions, are provided and conform +to the standard (to the best of my knowledge). +The signal stuff is hard to get right, at least without special kernel +support, and while I'm definitely looking at ways to implement the +Posix behavior for signals, this might take a long time before it's +completed.

+ +

A.5: How stable is LinuxThreads?

+ +The basic functionality (thread creation and termination, mutexes, +conditions, semaphores) is very stable. Several industrial-strength +programs, such as the AOL multithreaded Web server, use LinuxThreads +and seem quite happy about it. There used to be some rough edges in +the LinuxThreads / C library interface with libc 5, but glibc 2 +fixes all of those problems and is now the standard C library on major +Linux distributions (see section C).

+ +


+

+ +

B. Getting more information

+ +

B.1: What are good books and other sources of +information on POSIX threads?

+ +The FAQ for comp.programming.threads lists several books: +http://www.serpentine.com/~bos/threads-faq/.

+ +There are also some online tutorials. Follow the links from the +LinuxThreads web page: +http://pauillac.inria.fr/~xleroy/linuxthreads.

+ +

B.2: I'd like to be informed of future developments on +LinuxThreads. Is there a mailing list for this purpose?

+ +I post LinuxThreads-related announcements on the newsgroup +comp.os.linux.announce, +and also on the mailing list +linux-threads@magenet.com. +You can subscribe to the latter by writing +majordomo@magenet.com.

+ +

B.3: What are good places for discussing +LinuxThreads?

+ +For questions about programming with POSIX threads in general, use +the newsgroup +comp.programming.threads. +Be sure you read the +FAQ +for this group before you post.

+ +For Linux-specific questions, use +comp.os.linux.development.apps +and comp.os.linux.development.kernel. +The latter is especially appropriate for questions relative to the +interface between the kernel and LinuxThreads.

+ +

B.4: How should I report a possible bug in +LinuxThreads?

+ +If you're using glibc 2, the best way by far is to use the +glibcbug script to mail a bug report to the glibc +maintainers.

+ +If you're using an older libc, or don't have the glibcbug +script on your machine, then e-mail me directly +(Xavier.Leroy@inria.fr).

+ +In both cases, before sending the bug report, make sure that it is not +addressed already in this FAQ. Also, try to send a short program that +reproduces the weird behavior you observed.

+ +

B.5: I'd like to read the POSIX 1003.1c standard. Is +it available online?

+ +Unfortunately, no. POSIX standards are copyrighted by IEEE, and +IEEE does not distribute them freely. You can buy paper copies from +IEEE, but the price is fairly high ($120 or so). If you disagree with +this policy and you're an IEEE member, be sure to let them know.

+ +On the other hand, you probably don't want to read the standard. It's +very hard to read, written in standard-ese, and targeted to +implementors who already know threads inside-out. A good book on +POSIX threads provides the same information in a much more readable form. +I can personally recommend Dave Butenhof's book, Programming +with POSIX threads (Addison-Wesley). Butenhof was part of the +POSIX committee and also designed the Digital Unix implementations of +POSIX threads, and it shows.

+ +Another good source of information is the X/Open Group Single Unix +specification which is available both +on-line +and as a +book and CD/ROM. +That specification includes pretty much all the POSIX standards, +including 1003.1c, with some extensions and clarifications.

+ +


+

+ +

C. Issues related to the C library

+ +

C.1: Which version of the C library should I use +with LinuxThreads?

+ +The best choice by far is glibc 2, a.k.a. libc 6. It offers very good +support for multi-threading, and LinuxThreads has been closely +integrated with glibc 2. The glibc 2 distribution contains the +sources of a specially adapted version of LinuxThreads.

+ +glibc 2 comes preinstalled as the default C library on several Linux +distributions, such as RedHat 5 and up, and Debian 2. +Those distributions include the version of LinuxThreads matching +glibc 2.

+ +

C.2: My system has libc 5 preinstalled, not glibc +2. Can I still use LinuxThreads?

+ +Yes, but you're likely to run into some problems, as libc 5 only +offers minimal support for threads and contains some bugs that affect +multithreaded programs.

+ +The versions of libc 5 that work best with LinuxThreads are +libc 5.2.18 on the one hand, and libc 5.4.12 or later on the other hand. +Avoid 5.3.12 and 5.4.7: these have problems with the per-thread errno +variable.

+ +

C.3: So, should I switch to glibc 2, or stay with a +recent libc 5?

+ +I'd recommend you switch to glibc 2. Even for single-threaded +programs, glibc 2 is more solid and more standard-conformant than libc +5. And the shortcomings of libc 5 almost preclude any serious +multi-threaded programming.

+ +Switching an already installed +system from libc 5 to glibc 2 is not completely straightforward. +See the Glibc2 +HOWTO for more information. Much easier is (re-)installing a +Linux distribution based on glibc 2, such as RedHat 6.

+ +

C.4: Where can I find glibc 2 and the version of +LinuxThreads that goes with it?

+ +On prep.ai.mit.edu and its many, many mirrors around the world. +See http://www.gnu.org/order/ftp.html +for a list of mirrors.

+ +

C.5: Where can I find libc 5 and the version of +LinuxThreads that goes with it?

+ +For libc 5, see ftp://sunsite.unc.edu/pub/Linux/devel/GCC/.

+ +For the libc 5 version of LinuxThreads, see +ftp://ftp.inria.fr/INRIA/Projects/cristal/Xavier.Leroy/linuxthreads/.

+ +

C.6: How can I recompile the glibc 2 version of the +LinuxThreads sources?

+ +You must transfer the whole glibc sources, then drop the LinuxThreads +sources in the linuxthreads/ subdirectory, then recompile +glibc as a whole. There are now too many inter-dependencies between +LinuxThreads and glibc 2 to allow separate re-compilation of LinuxThreads. +

+ +

C.7: What is the correspondence between LinuxThreads +version numbers, libc version numbers, and RedHat version +numbers?

+ +Here is a summary. (Information on Linux distributions other than +RedHat are welcome.)

+ + + + + + + +
LinuxThreads C library RedHat
0.7, 0.71 (for libc 5) libc 5.x RH 4.2
0.7, 0.71 (for glibc 2) glibc 2.0.x RH 5.x
0.8 glibc 2.1.1 RH 6.0
0.8 glibc 2.1.2 not yet released
+

+ +


+

+ +

D. Problems, weird behaviors, potential bugs

+ +

D.1: When I compile LinuxThreads, I run into problems in +file libc_r/dirent.c

+ +You probably mean: +
+        libc_r/dirent.c:94: structure has no member named `dd_lock'
+
+I haven't actually seen this problem, but several users reported it. +My understanding is that something is wrong in the include files of +your Linux installation (/usr/include/*). Make sure +you're using a supported version of the libc 5 library. (See question C.2).

+ +

D.2: When I compile LinuxThreads, I run into problems with +/usr/include/sched.h: there are several occurrences of +_p that the C compiler does not understand

+ +Yes, /usr/include/sched.h that comes with libc 5.3.12 is broken. +Replace it with the sched.h file contained in the +LinuxThreads distribution. But really you should not be using libc +5.3.12 with LinuxThreads! (See question C.1.)

+ +

D.3: My program does fdopen() on a file +descriptor opened on a pipe. When I link it with LinuxThreads, +fdopen() always returns NULL!

+ +You're using one of the buggy versions of libc (5.3.12, 5.4.7., etc). +See question C.1 above.

+ +

D.4: My program creates a lot of threads, and after +a while pthread_create() no longer returns!

+ +This is known bug in the version of LinuxThreads that comes with glibc +2.1.1. An upgrade to 2.1.2 is recommended.

+ +

D.5: When I'm running a program that creates N +threads, top or ps +display N+2 processes that are running my program. What do all these +processes correspond to?

+ +Due to the general "one process per thread" model, there's one process +for the initial thread and N processes for the threads it created +using pthread_create. That leaves one process +unaccounted for. That extra process corresponds to the "thread +manager" thread, a thread created internally by LinuxThreads to handle +thread creation and thread termination. This extra thread is asleep +most of the time. + +

D.6: Scheduling seems to be very unfair when there +is strong contention on a mutex: instead of giving the mutex to each +thread in turn, it seems that it's almost always the same thread that +gets the mutex. Isn't this completely broken behavior?

+ +That behavior has mostly disappeared in recent releases of +LinuxThreads (version 0.8 and up). It was fairly common in older +releases, though. + +What happens in LinuxThreads 0.7 and before is the following: when a +thread unlocks a mutex, all other threads that were waiting on the +mutex are sent a signal which makes them runnable. However, the +kernel scheduler may or may not restart them immediately. If the +thread that unlocked the mutex tries to lock it again immediately +afterwards, it is likely that it will succeed, because the threads +haven't yet restarted. This results in an apparently very unfair +behavior, when the same thread repeatedly locks and unlocks the mutex, +while other threads can't lock the mutex.

+ +In LinuxThreads 0.8 and up, pthread_unlock restarts only +one waiting thread, and pre-assign the mutex to that thread. Hence, +if the thread that unlocked the mutex tries to lock it again +immediately, it will block until other waiting threads have had a +chance to lock and unlock the mutex. This results in much fairer +scheduling.

+ +Notice however that even the old "unfair" behavior is perfectly +acceptable with respect to the POSIX standard: for the default +scheduling policy, POSIX makes no guarantees of fairness, such as "the +thread waiting for the mutex for the longest time always acquires it +first". Properly written multithreaded code avoids that kind of heavy +contention on mutexes, and does not run into fairness problems. If +you need scheduling guarantees, you should consider using the +real-time scheduling policies SCHED_RR and +SCHED_FIFO, which have precisely defined scheduling +behaviors.

+ +

D.7: I have a simple test program with two threads +that do nothing but printf() in tight loops, and from the +printout it seems that only one thread is running, the other doesn't +print anything!

+ +Again, this behavior is characteristic of old releases of LinuxThreads +(0.7 and before); more recent versions (0.8 and up) should not exhibit +this behavior.

+ +The reason for this behavior is explained in +question D.6 above: printf() performs +locking on stdout, and thus your two threads contend very +heavily for the mutex associated with stdout. But if you +do some real work between two calls to printf(), you'll +see that scheduling becomes much smoother.

+ +

D.8: I've looked at <pthread.h> +and there seems to be a gross error in the pthread_cleanup_push +macro: it opens a block with { but does not close it! +Surely you forgot a } at the end of the macro, right? +

+ +Nope. That's the way it should be. The closing brace is provided by +the pthread_cleanup_pop macro. The POSIX standard +requires pthread_cleanup_push and +pthread_cleanup_pop to be used in matching pairs, at the +same level of brace nesting. This allows +pthread_cleanup_push to open a block in order to +stack-allocate some data structure, and +pthread_cleanup_pop to close that block. It's ugly, but +it's the standard way of implementing cleanup handlers.

+ +

D.9: I tried to use real-time threads and my program +loops like crazy and freezes the whole machine!

+ +Versions of LinuxThreads prior to 0.8 are susceptible to ``livelocks'' +(one thread loops, consuming 100% of the CPU time) in conjunction with +real-time scheduling. Since real-time threads and processes have +higher priority than normal Linux processes, all other processes on +the machine, including the shell, the X server, etc, cannot run and +the machine appears frozen.

+ +The problem is fixed in LinuxThreads 0.8.

+ +

D.10: My application needs to create thousands of +threads, or maybe even more. Can I do this with +LinuxThreads?

+ +No. You're going to run into several hard limits: + +(Other POSIX threads libraries have similar limitations, by the way.) +For all those reasons, you'd better restructure your application so +that it doesn't need more than, say, 100 threads. For instance, +in the case of a multithreaded server, instead of creating a new +thread for each connection, maintain a fixed-size pool of worker +threads that pick incoming connection requests from a queue.

+ +


+

+ +

E. Missing functions, wrong types, etc

+ +

E.1: Where is pthread_yield() ? How +comes LinuxThreads does not implement it?

+ +Because it's not part of the (final) POSIX 1003.1c standard. +Several drafts of the standard contained pthread_yield(), +but then the POSIX guys discovered it was redundant with +sched_yield() and dropped it. So, just use +sched_yield() instead. + +

E.2: I've found some type errors in +<pthread.h>. +For instance, the second argument to pthread_create() +should be a pthread_attr_t, not a +pthread_attr_t *. Also, didn't you forget to declare +pthread_attr_default?

+ +No, I didn't. What you're describing is draft 4 of the POSIX +standard, which is used in OSF DCE threads. LinuxThreads conforms to the +final standard. Even though the functions have the same names as in +draft 4 and DCE, their calling conventions are slightly different. In +particular, attributes are passed by reference, not by value, and +default attributes are denoted by the NULL pointer. Since draft 4/DCE +will eventually disappear, you'd better port your program to use the +standard interface.

+ +

E.3: I'm porting an application from Solaris and I +have to rename all thread functions from thr_blah to +pthread_blah. This is very annoying. Why did you change +all the function names?

+ +POSIX did it. The thr_* functions correspond to Solaris +threads, an older thread interface that you'll find only under +Solaris. The pthread_* functions correspond to POSIX +threads, an international standard available for many, many platforms. +Even Solaris 2.5 and later support the POSIX threads interface. So, +do yourself a favor and rewrite your code to use POSIX threads: this +way, it will run unchanged under Linux, Solaris, and quite a lot of +other platforms.

+ +

E.4: How can I suspend and resume a thread from +another thread? Solaris has the thr_suspend() and +thr_resume() functions to do that; why don't you?

+ +The POSIX standard provides no mechanism by which a thread A can +suspend the execution of another thread B, without cooperation from B. +The only way to implement a suspend/restart mechanism is to have B +check periodically some global variable for a suspend request +and then suspend itself on a condition variable, which another thread +can signal later to restart B.

+ +Notice that thr_suspend() is inherently dangerous and +prone to race conditions. For one thing, there is no control on where +the target thread stops: it can very well be stopped in the middle of +a critical section, while holding mutexes. Also, there is no +guarantee on when the target thread will actually stop. For these +reasons, you'd be much better off using mutexes and conditions +instead. The only situations that really require the ability to +suspend a thread are debuggers and some kind of garbage collectors.

+ +If you really must suspend a thread in LinuxThreads, you can send it a +SIGSTOP signal with pthread_kill. Send +SIGCONT for restarting it. +Beware, this is specific to LinuxThreads and entirely non-portable. +Indeed, a truly conforming POSIX threads implementation will stop all +threads when one thread receives the SIGSTOP signal! +One day, LinuxThreads will implement that behavior, and the +non-portable hack with SIGSTOP won't work anymore.

+ +

E.5: Does LinuxThreads implement +pthread_attr_setstacksize() and +pthread_attr_setstackaddr()?

+ +These optional functions are provided in recent versions of +LinuxThreads (0.8 and up). Earlier releases did not provide these +optional components of the POSIX standard.

+ +Even if pthread_attr_setstacksize() and +pthread_attr_setstackaddr() are now provided, we still +recommend that you do not use them unless you really have strong +reasons for doing so. The default stack allocation strategy for +LinuxThreads is nearly optimal: stacks start small (4k) and +automatically grow on demand to a fairly large limit (2M). +Moreover, there is no portable way to estimate the stack requirements +of a thread, so setting the stack size yourself makes your program +less reliable and non-portable.

+ +

E.6: LinuxThreads does not support the +PTHREAD_SCOPE_PROCESS value of the "contentionscope" +attribute. Why?

+ +With a "one-to-one" model, as in LinuxThreads (one kernel execution +context per thread), there is only one scheduler for all processes and +all threads on the system. So, there is no way to obtain the behavior of +PTHREAD_SCOPE_PROCESS. + +

E.7: LinuxThreads does not implement process-shared +mutexes, conditions, and semaphores. Why?

+ +This is another optional component of the POSIX standard. Portable +applications should test _POSIX_THREAD_PROCESS_SHARED +before using this facility. +

+The goal of this extension is to allow different processes (with +different address spaces) to synchronize through mutexes, conditions +or semaphores allocated in shared memory (either SVR4 shared memory +segments or mmap()ed files). +

+The reason why this does not work in LinuxThreads is that mutexes, +conditions, and semaphores are not self-contained: their waiting +queues contain pointers to linked lists of thread descriptors, and +these pointers are meaningful only in one address space. +

+Matt Messier and I spent a significant amount of time trying to design a +suitable mechanism for sharing waiting queues between processes. We +came up with several solutions that combined two of the following +three desirable features, but none that combines all three: +

+We concluded that kernel support is required to share mutexes, +conditions and semaphores between processes. That's one place where +Linus Torvalds's intuition that "all we need in the kernel is +clone()" fails. +

+Until suitable kernel support is available, you'd better use +traditional interprocess communications to synchronize different +processes: System V semaphores and message queues, or pipes, or sockets. +

+ +


+

+ +

F. C++ issues

+ +

F.1: Are there C++ wrappers for LinuxThreads?

+ +Douglas Schmidt's ACE library contains, among a lot of other +things, C++ wrappers for LinuxThreads and quite a number of other +thread libraries. Check out +http://www.cs.wustl.edu/~schmidt/ACE.html

+ +

F.2: I'm trying to use LinuxThreads from a C++ +program, and the compiler complains about the third argument to +pthread_create() !

+ +You're probably trying to pass a class member function or some +other C++ thing as third argument to pthread_create(). +Recall that pthread_create() is a C function, and it must +be passed a C function as third argument.

+ +

F.3: I'm trying to use LinuxThreads in conjunction +with libg++, and I'm having all sorts of trouble.

+ +>From what I understand, thread support in libg++ is completely broken, +especially with respect to locking of iostreams. H.J.Lu wrote: +
+If you want to use thread, I can only suggest egcs and glibc. You +can find egcs at +http://www.cygnus.com/egcs. +egcs has libsdtc++, which is MT safe under glibc 2. If you really +want to use the libg++, I have a libg++ add-on for egcs. +
+
+

+ +

G. Debugging LinuxThreads programs

+ +

G.1: Can I debug LinuxThreads program using gdb?

+ +Yes, but not with the stock gdb 4.17. You need a specially patched +version of gdb 4.17 developed by Eric Paire and colleages at The Open +Group, Grenoble. The patches against gdb 4.17 are available at +http://www.gr.opengroup.org/java/jdk/linux/debug.htm. +Precompiled binaries of the patched gdb are available in RedHat's RPM +format at http://odin.appliedtheory.com/.

+ +Some Linux distributions provide an already-patched version of gdb; +others don't. For instance, the gdb in RedHat 5.2 is thread-aware, +but apparently not the one in RedHat 6.0. Just ask (politely) the +makers of your Linux distributions to please make sure that they apply +the correct patches to gdb.

+ +

G.2: Does it work with post-mortem debugging?

+ +Not very well. Generally, the core file does not correspond to the +thread that crashed. The reason is that the kernel will not dump core +for a process that shares its memory with other processes, such as the +other threads of your program. So, the thread that crashes silently +disappears without generating a core file. Then, all other threads of +your program die on the same signal that killed the crashing thread. +(This is required behavior according to the POSIX standard.) The last +one that dies is no longer sharing its memory with anyone else, so the +kernel generates a core file for that thread. Unfortunately, that's +not the thread you are interested in. + +

G.3: Any other ways to debug multithreaded programs, then?

+ +Assertions and printf() are your best friends. Try to debug +sequential parts in a single-threaded program first. Then, put +printf() statements all over the place to get execution traces. +Also, check invariants often with the assert() macro. In truth, +there is no other effective way (save for a full formal proof of your +program) to track down concurrency bugs. Debuggers are not really +effective for subtle concurrency problems, because they disrupt +program execution too much.

+ +


+

+ +

H. Compiling multithreaded code; errno madness

+ +

H.1: You say all multithreaded code must be compiled +with _REENTRANT defined. What difference does it make?

+ +It affects include files in three ways: +