The thread_type is irrelevant as all local POSIX threads are in user-space.
Keep the thread_type member in td_thread_info_st to preserve ABI
compatibility.
Later the remnants from M:N will be refactored in one go with library ABI
version bump.
Sponsored by <The NetBSD Foundation>
td_thr_info - get information on a thread
Currently a subset of td_thread_info_t is documented. This version
describes thread_addr and thread_state.
Sponsored by <The NetBSD Foundation>
Scheduler Activation types were removed in NetBSD 5.0. Old type set is not
matching the new world POSIX threads library.
Only TD_STATE_RUNNING, TD_STATE_ZOMBIE are still applicable - keep it.
Keep TD_STATE_UNKNOWN as generic unrecognized type.
Add new TD_STATE_DEAD one. The TD_STATE_DEAD type is represented by number
6 in the POSIX threads library, but for the sake of compatibility with
older software using pthread_dbg - renumber it to 7, as six was reserved
for TD_STATE_SUSPENDED.
Old removed state types are marked as reserved and unused.
Sponsored by <The NetBSD Foundation>
The pt_magic field is not the first one in the pthread_t structure.
After this fix, this code is confirmed to work and function td_thr_info()
is functional.
Sponsored by <The NetBSD Foundation>
NetBSD's PTHREAD_KEYS_MAX is set to 256, which is low compared to
other systems like Linux (1024) or MacOS X (512). As a result some
setups tested on Linux will exhibit problems on NetBSD because of
pthread_keys usage beyond the limit. This happens for instance on
Apache with various module loaded, and in this case no particular
developper can be blamed for going beyond the limit, since several
modules from different sources contribute to the problem.
This patch makes the limit conigurable through the PTHREAD_KEYS_MAX
environement variable. If undefined, the default remains unchanged
(256). In any case, the value cannot be lowered below POSIX-mandated
_POSIX_THREAD_KEYS_MAX (128).
While there:
- use EXIT_FAILURE instead of 1 when calling err(3) in libpthread.
- Reset _POSIX_THREAD_KEYS_MAX to POSIX mandated 128, instead of 256.
- statically initialize all global spin locks. on hppa, 0 means
the lock is held, so leaving them with the default value doesn't work.
- compare functions pointers using a function-pointer type rather than
an integral type. on hppa, function pointers may be indirect,
so we need to trigger gcc to emit calls to the function-pointer
canonicalization routines in the millicode.
- on hppa the stack grows up, so handle that using the STACK_* macros.
<machine/reg.h> plays dirty naming tricks on sparc64 to allow 32bit
compatibility (reg -> reg64 and the parameter in
PTHREAD_REG_TO_UCONTEXT() is called reg). This probably needs to be
fixed separately, but for now reordering the includes will do.
the proc_regsize() callback to allocate reg and fpreg buffers as part of the
proc state (lazily initialized by the PT_STATE_RUNNING case of
td_thr_suspend()).
Fixes build on sh3 (and probably sh5) platforms.