Commit Graph

53 Commits

Author SHA1 Message Date
manu 841339f07f Make PTHREAD_KEYS_MAX dynamically adjustable
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.
2015-05-29 07:37:31 +00:00
joerg 9c3fd52490 Introduce GENASSYM_CPPFLAGS for options during genassym processing.
Consistently drop assembler flags.
2014-03-04 14:58:14 +00:00
christos 38f91e249c Only the first symbol (pthread_dbg) should return NOLIB, the rest indicate
internal inconsistencies, so let the code return a more vocal error.
2013-01-20 18:45:19 +00:00
christos 1197f89ea3 tsd_alloc is no more, use tsd_list, and disable the destructor walking code
since it needs work. Fixes gdb.
2013-01-20 18:18:07 +00:00
joerg d306702545 Match ARCHSUBDIR logic from libpthread. 2012-07-19 06:33:48 +00:00
matt fa835e8c8b These directories default to WARNS?=5 2012-03-21 05:37:42 +00:00
christos 80e86efb1f constify. 2011-10-02 18:18:14 +00:00
matt 353ac4a525 Since this is use pthread_int.h, it needs __LIBPTHREAD_SOURCE__ to be defined. 2011-03-17 01:01:15 +00:00
christos 46edb91e9f bump shared libraries. 2009-01-11 03:07:47 +00:00
ad 55faac1242 pthread_key_create: instead of using a simple 1/0 value to record a key
as allocated, use an array of pointers and save __builtin_return_address(0)
so keys can be identified when doing post-mortem debugging.
2008-03-07 22:27:07 +00:00
ad bc9419f99a Crank libpthread_dbg major. 2007-10-16 15:11:27 +00:00
ad 9472415c5e Remove stuff that is no longer useful. 2007-10-16 15:06:11 +00:00
skrll 9fdaf800d9 Merge nick-csl-alignment. 2007-09-10 11:34:05 +00:00
ad 71197327ee Catch up with libpthread changes. 2007-08-16 01:09:50 +00:00
ad 7bf06aa722 Make libpthread_dbg build again. 2007-08-04 18:54:12 +00:00
skrll 3d370a5b33 Remove more SA libpthread stuff. 2007-03-14 21:09:01 +00:00
ad de2138164c Remove the PTHREAD_SA option. If M:N threads is reimplemented it's
better off done with a seperate library.
2007-03-02 18:53:51 +00:00
ad a21c37097e Bump libpthread & libpthread_dbg minor versions so that an old SA copy
gets kept in the file system. Requested by pavel.
2007-02-09 23:00:16 +00:00
ad 401499f30e Sync with kernel changes introduced by merging the newlock2 branch. 2007-02-09 22:08:48 +00:00
ad d333bb5f2f Build without sys/sa.h present. 2007-02-06 15:24:37 +00:00
christos f1700f07c0 But turn on PTHREAD_SA, since turning it off does not work yet. 2006-12-24 03:54:43 +00:00
christos 34bc1fc940 just get this to compile again, so that people can build. 2006-12-24 03:47:53 +00:00
christos 06f18c1c0d XXX: GCC uninitialized variable. 2006-05-14 02:15:31 +00:00
mycroft 2b4ccae3e9 Remove pt_blockuc. If the debugger attempts to muck with the state of a
blocked thread, return an error; this should be done through ptrace(2).
2004-10-12 22:17:56 +00:00
chs 94a458cedd enhance MI pthreads code to support hppa:
- 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.
2004-07-18 21:24:52 +00:00
nathanw 993713df32 Recognize thread objects in addr2sync. 2004-07-06 19:33:53 +00:00
nathanw 3a30736db7 td_sync_info(): explicitly clear the "locked" flag when unlocked,
instead of leaving it as garbage.
2004-07-01 18:59:52 +00:00
nathanw aaad58dd18 td_map_addr2sync(): recognize read-write lock objects. 2004-07-01 18:27:36 +00:00
scw 0f10094026 Cast integer to pointer types via intptr_t.
Problem reported by Havard Eidnes while building evbsh5.
2004-06-11 07:28:05 +00:00
martin 7347018381 Ouch. Lint didn't like the last change on sparc64. The reason:
<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.
2004-06-10 18:06:19 +00:00
nathanw 41e871fe18 Avoid depending on declarations of struct reg and struct fpreg by using
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.
2004-06-10 01:38:29 +00:00
nathanw 568717a98d Get the td_thread_t * corresponding to nthread to mess with its lwp
data, rather than trying a nonsensical operation on a caddr_t from a
different address space.

Moral: test-compile in the same tree you're working in.
2004-06-03 15:22:08 +00:00
nathanw 387534cc0a Update cached LWP values when suspending the running thread. 2004-06-03 00:31:28 +00:00
nathanw bff67c76fe Add an offset to the thread ID numbers, because GDB really doesn't
cope with "thread 0".
2004-06-03 00:20:24 +00:00
nathanw 9edc974b8c Add support for reporting and examining suspended threads. 2004-06-02 21:18:25 +00:00
nathanw 24ddb5f789 td_map_lwps(): there's always one lwp. This makes the call work before
the thread system has started.

Additionally, mark not-on-LWP threads explicitly, so that there's no
risk of using stale information.
2004-06-02 21:15:42 +00:00
nathanw 92733106a3 Add td_thr_suspend() and td_thr_resume(), to suspend and resume
threads from the context of a debugger.
2004-06-02 21:13:42 +00:00
cl e9598cefd0 Actually test pthread__dbg to check if another gdb is attached (and not
pthread__tsd_destructors whose address happens to be in addr).
2004-02-21 20:48:11 +00:00
nathanw 26ed28badd td_thr_getregs(): Return errors when the requested bit of register state
isn't in the ucontext.
td_thr_getregs(), td_thr_setregs(): Use "xreg" macros when defined.
2004-02-11 21:07:18 +00:00
nathanw 193a376007 Test pt_blockgen against pt_unblockgen, not against itself, to check
for blocked-in-kernel situations.
2004-02-03 20:26:16 +00:00
nathanw 0a6afcc70d Rename pt_stacksize, pt_stacksize_lg, and pt_stackmask to pthread_*. External
symbols can't start with pt_, as that is in the application namespace.
2004-02-02 20:36:18 +00:00
nathanw b2f27acb27 Do all the symbol lookups at td_open() time and cache them in the td_proc_st.
Make the stacksize lookups and data part of td_proc_st rather than global state.
2004-02-02 20:08:27 +00:00
cl 36ee225d9a catch up with block/unblock changes in libpthread 2003-12-31 16:46:34 +00:00
cl 828439fb74 Add td__getstacksize() to support variable stack sizes. 2003-11-27 16:32:09 +00:00
lukem f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
christos d217c83d02 add a cast to make lint happy. 2003-09-11 21:57:32 +00:00
nathanw d5ef0c1f39 Adapt to structure name changes. 2003-07-17 21:14:49 +00:00
nathanw 6a0c6dddb7 Preferentially read context pointer from pt_trapuc. 2003-06-26 21:51:59 +00:00
nathanw 64b72cb09f A couple of READ calls in td_sync_info() were reading into a
pthread_spin_t variable (4 bytes) but telling read that they were
reading sizeof(struct pthread_spinlock_st) (12 bytes). This led to
overwriting other things on the stack, like the return address. Oops.

Fix by changing READ call here (and elsewhere, for future safety) to:
  READ(,, &variable, sizeof(variable))
instead of
  READ(,, &variable, sizeof(type)).

Fixes a crash in gdb when running "thread examine all" reported by
Bill Studenmund.
2003-04-05 01:39:13 +00:00
lukem f043c0fb57 add __RCSID() 2003-03-08 08:03:34 +00:00