The NetBSD Project

CVS log for src/lib/libpthread/pthread.c

[BACK] Up to [cvs.NetBSD.org] / src / lib / libpthread

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.147.8.4 / (download) - annotate - [select for diffs], Sat Dec 9 13:36:03 2023 UTC (3 months, 2 weeks ago) by martin
Branch: netbsd-8
Changes since 1.147.8.3: +6 -3 lines
Diff to previous 1.147.8.3 (colored) to branchpoint 1.147 (colored) next main 1.148 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1924):

	tests/lib/libpthread/Makefile: revision 1.16
	lib/libpthread/pthread.c: revision 1.184
	distrib/sets/lists/debug/mi: revision 1.424
	distrib/sets/lists/tests/mi: revision 1.1297
	tests/lib/libpthread/t_stack.c: revision 1.1
	tests/lib/libpthread/t_stack.c: revision 1.2
	tests/lib/libpthread/t_stack.c: revision 1.3
	tests/lib/libpthread/t_stack.c: revision 1.4
	tests/lib/libpthread/t_stack.c: revision 1.5
	tests/lib/libpthread/t_stack.c: revision 1.6

pthread: Add tests for pthread user stack allocation.
PR lib/57721

libpthread/t_stack: Make this more robust to the guard size bug.
Make sure to allocate enough space for the thread's stack for a guard
even though there shouldn't be one, so that when we run the thread,
it doesn't start with the stack pointer pointing into someone else's
allocation (like malloc) causing stack frames to trash another data
structure -- or causing the user of that data structure to trash the
stack frames.
PR lib/57721

libpthread/t_stack: Omit needless cast in previous.
Arose from an earlier draft of the change.
PR lib/57721

libpthread/t_stack: Appease gcc12 maybe-uninitialized warning.
The jmp_buf is not, in fact, uninitialized at the point of use, but
it doesn't hurt to narrow the scope a bit to between when the jmp_buf
is initialized by setjmp, and when the signal handler might be called
after sigaction.
Noted by prlw1.
PR lib/57721

libpthread/t_stack: Fix format string for size_t.
Tested this on i386 since that had been crashing before, but i386
doesn't see %zu for unsigned int as a problem.
PR lib/57721

pthread: Don't adjust user-allocated stack addresses by guardsize.
PR lib/57721

Revision 1.153.2.3 / (download) - annotate - [select for diffs], Sat Dec 9 13:24:24 2023 UTC (3 months, 2 weeks ago) by martin
Branch: netbsd-9
Changes since 1.153.2.2: +6 -3 lines
Diff to previous 1.153.2.2 (colored) to branchpoint 1.153 (colored) next main 1.154 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1775):

	tests/lib/libpthread/Makefile: revision 1.16
	lib/libpthread/pthread.c: revision 1.184
	distrib/sets/lists/debug/mi: revision 1.424
	distrib/sets/lists/tests/mi: revision 1.1297
	tests/lib/libpthread/t_stack.c: revision 1.1
	tests/lib/libpthread/t_stack.c: revision 1.2
	tests/lib/libpthread/t_stack.c: revision 1.3
	tests/lib/libpthread/t_stack.c: revision 1.4
	tests/lib/libpthread/t_stack.c: revision 1.5
	tests/lib/libpthread/t_stack.c: revision 1.6

pthread: Add tests for pthread user stack allocation.
PR lib/57721

libpthread/t_stack: Make this more robust to the guard size bug.
Make sure to allocate enough space for the thread's stack for a guard
even though there shouldn't be one, so that when we run the thread,
it doesn't start with the stack pointer pointing into someone else's
allocation (like malloc) causing stack frames to trash another data
structure -- or causing the user of that data structure to trash the
stack frames.
PR lib/57721

libpthread/t_stack: Omit needless cast in previous.
Arose from an earlier draft of the change.
PR lib/57721

libpthread/t_stack: Appease gcc12 maybe-uninitialized warning.
The jmp_buf is not, in fact, uninitialized at the point of use, but
it doesn't hurt to narrow the scope a bit to between when the jmp_buf
is initialized by setjmp, and when the signal handler might be called
after sigaction.
Noted by prlw1.
PR lib/57721

libpthread/t_stack: Fix format string for size_t.
Tested this on i386 since that had been crashing before, but i386
doesn't see %zu for unsigned int as a problem.
PR lib/57721

pthread: Don't adjust user-allocated stack addresses by guardsize.
PR lib/57721

Revision 1.181.2.1 / (download) - annotate - [select for diffs], Tue Nov 28 13:17:11 2023 UTC (4 months ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2
Changes since 1.181: +6 -3 lines
Diff to previous 1.181 (colored) next main 1.182 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #478):

	tests/lib/libpthread/Makefile: revision 1.16
	lib/libpthread/pthread.c: revision 1.184
	distrib/sets/lists/debug/mi: revision 1.424
	distrib/sets/lists/tests/mi: revision 1.1297
	tests/lib/libpthread/t_stack.c: revision 1.1
	tests/lib/libpthread/t_stack.c: revision 1.2
	tests/lib/libpthread/t_stack.c: revision 1.3
	tests/lib/libpthread/t_stack.c: revision 1.4
	tests/lib/libpthread/t_stack.c: revision 1.5
	tests/lib/libpthread/t_stack.c: revision 1.6

pthread: Add tests for pthread user stack allocation.
PR lib/57721

libpthread/t_stack: Make this more robust to the guard size bug.
Make sure to allocate enough space for the thread's stack for a guard
even though there shouldn't be one, so that when we run the thread,
it doesn't start with the stack pointer pointing into someone else's
allocation (like malloc) causing stack frames to trash another data
structure -- or causing the user of that data structure to trash the
stack frames.
PR lib/57721

libpthread/t_stack: Omit needless cast in previous.
Arose from an earlier draft of the change.
PR lib/57721

libpthread/t_stack: Appease gcc12 maybe-uninitialized warning.
The jmp_buf is not, in fact, uninitialized at the point of use, but
it doesn't hurt to narrow the scope a bit to between when the jmp_buf
is initialized by setjmp, and when the signal handler might be called
after sigaction.
Noted by prlw1.
PR lib/57721

libpthread/t_stack: Fix format string for size_t.
Tested this on i386 since that had been crashing before, but i386
doesn't see %zu for unsigned int as a problem.
PR lib/57721

pthread: Don't adjust user-allocated stack addresses by guardsize.
PR lib/57721

Revision 1.184 / (download) - annotate - [select for diffs], Tue Nov 28 02:54:33 2023 UTC (4 months ago) by riastradh
Branch: MAIN
CVS Tags: HEAD
Changes since 1.183: +6 -3 lines
Diff to previous 1.183 (colored) to selected 1.88 (colored)

pthread: Don't adjust user-allocated stack addresses by guardsize.

PR lib/57721

XXX pullup-10
XXX pullup-9
XXX pullup-8

Revision 1.183 / (download) - annotate - [select for diffs], Thu Sep 7 19:59:20 2023 UTC (6 months, 3 weeks ago) by ad
Branch: MAIN
Changes since 1.182: +3 -3 lines
Diff to previous 1.182 (colored) to selected 1.88 (colored)

raise() has understood threads for a long time, don't reimplment it.

Revision 1.182 / (download) - annotate - [select for diffs], Fri Mar 24 14:18:18 2023 UTC (12 months ago) by joerg
Branch: MAIN
Changes since 1.181: +5 -5 lines
Diff to previous 1.181 (colored) to selected 1.88 (colored)

Use snprintf_ss in pthread__assertfunc and update comment in
pthread__errorfunc. snprintf can use locks in some code paths and we
only care about the restricted subset here.

Revision 1.153.2.2 / (download) - annotate - [select for diffs], Mon Aug 8 17:16:53 2022 UTC (19 months, 2 weeks ago) by martin
Branch: netbsd-9
Changes since 1.153.2.1: +30 -2 lines
Diff to previous 1.153.2.1 (colored) to branchpoint 1.153 (colored) to selected 1.88 (colored)

Apply patch, requested by riastradh in ticket #1498:

	lib/libpthread/pthread.c		1.181 (via patch)

libpthread(3): Fix a marvellous interaction with rtld.

Patch from chs@.  Comment explaining the story by me.  This patch may
not be optimal -- maybe it would be better in pthread__init, or
better for rtld to call _lwp_unpark after _lwp_park in the contened
case -- but we've tested this version and it's annoying to reproduce,
so let's take this version and worry about testing improvements
later.

Revision 1.181 / (download) - annotate - [select for diffs], Tue May 31 14:23:39 2022 UTC (21 months, 4 weeks ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RC1
Branch point for: netbsd-10
Changes since 1.180: +30 -2 lines
Diff to previous 1.180 (colored) to selected 1.88 (colored)

libpthread(3): Fix a marvellous interaction with rtld.

Patch from chs@.  Comment explaining the story by me.  This patch may
not be optimal -- maybe it would be better in pthread__init, or
better for rtld to call _lwp_unpark after _lwp_park in the contened
case -- but we've tested this version and it's annoying to reproduce,
so let's take this version and worry about testing improvements
later.

Revision 1.180 / (download) - annotate - [select for diffs], Sat Feb 12 14:59:32 2022 UTC (2 years, 1 month ago) by riastradh
Branch: MAIN
Changes since 1.179: +5 -2 lines
Diff to previous 1.179 (colored) to selected 1.88 (colored)

libpthread: Move namespacing include to top of .c files.

Stuff like libc's namespace.h, or atomic_op_namespace.h, which does
namespacing tricks like `#define atomic_cas_uint _atomic_cas_uint',
has to go at the top of each .c file.  If it goes in the middle, it
might be too late to affect the declarations, and result in compile
errors.

I tripped over this by including <sys/atomic.h> in mips
<machine/lock.h>.

(Maybe we should create a new pthread_namespace.h file for the
purpose, but this'll do for now.)

Revision 1.179 / (download) - annotate - [select for diffs], Tue Apr 13 00:31:54 2021 UTC (2 years, 11 months ago) by mrg
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.178: +4 -3 lines
Diff to previous 1.178 (colored) to selected 1.88 (colored)

fake-use alloca()'s return value to quieten -Werror=unused-result

Revision 1.178 / (download) - annotate - [select for diffs], Wed Jul 22 01:24:39 2020 UTC (3 years, 8 months ago) by msaitoh
Branch: MAIN
Changes since 1.177: +3 -3 lines
Diff to previous 1.177 (colored) to selected 1.88 (colored)

s/reseting/resetting/

Revision 1.177 / (download) - annotate - [select for diffs], Sun Jun 14 21:31:11 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.176: +2 -3 lines
Diff to previous 1.176 (colored) to selected 1.88 (colored)

Don't need to ignore ESRCH from _lwp_park() any more.

Revision 1.176 / (download) - annotate - [select for diffs], Thu Jun 11 18:42:02 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.175: +4 -6 lines
Diff to previous 1.175 (colored) to selected 1.88 (colored)

Drop self->pt_lock before clearing TSD / malloc TSD.

Revision 1.175 / (download) - annotate - [select for diffs], Wed Jun 10 22:45:15 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.174: +16 -71 lines
Diff to previous 1.174 (colored) to selected 1.88 (colored)

- Make pthread_condvar and pthread_mutex work on the stack rather than in
  pthread_t, so there's less chance of bad things happening if someone calls
  (for example) pthread_cond_broadcast() from a signal handler.

- Remove all the deferred waiter handling except for the one case that really
  matters which is transferring waiters from condvar -> mutex on wakeup, and
  do that by splicing the condvar's waiters onto the mutex.

- Remove the mutex waiters bit as it's another complication that's not
  strictly needed.

Revision 1.174 / (download) - annotate - [select for diffs], Thu Jun 4 00:45:32 2020 UTC (3 years, 9 months ago) by joerg
Branch: MAIN
Changes since 1.173: +9 -2 lines
Diff to previous 1.173 (colored) to selected 1.88 (colored)

If _malloc_thread_cleanup is implement, call it from libpthread.
Provide the hook from modern jemalloc to avoid using TSD for the thread
destruction cleanup as it can result in reentrancy crashes if fork is
called from a thread that never called malloc as it will result in a
late malloc from the pre-fork synchronisation handler.

Revision 1.173 / (download) - annotate - [select for diffs], Wed Jun 3 22:10:24 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.172: +11 -7 lines
Diff to previous 1.172 (colored) to selected 1.88 (colored)

Deal with a couple of problems with threads being awoken early due to
timeouts or cancellation where:

- The restarting thread calls _lwp_exit() before another thread gets around
  to waking it with _lwp_unpark(), leading to ESRCH (observed by joerg@).
  (I may have removed a similar check mistakenly over the weekend.)

- The restarting thread considers itself gone off the sleep queue but
  at the same time another thread is part way through waking it, and hasn't
  fully completed that operation yet by setting thread->pt_mutexwait = 0.
  I think that could have potentially lead to the list of waiters getting
  messed up given the right circumstances.

Revision 1.172 / (download) - annotate - [select for diffs], Tue Jun 2 00:29:53 2020 UTC (3 years, 9 months ago) by joerg
Branch: MAIN
Changes since 1.171: +14 -8 lines
Diff to previous 1.171 (colored) to selected 1.88 (colored)

Pass down errno when calling pthread__errorfunc after a system call.
Allow format arguments for that reason and use (v)snprintf_ss in
pthread_errorfunc to avoid race conditions and the like.

Revision 1.171 / (download) - annotate - [select for diffs], Mon Jun 1 11:44:59 2020 UTC (3 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.170: +39 -87 lines
Diff to previous 1.170 (colored) to selected 1.88 (colored)

In the interests of reliability simplify waiter handling more and redo
condvars to manage the list of waiters with atomic ops.

Revision 1.170 / (download) - annotate - [select for diffs], Sat May 16 22:53:37 2020 UTC (3 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.169: +68 -39 lines
Diff to previous 1.169 (colored) to selected 1.88 (colored)

- Try to eliminate a hang in "parked" I've been seeing while stress testing.
  Centralise wakeup of deferred waiters in pthread__clear_waiters() and use
  throughout libpthread.  Make fewer assumptions.  Be more conservative in
  pthread_mutex when dealing with pending waiters.

- Remove the "hint" argument everywhere since the kernel doesn't use it any
  more.

Revision 1.169 / (download) - annotate - [select for diffs], Fri May 15 14:30:23 2020 UTC (3 years, 10 months ago) by joerg
Branch: MAIN
Changes since 1.168: +29 -16 lines
Diff to previous 1.168 (colored) to selected 1.88 (colored)

Lock/unlock/reinit pthread__deadqueue_lock over fork.

Revision 1.151.4.3 / (download) - annotate - [select for diffs], Tue Apr 21 18:42:00 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.151.4.2: +2 -41 lines
Diff to previous 1.151.4.2 (colored) to branchpoint 1.151 (colored) next main 1.152 (colored) to selected 1.88 (colored)

Sync with HEAD

Revision 1.168 / (download) - annotate - [select for diffs], Tue Apr 14 23:35:07 2020 UTC (3 years, 11 months ago) by joerg
Branch: MAIN
CVS Tags: phil-wifi-20200421
Changes since 1.167: +4 -43 lines
Diff to previous 1.167 (colored) to selected 1.88 (colored)

Drop most of the logic associated with pthread__started.

The pthread_cond logic is a questionable optimisation at best and the
post-fork logic is plainly broken.

Revision 1.151.4.2 / (download) - annotate - [select for diffs], Wed Apr 8 14:07:15 2020 UTC (3 years, 11 months ago) by martin
Branch: phil-wifi
Changes since 1.151.4.1: +100 -109 lines
Diff to previous 1.151.4.1 (colored) to branchpoint 1.151 (colored) to selected 1.88 (colored)

Merge changes from current as of 20200406

Revision 1.167 / (download) - annotate - [select for diffs], Sun Feb 16 17:45:11 2020 UTC (4 years, 1 month ago) by kamil
Branch: MAIN
CVS Tags: phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp
Changes since 1.166: +5 -19 lines
Diff to previous 1.166 (colored) to selected 1.88 (colored)

Revert "Enhance the pthread(3) + malloc(3) init model"

It is reported to hand on aarch64 with gzip.

Revision 1.166 / (download) - annotate - [select for diffs], Sun Feb 16 17:14:31 2020 UTC (4 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.165: +11 -5 lines
Diff to previous 1.165 (colored) to selected 1.88 (colored)

Set __isthreaded before bootstrapping malloc(3)

jemalloc depends on the __isthreaded dynamic state logic.

Reported by <wiz> for mpv and by <tih> for gzip.

Revision 1.165 / (download) - annotate - [select for diffs], Sat Feb 15 23:59:30 2020 UTC (4 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.164: +12 -4 lines
Diff to previous 1.164 (colored) to selected 1.88 (colored)

Enhance the pthread(3) + malloc(3) init model

Separate the pthread_atfork(3) call from pthread_tsd_init()
and move it into a distinct function.

Call inside pthread__init() late TSD initialization route, just after
"pthread_atfork(NULL, NULL, pthread__fork_callback);".

Document that malloc(3) initialization is now controlled again and called
during the first pthread_atfork(3) call.

Remove #if 0 code from pthread_mutex.c as we no longer initialize malloc
prematurely.

Revision 1.164 / (download) - annotate - [select for diffs], Sat Feb 8 17:06:03 2020 UTC (4 years, 1 month ago) by kamil
Branch: MAIN
Changes since 1.163: +6 -6 lines
Diff to previous 1.163 (colored) to selected 1.88 (colored)

Change the behavior of pthread_equal()

On error when not aborting, do not return EINVAL as it has a side effect
of being interpreted as matching threads. For invalid threads return
unmatched.

Check pthreads for NULL, before accessing pt_magic field. This avoids
faults on comparision with a NULL pointer.

This behavior is in the scope of UB, but should be easier to deal with
buggy software.

Revision 1.163 / (download) - annotate - [select for diffs], Wed Feb 5 14:56:04 2020 UTC (4 years, 1 month ago) by ryoon
Branch: MAIN
Changes since 1.162: +10 -10 lines
Diff to previous 1.162 (colored) to selected 1.88 (colored)

Remove trailing whiteapaces and tab

Revision 1.162 / (download) - annotate - [select for diffs], Wed Jan 29 17:11:57 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.161: +4 -9 lines
Diff to previous 1.161 (colored) to selected 1.88 (colored)

- pthread_join(): remove temporary hack now kernel returns correct errno.

- kill(getpid(), SIGABRT)  ->  _lwp_kill(_lwp_self(), SIGABRT)

Revision 1.161 / (download) - annotate - [select for diffs], Wed Jan 29 16:03:44 2020 UTC (4 years, 2 months ago) by kamil
Branch: MAIN
Changes since 1.160: +30 -14 lines
Diff to previous 1.160 (colored) to selected 1.88 (colored)

Chack thread->pt_magic with PT_MAGIC promptly

Rearrange some checks to avoid verifying pthread_t after using it.

Revision 1.160 / (download) - annotate - [select for diffs], Wed Jan 29 15:31:14 2020 UTC (4 years, 2 months ago) by kamil
Branch: MAIN
Changes since 1.159: +3 -4 lines
Diff to previous 1.159 (colored) to selected 1.88 (colored)

Revert previous

Two assignments are correct.

Revision 1.159 / (download) - annotate - [select for diffs], Wed Jan 29 15:15:00 2020 UTC (4 years, 2 months ago) by kamil
Branch: MAIN
Changes since 1.158: +4 -3 lines
Diff to previous 1.158 (colored) to selected 1.88 (colored)

Do not set stackbase2 twice for !__MACHINE_STACK_GROWS_UP

Revision 1.158 / (download) - annotate - [select for diffs], Tue Jan 28 09:23:15 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.157: +6 -2 lines
Diff to previous 1.157 (colored) to selected 1.88 (colored)

pthread_join(): add a temporary hack to make lib/libpthread/t_detach pass.
The correct fix is to do this in kernel (I have that change, but it's part
of the wider change to index LWPs in a tree).

Revision 1.157 / (download) - annotate - [select for diffs], Mon Jan 27 20:50:05 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.156: +37 -71 lines
Diff to previous 1.156 (colored) to selected 1.88 (colored)

pthread_detach(), pthread_join():  go back to using _lwp_detach() and
_lwp_wait(), rather than doing it all in userspace.  There's less to go
wrong.  Doesn't seem to be a performance penalty.

Revision 1.153.2.1 / (download) - annotate - [select for diffs], Sun Jan 26 10:55:16 2020 UTC (4 years, 2 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2
Changes since 1.153: +2 -11 lines
Diff to previous 1.153 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by ad in ticket #647):

	lib/libpthread/pthread_rwlock.c: revision 1.37 (patch)
	lib/libpthread/pthread_misc.c: revision 1.16
	lib/libpthread/pthread.c: revision 1.154
	lib/libpthread/pthread_int.h: revision 1.98
	lib/libpthread/pthread_cond.c: revision 1.66
	lib/libpthread/pthread_mutex.c: revision 1.66

Rip out some very ambitious optimisations around pthread_mutex that are
don't buy much.  This stuff is hard enough to get right in the kernel let
alone userspace, and I don't trust that it's right.

Revision 1.156 / (download) - annotate - [select for diffs], Sat Jan 25 18:01:28 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.155: +25 -3 lines
Diff to previous 1.155 (colored) to selected 1.88 (colored)

pthread_exit(): it looks there there is at least one path through which
a thread can exit with waiters still hanging off it (cancellation when
waiting on a condvar) so deal with all/any crappy failure like that and
make sure there are never any waiters left before exiting.  Maybe of help
for:

PR: bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2

Revision 1.155 / (download) - annotate - [select for diffs], Sat Jan 25 15:41:52 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.154: +4 -7 lines
Diff to previous 1.154 (colored) to selected 1.88 (colored)

- Fix a race between the kernel and libpthread, where a new thread can start
  life without its self->pt_lid being filled in.

- Fix an error path in _lwp_create().  If the new LID can't be copied out,
  then get rid of the new LWP (i.e. either succeed or fail, not both).

- Mark l_dopreempt and l_nopreempt volatile in struct lwp.

Revision 1.154 / (download) - annotate - [select for diffs], Mon Jan 13 18:22:56 2020 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.153: +2 -11 lines
Diff to previous 1.153 (colored) to selected 1.88 (colored)

Rip out some very ambitious optimisations around pthread_mutex that are
don't buy much.  This stuff is hard enough to get right in the kernel let
alone userspace, and I don't trust that it's right.

Revision 1.151.4.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:05:26 2019 UTC (4 years, 9 months ago) by christos
Branch: phil-wifi
Changes since 1.151: +3 -3 lines
Diff to previous 1.151 (colored) to selected 1.88 (colored)

Sync with HEAD

Revision 1.153 / (download) - annotate - [select for diffs], Tue Mar 5 01:35:52 2019 UTC (5 years ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-0-RC1
Branch point for: netbsd-9
Changes since 1.152: +3 -2 lines
Diff to previous 1.152 (colored) to selected 1.88 (colored)

Transfer all the keys that were created in the libc stub implementation
to the pthread tsd implementation when the main thread is created.
This corrects a problem where a process created keys before libpthread
was loaded (either from the libc constructor or because libpthread
was dlopened later). This fixes a problem with jemalloc which creates
keys in the constructor.

Revision 1.151.2.1 / (download) - annotate - [select for diffs], Thu Sep 6 06:55:20 2018 UTC (5 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.151: +2 -3 lines
Diff to previous 1.151 (colored) next main 1.152 (colored) to selected 1.88 (colored)

Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.152 / (download) - annotate - [select for diffs], Sun Aug 19 02:10:42 2018 UTC (5 years, 7 months ago) by kamil
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906
Changes since 1.151: +2 -3 lines
Diff to previous 1.151 (colored) to selected 1.88 (colored)

Drop a duplicate instruction line

No functional change intended.

Revision 1.151 / (download) - annotate - [select for diffs], Fri Dec 8 09:24:31 2017 UTC (6 years, 3 months ago) by kre
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-base, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: phil-wifi, pgoyette-compat
Changes since 1.150: +4 -4 lines
Diff to previous 1.150 (colored) to selected 1.88 (colored)


Deal with more lwp_park() timestamp unconsting

Revision 1.147.8.3 / (download) - annotate - [select for diffs], Thu Aug 31 08:32:39 2017 UTC (6 years, 6 months ago) by bouyer
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.147.8.2: +31 -6 lines
Diff to previous 1.147.8.2 (colored) to branchpoint 1.147 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by joerg in ticket #234):
	sys/arch/amd64/include/vmparam.h: revision 1.43
	sys/kern/exec_subr.c: revision 1.79
	lib/libpthread/pthread_int.h: revision 1.94
	sys/arch/mips/include/vmparam.h: revision 1.58
	sys/arch/mips/include/vmparam.h: revision 1.59
	lib/libpthread/TODO: revision 1.19
	sys/arch/powerpc/include/vmparam.h: revision 1.20
	sys/arch/riscv/include/vmparam.h: revision 1.2
	sys/arch/riscv/include/vmparam.h: revision 1.3
	sys/arch/i386/include/vmparam.h: revision 1.85
	tests/lib/libpthread/t_join.c: revision 1.9
	sys/uvm/uvm_meter.c: revision 1.66
	sys/uvm/uvm_param.h: revision 1.36
	sys/kern/exec_subr.c: revision 1.80
	sys/uvm/uvm_param.h: revision 1.37
	sys/kern/exec_subr.c: revision 1.81
	sys/kern/exec_subr.c: revision 1.82
	lib/libpthread/pthread_attr_getguardsize.3: revision 1.4
	lib/libpthread/pthread.c: revision 1.148
	lib/libpthread/pthread_attr.c: revision 1.17
	sys/arch/amd64/include/vmparam.h: revision 1.42
Always include a 1MB guard area beyond the end of stack. While ASLR will
normally create a guard area as well, this provides a deterministic area
for all binaries.
Mitigates the rest of CVE-2017-1000374 and CVE-2017-1000375 from
Qualys.
Revert for the moment, creates problems on i386.
Recommit exec_subr.c revision 1.79:
  Always include a 1MB guard area beyond the end of stack. While ASLR will
  normally create a guard area as well, this provides a deterministic area
  for all binaries.
  Mitigates the rest of CVE-2017-1000374 and CVE-2017-1000375 from
  Qualys.
Additionally, change VM_DEFAULT_ADDRESS_TOPDOWN to include
user_stack_guard_size in the size reservation.
Update VM_DEFAULT_ADDRESS32_TOPDOWN to include guard area.
Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.

Revision 1.147.8.2 / (download) - annotate - [select for diffs], Thu Aug 31 08:24:43 2017 UTC (6 years, 6 months ago) by bouyer
Branch: netbsd-8
Changes since 1.147.8.1: +5 -2 lines
Diff to previous 1.147.8.1 (colored) to branchpoint 1.147 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by joerg in ticket #232):
	lib/libpthread/pthread.c: revision 1.149
Do not look at environmental variables for suid/guid binaries.

Revision 1.147.8.1 / (download) - annotate - [select for diffs], Tue Aug 29 09:43:16 2017 UTC (6 years, 7 months ago) by bouyer
Branch: netbsd-8
Changes since 1.147: +7 -2 lines
Diff to previous 1.147 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by joerg in ticket #127):
	tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.1
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h: revision 1.17
	lib/libc/stdlib/atexit.h: file removal
	lib/libc/stdlib/exit.c: revision 1.16
	external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h: revision 1.8
	lib/libc/stdlib/exit.c: revision 1.17
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h: revision 1.14
	distrib/sets/lists/debug/shl.mi: revision 1.178
	external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h: revision 1.21
	distrib/sets/lists/debug/shl.mi: revision 1.179
	distrib/sets/lists/debug/mi: revision 1.219
	lib/libpthread/pthread.c: revision 1.150
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h: revision 1.14
	libexec/ld.elf_so/symbols.map: revision 1.2
	include/dlfcn.h: revision 1.25
	external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h: revision 1.23
	external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h: revision 1.18
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/ia64/c++config.h: revision 1.5
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h: revision 1.17
	distrib/sets/lists/tests/mi: revision 1.755
	external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h: revision 1.20
	external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h: revision 1.20
	lib/libc/dlfcn/dlfcn_elf.c: revision 1.14
	tests/libexec/ld.elf_so/t_thread_local_dtor.sh: revision 1.1
	tests/lib/libpthread/t_thread_local_dtor.sh: revision 1.1
	lib/libc/stdlib/Makefile.inc: revision 1.93
	lib/libc/include/atexit.h: revision 1.1
	lib/libc/include/atexit.h: revision 1.2
	external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h: revision 1.14
	distrib/sets/lists/debug/shl.mi: revision 1.180
	external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h: revision 1.14
	lib/libc/stdlib/cxa_thread_atexit.c: revision 1.1
	tests/libexec/ld.elf_so/helper_dso3/h_helper_dso3.cpp: revision 1.1
	tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.1
	external/gpl3/gcc/lib/libstdc++-v3/arch/riscv64/c++config.h: revision 1.5
	libexec/ld.elf_so/rtld.c: revision 1.185
	external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h: revision 1.19
	external/gpl3/gcc/lib/libstdc++-v3/arch/riscv32/c++config.h: revision 1.5
	external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h: revision 1.15
	external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h: revision 1.21
	external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h: revision 1.12
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h: revision 1.14
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h: revision 1.15
	external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h: revision 1.19
	tests/libexec/ld.elf_so/Makefile: revision 1.9
	external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h: revision 1.20
	external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h: revision 1.14
	tests/lib/libpthread/h_thread_local_dtor.cpp: revision 1.1
	distrib/sets/lists/tests/shl.mi: revision 1.11
	tests/lib/libpthread/Makefile: revision 1.13
	libexec/ld.elf_so/rtld.h: revision 1.129
	external/gpl3/gcc/lib/libstdc++-v3/arch/or1k/c++config.h: revision 1.6
Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.
If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.
Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
Fix filename of new debug file
Add misising DEBUGLIB file
Avoid common declaration.
Drop TLS variant checks, emutls is enough for VAX and Sun2.

Revision 1.150 / (download) - annotate - [select for diffs], Tue Jul 11 15:21:35 2017 UTC (6 years, 8 months ago) by joerg
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.149: +7 -2 lines
Diff to previous 1.149 (colored) to selected 1.88 (colored)

Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.

If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.

Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.

Revision 1.149 / (download) - annotate - [select for diffs], Sun Jul 2 17:13:07 2017 UTC (6 years, 8 months ago) by joerg
Branch: MAIN
Changes since 1.148: +5 -2 lines
Diff to previous 1.148 (colored) to selected 1.88 (colored)

Do not look at environmental variables for suid/guid binaries.

Revision 1.148 / (download) - annotate - [select for diffs], Sun Jul 2 16:41:32 2017 UTC (6 years, 8 months ago) by joerg
Branch: MAIN
Changes since 1.147: +31 -6 lines
Diff to previous 1.147 (colored) to selected 1.88 (colored)

Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.

Revision 1.144.4.1 / (download) - annotate - [select for diffs], Tue Nov 24 17:37:16 2015 UTC (8 years, 4 months ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1
Changes since 1.144: +33 -21 lines
Diff to previous 1.144 (colored) next main 1.145 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by manu in ticket #829):
	lib/libpthread_dbg/pthread_dbg.c: revision 1.43 (via patch)
	lib/libpthread/pthread_int.h: revision 1.91-1.92 (via patch)
	lib/libc/stdlib/jemalloc.c: revision 1.37-1.38
	lib/libpthread/pthread_tsd.c: revision 1.12-1.14 (via patch)
	include/limits.h: revision 1.34 (via patch)
	lib/libpthread/pthread.c: revision 1.146-1.147 (via patch)
	lib/libpthread/pthread_key_create.3: revision 1.7 (via patch)

libpthread:

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.

Fix previous: Can't use calloc/malloc before we complete initialization
of the thread library, because malloc uses pthread_foo_specific, and it will
end up initializing itself incorrectly.

Thanks rump for not letting us use even mmap during initialization.

libc/jemalloc:

Fix non _REENTRANT build.
Defer using pthread keys until we are threaded.
From Christos, fixes PR port-arm/50087 by allowing malloc calls prior
to libpthread initialization.

Revision 1.147 / (download) - annotate - [select for diffs], Fri May 29 16:05:13 2015 UTC (8 years, 10 months ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, netbsd-8-base, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: netbsd-8
Changes since 1.146: +5 -10 lines
Diff to previous 1.146 (colored) to selected 1.88 (colored)

Fix previous: Can't use calloc/malloc before we complete initialization
of the thread library, because malloc uses pthread_foo_specific, and it will
end up initializing itself incorrectly.

Revision 1.146 / (download) - annotate - [select for diffs], Fri May 29 07:37:31 2015 UTC (8 years, 10 months ago) by manu
Branch: MAIN
Changes since 1.145: +39 -22 lines
Diff to previous 1.145 (colored) to selected 1.88 (colored)

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.

Revision 1.145 / (download) - annotate - [select for diffs], Tue Dec 16 20:05:54 2014 UTC (9 years, 3 months ago) by pooka
Branch: MAIN
Changes since 1.144: +10 -15 lines
Diff to previous 1.144 (colored) to selected 1.88 (colored)

Allow for arbitrary MI scheduler implementations.

A concrete result is enabling unpatched libpthread to run on the
rumprun stacks (e.g. Xen and bare metal) with a non-NetBSD scheduler.
Those schedulers hook into the existing _lwp_frobnitz() NetBSD syscall
interfaces (well, "syscall" interfaces in that scenario ;)

More specifically about the change itself:

1) instead of calling _lwp_makecontext() followed by _lwp_create()
   and passing the entry point in ucontext_t (MD) through the calls, roll
   the calls into pthread__makelwp() and allow alternate implementations
   for that MI interface.

2) allow compile-time overriding of __lwp_gettcb_fast() or
   __lwp_getprivate_fast, which are inline and leak MD scheduler/thread
   details into libpthread


Additionally, two small nits:

I)  define LIB=pthread before including mk.conf so that it's possible
    to test for LIB==pthread in mk.conf

II) make it possible to leave out pthread_cancelstub.c.  This is required
    by the current implementation of rumprun-posix (i.e. rumprun on
    POSIX hosts) due to symbol collisions.  It needs to be fixed properly
    some day, but for now allows an almost-correct libpthread to run.
    I am sure @justin will be happy to explain the details ;)


no change to NetBSD
tested: anita+atf

Revision 1.137.2.4 / (download) - annotate - [select for diffs], Wed Aug 20 00:02:20 2014 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.137.2.3: +2 -1 lines
Diff to previous 1.137.2.3 (colored) to branchpoint 1.137 (colored) next main 1.138 (colored) to selected 1.88 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.125.2.6 / (download) - annotate - [select for diffs], Thu May 22 11:36:59 2014 UTC (9 years, 10 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.125.2.5: +33 -3 lines
Diff to previous 1.125.2.5 (colored) to branchpoint 1.125 (colored) next main 1.126 (colored) to selected 1.88 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.144 / (download) - annotate - [select for diffs], Fri Jan 31 20:44:01 2014 UTC (10 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, netbsd-7-base, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Branch point for: netbsd-7
Changes since 1.143: +4 -3 lines
Diff to previous 1.143 (colored) to selected 1.88 (colored)

remove compatibility code for handling CLOCK_MONOTONIC and handle it in the
syscall directly.

Revision 1.106.2.5 / (download) - annotate - [select for diffs], Sun Oct 20 13:58:32 2013 UTC (10 years, 5 months ago) by bouyer
Branch: netbsd-5
Changes since 1.106.2.4: +3 -2 lines
Diff to previous 1.106.2.4 (colored) to branchpoint 1.106 (colored) next main 1.107 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1881):
	lib/libpthread/pthread.c: revision 1.137 via patch
return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)

Revision 1.125.4.4 / (download) - annotate - [select for diffs], Thu Sep 26 02:03:09 2013 UTC (10 years, 6 months ago) by riz
Branch: netbsd-6
Changes since 1.125.4.3: +3 -2 lines
Diff to previous 1.125.4.3 (colored) to branchpoint 1.125 (colored) next main 1.126 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #959):
	lib/libpthread/pthread.c: revision 1.137
return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)

Revision 1.125.4.1.4.1 / (download) - annotate - [select for diffs], Thu Sep 26 02:02:07 2013 UTC (10 years, 6 months ago) by riz
Branch: netbsd-6-0
CVS Tags: netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE
Changes since 1.125.4.1: +3 -2 lines
Diff to previous 1.125.4.1 (colored) next main 1.125.4.2 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #959):
	lib/libpthread/pthread.c: revision 1.137
return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)

Revision 1.125.4.3.2.1 / (download) - annotate - [select for diffs], Thu Sep 26 02:01:14 2013 UTC (10 years, 6 months ago) by riz
Branch: netbsd-6-1
CVS Tags: netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE
Changes since 1.125.4.3: +3 -2 lines
Diff to previous 1.125.4.3 (colored) next main 1.125.4.4 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by riastradh in ticket #959):
	lib/libpthread/pthread.c: revision 1.137
return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)

Revision 1.137.2.3 / (download) - annotate - [select for diffs], Sun Jun 23 06:21:08 2013 UTC (10 years, 9 months ago) by tls
Branch: tls-maxphys
Changes since 1.137.2.2: +31 -2 lines
Diff to previous 1.137.2.2 (colored) to branchpoint 1.137 (colored) to selected 1.88 (colored)

resync from head

Revision 1.125.4.3 / (download) - annotate - [select for diffs], Mon Apr 29 01:50:19 2013 UTC (10 years, 11 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-1-RELEASE
Branch point for: netbsd-6-1
Changes since 1.125.4.2: +31 -2 lines
Diff to previous 1.125.4.2 (colored) to branchpoint 1.125 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by manu in ticket #869):
	lib/libpthread/pthread_rwlock.c: revision 1.33
	lib/libc/include/reentrant.h: revision 1.16
	lib/libpthread/pthread_cond.c: revision 1.59
	lib/libpthread/pthread_misc.c: revision 1.15
	lib/libc/thread-stub/thread-stub.c: revision 1.23
	lib/libpthread/pthread_cancelstub.c: revision 1.38
	lib/libpthread/pthread_specific.c: revision 1.26
	lib/libpthread/pthread_mutex.c: revision 1.56
	lib/libpthread/pthread_tsd.c: revision 1.11
	lib/libpthread/Makefile: revision 1.80
	lib/libpthread/pthread.c: revision 1.143
	lib/libpthread/pthread_int.h: revision 1.89
- Allow libpthread to be dlopened again, by providing libc stubs to
libpthread.
- Fail if the dlopened libpthread does pthread_create(). From manu@
- Discussed at length in the mailing lists; approved by core@
- This was chosen as the least intrusive patch that will provide
  the necessary functionality.
XXX: pullup to 6

Revision 1.143 / (download) - annotate - [select for diffs], Thu Mar 21 16:49:11 2013 UTC (11 years ago) by christos
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, agc-symver-base, agc-symver
Changes since 1.142: +31 -2 lines
Diff to previous 1.142 (colored) to selected 1.88 (colored)

- Allow libpthread to be dlopened again, by providing libc stubs to libpthread.
- Fail if the dlopened libpthread does pthread_create(). From manu@
- Discussed at length in the mailing lists; approved by core@
- This was chosen as the least intrusive patch that will provide
  the necessary functionality.
XXX: pullup to 6

Revision 1.137.2.2 / (download) - annotate - [select for diffs], Mon Feb 25 00:27:59 2013 UTC (11 years, 1 month ago) by tls
Branch: tls-maxphys
Changes since 1.137.2.1: +3 -2 lines
Diff to previous 1.137.2.1 (colored) to branchpoint 1.137 (colored) to selected 1.88 (colored)

resync with head

Revision 1.125.2.5 / (download) - annotate - [select for diffs], Wed Jan 23 00:05:26 2013 UTC (11 years, 2 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.125.2.4: +3 -2 lines
Diff to previous 1.125.2.4 (colored) to branchpoint 1.125 (colored) to selected 1.88 (colored)

sync with head

Revision 1.125.2.4 / (download) - annotate - [select for diffs], Wed Jan 16 05:32:26 2013 UTC (11 years, 2 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.125.2.3: +33 -32 lines
Diff to previous 1.125.2.3 (colored) to branchpoint 1.125 (colored) to selected 1.88 (colored)

sync with (a bit old) head

Revision 1.142 / (download) - annotate - [select for diffs], Tue Jan 1 18:42:39 2013 UTC (11 years, 2 months ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8
Changes since 1.141: +3 -2 lines
Diff to previous 1.141 (colored) to selected 1.88 (colored)

Don't rely on sys/lwp.h includeing sys/resource.h for us.

Revision 1.125.4.2 / (download) - annotate - [select for diffs], Mon Dec 3 19:07:26 2012 UTC (11 years, 3 months ago) by jdc
Branch: netbsd-6
CVS Tags: netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1
Changes since 1.125.4.1: +17 -7 lines
Diff to previous 1.125.4.1 (colored) to branchpoint 1.125 (colored) to selected 1.88 (colored)

Apply patch (requested by riastradh in ticket #735) to fix the unchecked
assumption that sizeof(struct __pthread_st) <= pagesize, as observed in
PR 47271.

Revision 1.137.2.1 / (download) - annotate - [select for diffs], Tue Nov 20 03:00:44 2012 UTC (11 years, 4 months ago) by tls
Branch: tls-maxphys
Changes since 1.137: +33 -32 lines
Diff to previous 1.137 (colored) to selected 1.88 (colored)

Resync to 2012-11-19 00:00:00 UTC

Revision 1.141 / (download) - annotate - [select for diffs], Wed Nov 14 23:25:05 2012 UTC (11 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base7
Changes since 1.140: +3 -2 lines
Diff to previous 1.140 (colored) to selected 1.88 (colored)

add argsused

Revision 1.140 / (download) - annotate - [select for diffs], Tue Nov 6 09:03:03 2012 UTC (11 years, 4 months ago) by apb
Branch: MAIN
Changes since 1.139: +4 -4 lines
Diff to previous 1.139 (colored) to selected 1.88 (colored)

Remove duplicate "const" modifier found by clang -Wduplicate-decl-specifier

Revision 1.139 / (download) - annotate - [select for diffs], Sat Nov 3 23:42:27 2012 UTC (11 years, 4 months ago) by rmind
Branch: MAIN
Changes since 1.138: +29 -29 lines
Diff to previous 1.138 (colored) to selected 1.88 (colored)

libpthread: replace the use of obsolete sys/tree.h interface with rbtree(9).

Revision 1.138 / (download) - annotate - [select for diffs], Sat Nov 3 03:10:35 2012 UTC (11 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.137: +3 -3 lines
Diff to previous 1.137 (colored) to selected 1.88 (colored)

cast return of sysconf

Revision 1.125.2.3 / (download) - annotate - [select for diffs], Tue Oct 30 18:59:14 2012 UTC (11 years, 5 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.125.2.2: +6 -15 lines
Diff to previous 1.125.2.2 (colored) to branchpoint 1.125 (colored) to selected 1.88 (colored)

sync with head

Revision 1.137 / (download) - annotate - [select for diffs], Wed Aug 15 13:28:32 2012 UTC (11 years, 7 months ago) by drochner
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Branch point for: tls-maxphys
Changes since 1.136: +3 -2 lines
Diff to previous 1.136 (colored) to selected 1.88 (colored)

return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)

Revision 1.136 / (download) - annotate - [select for diffs], Thu Aug 2 12:43:41 2012 UTC (11 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.135: +5 -15 lines
Diff to previous 1.135 (colored) to selected 1.88 (colored)

Prefer sysconf to obtain number of CPUs.

Revision 1.125.2.2 / (download) - annotate - [select for diffs], Wed May 23 10:07:32 2012 UTC (11 years, 10 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.125.2.1: +7 -12 lines
Diff to previous 1.125.2.1 (colored) to branchpoint 1.125 (colored) to selected 1.88 (colored)

sync with head.

Revision 1.106.2.4 / (download) - annotate - [select for diffs], Sat May 19 16:34:15 2012 UTC (11 years, 10 months ago) by riz
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2
Changes since 1.106.2.3: +4 -7 lines
Diff to previous 1.106.2.3 (colored) to branchpoint 1.106 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by enami in ticket #1753):
	lib/libpthread/pthread.c: revision 1.134
Store allocated lwpctl state in the thread actually forked,
which is the only thread lives in the child process.
The problem originally reported here:
  https://bugs.ruby-lang.org/issues/6341

Revision 1.125.4.1 / (download) - annotate - [select for diffs], Mon May 7 03:12:33 2012 UTC (11 years, 10 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Branch point for: netbsd-6-0
Changes since 1.125: +4 -7 lines
Diff to previous 1.125 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by enami in ticket #209):
	lib/libpthread/pthread.c: revision 1.134
Store allocated lwpctl state in the thread actually forked,
which is the only thread lives in the child process.
The problem originally reported here:
  https://bugs.ruby-lang.org/issues/6341

Revision 1.135 / (download) - annotate - [select for diffs], Fri May 4 12:26:33 2012 UTC (11 years, 10 months ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base5
Changes since 1.134: +5 -7 lines
Diff to previous 1.134 (colored) to selected 1.88 (colored)

Simplify check for TLS definition to not hide code. Drop it in another
place as it is redundant.

Revision 1.134 / (download) - annotate - [select for diffs], Thu Apr 26 00:21:44 2012 UTC (11 years, 11 months ago) by enami
Branch: MAIN
Changes since 1.133: +4 -7 lines
Diff to previous 1.133 (colored) to selected 1.88 (colored)

Store allocated lwpctl state in the thread actually forked,
which is the only thread lives in the child process.

The problem originally reported here:
  https://bugs.ruby-lang.org/issues/6341

Revision 1.125.2.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:05:31 2012 UTC (11 years, 11 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.125: +128 -117 lines
Diff to previous 1.125 (colored) to selected 1.88 (colored)

sync with head

Revision 1.133 / (download) - annotate - [select for diffs], Thu Mar 22 20:01:18 2012 UTC (12 years ago) by drochner
Branch: MAIN
CVS Tags: yamt-pagecache-base4
Changes since 1.132: +4 -3 lines
Diff to previous 1.132 (colored) to selected 1.88 (colored)

don't reuse a dynamically allocated stack if a fixed one is requested

Revision 1.132 / (download) - annotate - [select for diffs], Mon Mar 12 20:16:52 2012 UTC (12 years ago) by joerg
Branch: MAIN
Changes since 1.131: +46 -11 lines
Diff to previous 1.131 (colored) to selected 1.88 (colored)

Keep track of the size of the guard area, in case we want to make it
modifiable later. Only reuse the stack if it was allocated by libpthread
and if the expected thread size matches the current stack size.

Revision 1.131 / (download) - annotate - [select for diffs], Mon Mar 12 16:37:15 2012 UTC (12 years ago) by joerg
Branch: MAIN
Changes since 1.130: +13 -11 lines
Diff to previous 1.130 (colored) to selected 1.88 (colored)

Further refine stack allocation. If the stack was provided by the user,
don't bother with setting up a guard page. Otherwise, round up the size
to page size. Point stack inside the guarded area, without the guard
page. Fix size when mprotect failed.

Revision 1.130 / (download) - annotate - [select for diffs], Sat Mar 10 18:01:10 2012 UTC (12 years ago) by joerg
Branch: MAIN
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (colored) to selected 1.88 (colored)

Use correct size.

Revision 1.129 / (download) - annotate - [select for diffs], Fri Mar 9 12:06:44 2012 UTC (12 years ago) by drochner
Branch: MAIN
Changes since 1.128: +4 -4 lines
Diff to previous 1.128 (colored) to selected 1.88 (colored)

-fix initial stacksize rounding
-minor indentation fix

Revision 1.128 / (download) - annotate - [select for diffs], Thu Mar 8 16:40:45 2012 UTC (12 years ago) by joerg
Branch: MAIN
Changes since 1.127: +24 -9 lines
Diff to previous 1.127 (colored) to selected 1.88 (colored)

Actually use the stack thread attributes when creating a new thread.

Revision 1.127 / (download) - annotate - [select for diffs], Thu Mar 8 16:33:45 2012 UTC (12 years ago) by joerg
Branch: MAIN
Changes since 1.126: +10 -3 lines
Diff to previous 1.126 (colored) to selected 1.88 (colored)

Fix the stack base pointer for the initial thread on !HPPA.
AT_STACKBASE is pointing to the start of the stack, which is the
upper limit on platforms where the stack grows down.

Revision 1.126 / (download) - annotate - [select for diffs], Fri Mar 2 18:06:05 2012 UTC (12 years ago) by joerg
Branch: MAIN
Changes since 1.125: +68 -117 lines
Diff to previous 1.125 (colored) to selected 1.88 (colored)

Separate pthread_t from thread stack. Drop additional alignment
restrictions on the thread stack. Remove remaining parts of stackid.

Revision 1.125 / (download) - annotate - [select for diffs], Sun Oct 2 18:18:56 2011 UTC (12 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base
Branch point for: yamt-pagecache, netbsd-6
Changes since 1.124: +3 -2 lines
Diff to previous 1.124 (colored) to selected 1.88 (colored)

put back pthread__dbg variable; this is set to no zero by td_open() when
debugging to avoid multiple td_open() mess.

Revision 1.124 / (download) - annotate - [select for diffs], Fri Sep 16 16:05:59 2011 UTC (12 years, 6 months ago) by joerg
Branch: MAIN
Changes since 1.123: +3 -3 lines
Diff to previous 1.123 (colored) to selected 1.88 (colored)

Use __dead

Revision 1.106.2.1.4.2 / (download) - annotate - [select for diffs], Fri May 20 08:11:18 2011 UTC (12 years, 10 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.106.2.1.4.1: +5 -2 lines
Diff to previous 1.106.2.1.4.1 (colored) to branchpoint 1.106.2.1 (colored) next main 1.106.2.2 (colored) to selected 1.88 (colored)

bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).

Revision 1.123 / (download) - annotate - [select for diffs], Wed Mar 30 00:03:26 2011 UTC (13 years ago) by joerg
Branch: MAIN
CVS Tags: cherry-xenmp-base, cherry-xenmp
Changes since 1.122: +19 -21 lines
Diff to previous 1.122 (colored) to selected 1.88 (colored)

Rework TLS initialisation:
- Update TCB for the initial thread in pthread__initthread, not
  pthread__init to get it valid as soon as possible.
- Don't overwrite the pt_tls field in pthread__initthread.
- Don't deallocate pt_tls in pthread__scrubthread. This worked more by
  chance than by design.
- Handle freeing the TLS area in pthread_create after removing the
  thread instance from the dead queue.

Revision 1.122 / (download) - annotate - [select for diffs], Sat Mar 12 07:46:29 2011 UTC (13 years ago) by matt
Branch: MAIN
Changes since 1.121: +6 -2 lines
Diff to previous 1.121 (colored) to selected 1.88 (colored)

Use __lwp_gettcb_fast if present.

Revision 1.121 / (download) - annotate - [select for diffs], Wed Mar 9 23:10:06 2011 UTC (13 years ago) by joerg
Branch: MAIN
Changes since 1.120: +29 -6 lines
Diff to previous 1.120 (colored) to selected 1.88 (colored)

Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports
_rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to
setup the thread private area of all new threads. ld.elf_so is
responsible for setting up the private area for the initial thread.
Similar functions are called from _libc_init for static binaries, using
dl_iterate_phdr to access the ELF Program Header.

Add test cases to exercise the different TLS storage models. Test cases
are compiled and installed on all platforms, but are skipped on
platforms not marked for TLS support.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.

It is inspired by the TLS support in FreeBSD by Doug Rabson and the
clean ups of the DragonFly port of the original FreeBSD modifications.

Revision 1.120 / (download) - annotate - [select for diffs], Wed Dec 22 22:41:45 2010 UTC (13 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.119: +4 -3 lines
Diff to previous 1.119 (colored) to selected 1.88 (colored)

use pthread__stacksize since size has not been initialized yet.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Dec 22 22:19:46 2010 UTC (13 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.118: +4 -4 lines
Diff to previous 1.118 (colored) to selected 1.88 (colored)

only mprotect base if we moved it.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Dec 18 15:54:27 2010 UTC (13 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.117: +11 -3 lines
Diff to previous 1.117 (colored) to selected 1.88 (colored)

I've had this patch in my tree for a while and since it only improves
the situation, I decided to commit it. There is an inherent problem
with ASLR and the way the pthread library is using the thread stack.

Our pthread library chooses that stack for each thread strategically
so that it can locate the location of the pthread struct for each
thread by masking the stack pointer and looking just below the red
zone it creates. Unfortunately with ASLR you get many random values
for the initial stack, and there are situations where the masked
stack base ends up below the base of the stack. (this happens on
x86 when the stack base happens to be 0x???02000 for example and
your mask is stackmask is 0xffe00000). To fix this, we detect the
pathological cases (this happens only in the main thread), allocate
more stack, and mprotect it appropriately. Then we stash the main
base and the main struct, so that when we look for the pthread
struct in pthread__id, we can special case the main thread.

Another way to work around the problem is unlimiting stacksize,
but the proper way is to use TLS to find the thread structure and
not to play games with the thread stacks.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Nov 14 22:25:23 2010 UTC (13 years, 4 months ago) by tron
Branch: MAIN
Changes since 1.116: +13 -5 lines
Diff to previous 1.116 (colored) to selected 1.88 (colored)

Don't use internal libc function __findenv().

Revision 1.116 / (download) - annotate - [select for diffs], Thu Jul 8 15:13:35 2010 UTC (13 years, 8 months ago) by rmind
Branch: MAIN
Changes since 1.115: +5 -7 lines
Diff to previous 1.115 (colored) to selected 1.88 (colored)

pthread_create: simplify error path slightly.

Revision 1.106.2.3 / (download) - annotate - [select for diffs], Thu May 20 05:02:07 2010 UTC (13 years, 10 months ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, matt-nb5-pq3-base, matt-nb5-pq3
Changes since 1.106.2.2: +5 -2 lines
Diff to previous 1.106.2.2 (colored) to branchpoint 1.106 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by explorer in ticket #1353):
	lib/libpthread/pthread.c: revision 1.114, 1.115
Correctly set pt_lid in the child, after a fork
--
fix the pthread pt_lid in the fork callback function that runs in the
child instead of a function that may be going away.  KNFify

Revision 1.106.2.1.4.1 / (download) - annotate - [select for diffs], Wed Apr 21 05:28:11 2010 UTC (13 years, 11 months ago) by matt
Branch: matt-nb5-mips64
CVS Tags: matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-k15
Changes since 1.106.2.1: +12 -18 lines
Diff to previous 1.106.2.1 (colored) to selected 1.88 (colored)

sync to netbsd-5

Revision 1.115 / (download) - annotate - [select for diffs], Thu Mar 25 01:15:00 2010 UTC (14 years ago) by explorer
Branch: MAIN
Changes since 1.114: +5 -4 lines
Diff to previous 1.114 (colored) to selected 1.88 (colored)

fix the pthread pt_lid in the fork callback function that runs in the child instead of a function that may be going away.  KNFify

Revision 1.114 / (download) - annotate - [select for diffs], Wed Mar 24 07:27:22 2010 UTC (14 years ago) by explorer
Branch: MAIN
Changes since 1.113: +4 -2 lines
Diff to previous 1.113 (colored) to selected 1.88 (colored)

Correctly set pt_lid in the child, after a fork

Revision 1.106.2.2 / (download) - annotate - [select for diffs], Mon Jan 11 00:47:29 2010 UTC (14 years, 2 months ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-1-RC1
Changes since 1.106.2.1: +12 -18 lines
Diff to previous 1.106.2.1 (colored) to branchpoint 1.106 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by christos in ticket #1235):
	lib/libpthread/pthread.c: revision 1.113
Don't just look only at the first element in the deadqueue to find lwp's
to reuse, because if we lose the race with the kernel we are never going
to reuse any elements. Look in the whole list instead.

Revision 1.113 / (download) - annotate - [select for diffs], Sat Oct 3 23:49:50 2009 UTC (14 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.112: +12 -18 lines
Diff to previous 1.112 (colored) to selected 1.88 (colored)

Don't just look only at the first element in the deadqueue to find lwp's
to reuse, because if we lose the race with the kernel we are never going
to reuse any elements. Look in the whole list instead.
XXX: should be pulled up to 5.x

Revision 1.112 / (download) - annotate - [select for diffs], Thu Jul 2 09:59:00 2009 UTC (14 years, 9 months ago) by joerg
Branch: MAIN
Changes since 1.111: +2 -7 lines
Diff to previous 1.111 (colored) to selected 1.88 (colored)

Restore use of _lwp_makecontext, the AMD64 bug has been fixed.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Jun 25 13:38:43 2009 UTC (14 years, 9 months ago) by joerg
Branch: MAIN
Changes since 1.110: +7 -2 lines
Diff to previous 1.110 (colored) to selected 1.88 (colored)

Partially revert 1.110: Use makecontext again until the problems with
_lwp_makecontext are solved.

Revision 1.110 / (download) - annotate - [select for diffs], Sun May 17 14:49:00 2009 UTC (14 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.109: +16 -14 lines
Diff to previous 1.109 (colored) to selected 1.88 (colored)

- Convert from makecontext() -> _lwp_makecontext().

- Rely on _lwp_makecontext() to set up the thread identity register.
  This is not currently done (a bug), nor does libpthread use the
  threadreg yet. I'm doing this so it the code can be used by the
  person working on TLS to verify that their threadreg code is working.

Revision 1.106.6.1 / (download) - annotate - [select for diffs], Wed May 13 19:18:35 2009 UTC (14 years, 10 months ago) by jym
Branch: jym-xensuspend
Changes since 1.106: +15 -15 lines
Diff to previous 1.106 (colored) next main 1.107 (colored) to selected 1.88 (colored)

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.106.2.1 / (download) - annotate - [select for diffs], Fri Apr 3 17:47:43 2009 UTC (14 years, 11 months ago) by snj
Branch: netbsd-5
CVS Tags: netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20091211, matt-nb4-mips64-k7-u2a-k9b
Branch point for: matt-nb5-mips64
Changes since 1.106: +9 -3 lines
Diff to previous 1.106 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by drochner in ticket #648):
	lib/libpthread/pthread.c: revision 1.109
Fix the comparision function used by the red-black tree global thread list
implementation:
-don't return a difference, this can overflow
-don't try to substract typed pointers which don't belong to the
 same object, this gives undefined results
This fixes instabilities of programs which use more than a handful
of threads, eg spuriously failing pthread_join().

Revision 1.109 / (download) - annotate - [select for diffs], Wed Apr 1 10:13:24 2009 UTC (15 years ago) by drochner
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.108: +9 -3 lines
Diff to previous 1.108 (colored) to selected 1.88 (colored)

Fix the comparision function used by the red-black tree global thread list
implementation:
-don't return a difference, this can overflow
-don't try to substract typed pointers which don't belong to the
 same object, this gives undefined results

This fixes instabilities of programs which use more than a handful
of threads, eg spuriously failing pthread_join().

Revision 1.108 / (download) - annotate - [select for diffs], Mon Mar 30 21:32:51 2009 UTC (15 years ago) by ad
Branch: MAIN
Changes since 1.107: +17 -7 lines
Diff to previous 1.107 (colored) to selected 1.88 (colored)

Revert the _lwp_ctl which is causing problem. I did test this locally,
I guess not well enough.

Revision 1.107 / (download) - annotate - [select for diffs], Sun Mar 29 09:30:05 2009 UTC (15 years ago) by ad
Branch: MAIN
Changes since 1.106: +13 -29 lines
Diff to previous 1.106 (colored) to selected 1.88 (colored)

- Make the threadreg code use _lwp_setprivate() instead of MD hooks.

  XXX This must not be enabled by default because the LWP private mechanism
  is reserved for TLS. It is provided only as a test/demo.

  XXX Since ucontext_t does not contain the thread private variable, for a
  short time after threads are created their thread specific data is unset.
  If a signal arrives during that time we are screwed.

- No longer need pthread__osrev.

- Rearrange _lwp_ctl() calls slightly.

Revision 1.106.4.2 / (download) - annotate - [select for diffs], Wed Oct 8 10:03:29 2008 UTC (15 years, 5 months ago) by ad
Branch: christos-time_t
Changes since 1.106.4.1: +1320 -0 lines
Diff to previous 1.106.4.1 (colored) to branchpoint 1.106 (colored) next main 1.107 (colored) to selected 1.88 (colored)

Disable diagnostic assertions by default and just return error codes like
other systems. Allows poorly written applications to appear working. If you
are developing pthread apps please turn it on manually by setting the
environment variable.

Revision 1.106.4.1, Wed Oct 8 10:03:28 2008 UTC (15 years, 5 months ago) by ad
Branch: christos-time_t
Changes since 1.106: +0 -1320 lines
FILE REMOVED

file pthread.c was added on branch christos-time_t on 2008-10-08 10:03:29 +0000

Revision 1.106 / (download) - annotate - [select for diffs], Wed Oct 8 10:03:28 2008 UTC (15 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, matt-mips64-base2, christos-time_t-nbase, christos-time_t-base
Branch point for: netbsd-5, jym-xensuspend, christos-time_t
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (colored) to selected 1.88 (colored)

Disable diagnostic assertions by default and just return error codes like
other systems. Allows poorly written applications to appear working. If you
are developing pthread apps please turn it on manually by setting the
environment variable.

Revision 1.100.2.2 / (download) - annotate - [select for diffs], Thu Sep 18 04:39:24 2008 UTC (15 years, 6 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.100.2.1: +33 -5 lines
Diff to previous 1.100.2.1 (colored) to branchpoint 1.100 (colored) next main 1.101 (colored) to selected 1.88 (colored)

Sync with wrstuden-revivesa-base-2.

Revision 1.48.4.1 / (download) - annotate - [select for diffs], Tue Sep 16 18:49:32 2008 UTC (15 years, 6 months ago) by bouyer
Branch: netbsd-4
Changes since 1.48: +58 -21 lines
Diff to previous 1.48 (colored) next main 1.49 (colored) to selected 1.88 (colored)

Sync with the following revisions (requested by skrll in ticket #1196):
	gnu/dist/gdb						removed
	gnu/usr.bin/gdb53					removed
	distrib/cats/instkernel/Makefile			1.14.6.1
	gnu/dist/gdb6/bfd/config.bfd				1.3.6.1
	gnu/dist/gdb6/bfd/elfxx-sparc.c				1.1.1.2.6.1
	gnu/dist/gdb6/bfd/elfxx-sparc.h				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/Makefile.in				1.2.2.1.2.2
	gnu/dist/gdb6/gdb/alpha-tdep.c				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/alpha-tdep.h				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/alphabsd-nat.c			1.1.1.2.6.2
	gnu/dist/gdb6/gdb/alphabsd-nat.h			1.1.2.1
	gnu/dist/gdb6/gdb/alphabsd-tdep.c			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/alphabsd-tdep.h			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/alphanbsd-nat.c			1.1.2.1
	gnu/dist/gdb6/gdb/alphanbsd-tdep.c			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/amd64-nat.c				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/amd64bsd-nat.c			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/amd64nbsd-nat.c			1.1.1.2.6.3
	gnu/dist/gdb6/gdb/amd64nbsd-tdep.c			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/arm-tdep.h				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/armbsd-tdep.c				1.1.2.1
	gnu/dist/gdb6/gdb/armnbsd-nat.c				1.1.1.2.6.2
	gnu/dist/gdb6/gdb/armnbsd-tdep.c			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/configure				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/configure.ac				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/i386bsd-nat.c				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/i386nbsd-tdep.c			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/m68kbsd-nat.c				1.1.1.2.6.2
	gnu/dist/gdb6/gdb/mipsnbsd-nat.c			1.1.1.2.6.2
	gnu/dist/gdb6/gdb/nbsd-thread.c				1.1.2.3
	gnu/dist/gdb6/gdb/ppcnbsd-nat.c				1.1.1.2.6.2
	gnu/dist/gdb6/gdb/ppcnbsd-tdep.c			1.3.6.1
	gnu/dist/gdb6/gdb/sh-tdep.c				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/shnbsd-nat.c				1.1.1.2.6.3
	gnu/dist/gdb6/gdb/shnbsd-tdep.c				1.1.1.2.6.4
	gnu/dist/gdb6/gdb/shnbsd-tdep.h				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/sparc-nat.c				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/sparc64nbsd-nat.c			1.1.1.2.6.2
	gnu/dist/gdb6/gdb/sparcnbsd-nat.c			1.1.1.2.6.2
	gnu/dist/gdb6/gdb/tramp-frame.h				1.1.1.2.6.1
	gnu/dist/gdb6/gdb/vaxbsd-nat.c				1.1.1.2.6.2
	gnu/dist/gdb6/gdb/config/alpha/nbsd.mh			1.1.1.2.6.1
	gnu/dist/gdb6/gdb/config/arm/nbsd.mt			1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh			1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/i386/nbsd64.mh			1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh		1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/mips/nbsd.mh			1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh		1.1.1.2.6.1
	gnu/dist/gdb6/gdb/config/sh/nbsd.mh			1.1.1.1.6.2
	gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h			1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh		1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh		1.1.1.1.6.1
	gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh			1.1.1.1.6.1
	gnu/dist/gdb6/opcodes/configure				1.1.1.2.6.1
	gnu/dist/gdb6/opcodes/configure.in			1.1.1.2.6.1
	gnu/usr.bin/Makefile					1.126.4.1
	gnu/usr.bin/gdb6/arch/alpha/config.h			1.3.4.1
	gnu/usr.bin/gdb6/arch/alpha/defs.mk			1.2.6.1
	gnu/usr.bin/gdb6/arch/alpha/init.c			1.2.6.1
	gnu/usr.bin/gdb6/arch/alpha/nm.h			1.2.6.1
	gnu/usr.bin/gdb6/arch/arm/defs.mk			1.2.6.2
	gnu/usr.bin/gdb6/arch/arm/init.c			1.1.6.1
	gnu/usr.bin/gdb6/arch/armeb/config.h			1.1.6.2
	gnu/usr.bin/gdb6/arch/armeb/defs.mk			1.1.6.3
	gnu/usr.bin/gdb6/arch/armeb/init.c			1.1.6.2
	gnu/usr.bin/gdb6/arch/armeb/tm.h			1.1.6.2
	gnu/usr.bin/gdb6/arch/armeb/version.c			1.1.6.2
	gnu/usr.bin/gdb6/arch/i386/defs.mk			1.4.4.1
	gnu/usr.bin/gdb6/arch/i386/init.c			1.3.6.1
	gnu/usr.bin/gdb6/arch/m68000/config.h			1.1.6.2
	gnu/usr.bin/gdb6/arch/m68000/defs.mk			1.1.6.2
	gnu/usr.bin/gdb6/arch/m68000/init.c			1.1.6.2
	gnu/usr.bin/gdb6/arch/m68000/tm.h			1.1.6.2
	gnu/usr.bin/gdb6/arch/m68000/version.c			1.1.6.2
	gnu/usr.bin/gdb6/arch/m68k/defs.mk			1.1.4.1
	gnu/usr.bin/gdb6/arch/m68k/init.c			1.1.4.1
	gnu/usr.bin/gdb6/arch/mipseb/config.h			1.3.4.1
	gnu/usr.bin/gdb6/arch/mipseb/defs.mk			1.2.6.2
	gnu/usr.bin/gdb6/arch/mipseb/init.c			1.2.6.2
	gnu/usr.bin/gdb6/arch/mipsel/config.h			1.2.6.3
	gnu/usr.bin/gdb6/arch/mipsel/defs.mk			1.2.6.3
	gnu/usr.bin/gdb6/arch/mipsel/init.c			1.2.6.3
	gnu/usr.bin/gdb6/arch/mipsel/tm.h			1.2.6.2
	gnu/usr.bin/gdb6/arch/mipsel/version.c			1.2.6.2
	gnu/usr.bin/gdb6/arch/powerpc/defs.mk			1.3.6.1
	gnu/usr.bin/gdb6/arch/powerpc/init.c			1.3.6.1
	gnu/usr.bin/gdb6/arch/sh3eb/config.h			1.2.2.2
	gnu/usr.bin/gdb6/arch/sh3eb/defs.mk			1.2.8.3
	gnu/usr.bin/gdb6/arch/sh3eb/init.c			1.1.8.3
	gnu/usr.bin/gdb6/arch/sh3eb/nm.h			1.1.8.2
	gnu/usr.bin/gdb6/arch/sh3eb/tm.h			1.1.8.2
	gnu/usr.bin/gdb6/arch/sh3eb/version.c			1.1.8.2
	gnu/usr.bin/gdb6/arch/sh3el/config.h			1.2.2.2
	gnu/usr.bin/gdb6/arch/sh3el/defs.mk			1.2.8.3
	gnu/usr.bin/gdb6/arch/sh3el/init.c			1.1.8.3
	gnu/usr.bin/gdb6/arch/sh3el/nm.h			1.1.8.2
	gnu/usr.bin/gdb6/arch/sh3el/tm.h			1.1.8.2
	gnu/usr.bin/gdb6/arch/sh3el/version.c			1.1.8.2
	gnu/usr.bin/gdb6/arch/sparc/defs.mk			1.2.6.1
	gnu/usr.bin/gdb6/arch/sparc/init.c			1.1.6.1
	gnu/usr.bin/gdb6/arch/sparc64/defs.mk			1.2.6.1
	gnu/usr.bin/gdb6/arch/sparc64/init.c			1.1.6.1
	gnu/usr.bin/gdb6/arch/vax/config.h			1.1.6.2
	gnu/usr.bin/gdb6/arch/vax/defs.mk			1.1.6.2
	gnu/usr.bin/gdb6/arch/vax/init.c			1.1.6.2
	gnu/usr.bin/gdb6/arch/vax/tm.h				1.1.6.2
	gnu/usr.bin/gdb6/arch/vax/version.c			1.1.6.2
	gnu/usr.bin/gdb6/arch/x86_64/defs.mk			1.2.6.1
	gnu/usr.bin/gdb6/arch/x86_64/init.c			1.1.6.1
	gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/armeb/config.h		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/m68000/config.h		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h			1.1.8.3
	gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h		1.1.8.2
	gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h		1.1.8.2
	gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk			1.1.8.3
	gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h			1.1.8.3
	gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h		1.1.8.2
	gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h		1.1.8.2
	gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk			1.1.8.3
	gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/vax/config.h			1.1.6.2
	gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk			1.1.6.2
	gnu/usr.bin/gdb6/gdb/Makefile				1.5.2.1.2.2
	gnu/usr.bin/gdb6/gdbtui/Makefile			1.2.6.1
	gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h		1.1.8.2
	gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk		1.1.8.2
	gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h		1.1.8.2
	gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk		1.1.8.2
	gnu/usr.bin/gdb6/libiberty/arch/vax/config.h		1.1.6.2
	gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h		1.1.8.2
	gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk		1.1.8.3
	gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h		1.1.8.2
	gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk		1.1.8.3
	gnu/usr.bin/gdb6/opcodes/arch/vax/config.h		1.1.6.2
	gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/armeb/config.h		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/m68000/config.h		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/mipsel/config.h		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h		1.1.8.2
	gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk		1.1.8.2
	gnu/usr.bin/gdb6/readline/arch/sh3el/config.h		1.1.8.2
	gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk		1.1.8.2
	gnu/usr.bin/gdb6/readline/arch/vax/config.h		1.1.6.2
	gnu/usr.bin/gdb6/readline/arch/vax/defs.mk		1.1.6.2
	gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h		1.1.2.1
	gnu/usr.bin/gdb6/sim/arch/mipseb/config.h		1.1.2.1
	gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk		1.1.2.1
	gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h		1.1.2.1
	gnu/usr.bin/gdb6/sim/arch/mipsel/config.h		1.1.2.1
	gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk		1.1.2.1
	lib/libkvm/kvm_sparc64.c				1.10.18.2
	lib/libpthread/pthread.c				1.48.6.4
	lib/libpthread/pthread_barrier.c			1.6.18.1
	lib/libpthread/pthread_cond.c				1.18.12.2
	lib/libpthread/pthread_debug.h				1.8.18.1
	lib/libpthread/pthread_int.h				1.34.4.5
	lib/libpthread/pthread_lock.c				1.14.6.1
	lib/libpthread/pthread_mutex.c				1.22.4.2
	lib/libpthread/pthread_run.c				1.18.12.4
	lib/libpthread/pthread_rwlock.c				1.13.6.2
	lib/libpthread/pthread_sa.c				1.37.6.5
	lib/libpthread/pthread_sig.c				1.47.4.8
	lib/libpthread/pthread_sleep.c				1.7.6.2
	lib/libpthread/sem.c					1.9.6.2
	lib/libpthread/arch/sh3/pthread_md.h			1.3.6.1
	regress/lib/libpthread/resolv/Makefile			1.1.12.1
	regress/lib/libpthread/sigrunning/Makefile		1.1.2.1
	regress/lib/libpthread/sigrunning/sigrunning.c		1.1.2.1
	share/mk/bsd.own.mk					1.489.4.3
	sys/arch/amd64/amd64/locore.S				1.18.14.1
	sys/arch/amd64/amd64/machdep.c				1.44.2.3.2.1
	sys/arch/amd64/conf/kern.ldscript			1.1.70.1
	sys/arch/cats/conf/Makefile.cats.inc			1.17.30.1
	sys/arch/shark/conf/Makefile.shark.inc			1.6.30.1
	sys/arch/sparc64/conf/kern.ldscript			1.7.26.2
	sys/arch/sparc64/conf/kern32.ldscript			1.6.26.2
	sys/arch/sparc64/include/kcore.h			1.4.92.2
	sys/arch/sparc64/sparc64/locore.s			1.232.4.4
	sys/arch/sparc64/sparc64/machdep.c			1.193.4.3
	sys/arch/sparc64/sparc64/pmap.c				1.184.2.1.2.4
	sys/conf/newvers.sh					1.42.26.2
	sys/kern/kern_sa.c					1.87.4.11
	sys/kern/kern_synch.c					1.173.4.2
	sys/sys/savar.h						1.20.10.2
	tools/gdb/Makefile					1.9.4.1
	tools/gdb/mknative-gdb					1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
    kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
  on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!

Revision 1.105 / (download) - annotate - [select for diffs], Sat Aug 2 16:02:26 2008 UTC (15 years, 7 months ago) by matt
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2
Changes since 1.104: +8 -5 lines
Diff to previous 1.104 (colored) to selected 1.88 (colored)

Change some type to eliminate some lint warnings.

Revision 1.104 / (download) - annotate - [select for diffs], Sat Jun 28 10:36:12 2008 UTC (15 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.103: +4 -4 lines
Diff to previous 1.103 (colored) to selected 1.88 (colored)

Minor correction to previous.

Revision 1.103 / (download) - annotate - [select for diffs], Sat Jun 28 10:29:37 2008 UTC (15 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.102: +27 -3 lines
Diff to previous 1.102 (colored) to selected 1.88 (colored)

Now that we have all the scheduling gunk, make these do something useful:

pthread_attr_get_np
pthread_attr_setschedparam
pthread_attr_getschedparam
pthread_attr_setschedpolicy
pthread_attr_getschedpolicy

Revision 1.102 / (download) - annotate - [select for diffs], Wed Jun 25 11:06:34 2008 UTC (15 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.101: +3 -2 lines
Diff to previous 1.101 (colored) to selected 1.88 (colored)

pthread_join: explicitly test for cancellation.

Revision 1.100.2.1 / (download) - annotate - [select for diffs], Mon Jun 23 04:29:53 2008 UTC (15 years, 9 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.100: +67 -151 lines
Diff to previous 1.100 (colored) to selected 1.88 (colored)

Sync w/ -current. 34 merge conflicts to follow.

Revision 1.99.2.2 / (download) - annotate - [select for diffs], Wed Jun 4 02:04:34 2008 UTC (15 years, 9 months ago) by yamt
Branch: yamt-pf42
Changes since 1.99.2.1: +67 -151 lines
Diff to previous 1.99.2.1 (colored) to branchpoint 1.99 (colored) next main 1.100 (colored) to selected 1.88 (colored)

sync with head

Revision 1.101 / (download) - annotate - [select for diffs], Sun May 25 17:05:28 2008 UTC (15 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.100: +67 -151 lines
Diff to previous 1.100 (colored) to selected 1.88 (colored)

PR lib/38741 priority inversion in libpthread breaks apps that use
SCHED_FIFO threads

- Change condvar sync so that we never take the condvar's spinlock without
  first holding the caller-provided mutex. Previously, the spinlock was only
  taken without the mutex in an error path, but it was enough to trigger the
  problem described in the PR.

- Even with this change, applications calling pthread_cond_signal/broadcast
  without holding the interlocking mutex are still subject to the problem
  described in the PR. POSIX discourages this saying that it leads to
  undefined scheduling behaviour, which seems good enough for the time being.

- Elsewhere, use a hash of mutexes instead of per-object spinlocks to
  synchronize entry/exit from sleep queues.

- Simplify how sleep queues are maintained.

Revision 1.99.2.1 / (download) - annotate - [select for diffs], Sun May 18 12:30:39 2008 UTC (15 years, 10 months ago) by yamt
Branch: yamt-pf42
Changes since 1.99: +2 -9 lines
Diff to previous 1.99 (colored) to selected 1.88 (colored)

sync with head.

Revision 1.100 / (download) - annotate - [select for diffs], Mon Apr 28 20:23:01 2008 UTC (15 years, 11 months ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base2, hpcarm-cleanup-nbase
Branch point for: wrstuden-revivesa
Changes since 1.99: +2 -9 lines
Diff to previous 1.99 (colored) to selected 1.88 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.96.2.1 / (download) - annotate - [select for diffs], Mon Mar 24 07:14:45 2008 UTC (16 years ago) by keiichi
Branch: keiichi-mipv6
Changes since 1.96: +12 -6 lines
Diff to previous 1.96 (colored) next main 1.97 (colored) to selected 1.88 (colored)

sync with head.

Revision 1.80.2.3 / (download) - annotate - [select for diffs], Sun Mar 23 00:40:28 2008 UTC (16 years ago) by matt
Branch: matt-armv6
Changes since 1.80.2.2: +14 -6 lines
Diff to previous 1.80.2.2 (colored) to branchpoint 1.80 (colored) next main 1.81 (colored) to selected 1.88 (colored)

sync with HEAD

Revision 1.99 / (download) - annotate - [select for diffs], Sat Mar 22 14:19:27 2008 UTC (16 years ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base
Branch point for: yamt-pf42
Changes since 1.98: +12 -2 lines
Diff to previous 1.98 (colored) to selected 1.88 (colored)

Back out previous. It seems to expose another bug in libpthread/libc,
potentially errno being used before threading is up and running.

Revision 1.98 / (download) - annotate - [select for diffs], Fri Mar 21 21:35:43 2008 UTC (16 years ago) by ad
Branch: MAIN
Changes since 1.97: +2 -12 lines
Diff to previous 1.97 (colored) to selected 1.88 (colored)

Move pthread__errno() into pthread_specific.c so it gets the "no stack
frame" treatment.

Revision 1.97 / (download) - annotate - [select for diffs], Sat Mar 8 13:23:13 2008 UTC (16 years ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-nbase, keiichi-mipv6-base
Changes since 1.96: +12 -6 lines
Diff to previous 1.96 (colored) to selected 1.88 (colored)

Complain if _lwp_ctl() fails.

Revision 1.80.2.2 / (download) - annotate - [select for diffs], Wed Jan 9 01:36:31 2008 UTC (16 years, 2 months ago) by matt
Branch: matt-armv6
Changes since 1.80.2.1: +190 -150 lines
Diff to previous 1.80.2.1 (colored) to branchpoint 1.80 (colored) to selected 1.88 (colored)

sync with HEAD

Revision 1.96 / (download) - annotate - [select for diffs], Tue Jan 8 20:56:08 2008 UTC (16 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: hpcarm-cleanup-base
Branch point for: keiichi-mipv6
Changes since 1.95: +4 -2 lines
Diff to previous 1.95 (colored) to selected 1.88 (colored)

add missing static decls.

Revision 1.95 / (download) - annotate - [select for diffs], Mon Dec 24 16:04:20 2007 UTC (16 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-base
Changes since 1.94: +6 -13 lines
Diff to previous 1.94 (colored) to selected 1.88 (colored)

- Use pthread__cancelled() in more places.
- pthread_join(): assert that pthread_cond_wait() returns zero.

Revision 1.94 / (download) - annotate - [select for diffs], Mon Dec 24 14:46:28 2007 UTC (16 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.93: +110 -68 lines
Diff to previous 1.93 (colored) to selected 1.88 (colored)

- Fix pthread_rwlock_trywrlock() which was broken.

- Add new functions: pthread_mutex_held_np, mutex_owner_np, rwlock_held_np,
  rwlock_wrheld_np, rwlock_rdheld_np. These match the kernel's locking
  primitives and can be used when porting kernel code to userspace.

- Always create LWPs detached. Do join/exit sync mostly in userland. When
  looped on a dual core box this seems ~30% quicker than using lwp_wait().
  Reduce number of lock acquire/release ops during thread exit.

Revision 1.93 / (download) - annotate - [select for diffs], Tue Dec 11 03:21:30 2007 UTC (16 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: cube-autoconf-base, cube-autoconf
Changes since 1.92: +2 -15 lines
Diff to previous 1.92 (colored) to selected 1.88 (colored)

Remove test of pthread__osrev that is no longer needed.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Dec 4 16:08:28 2007 UTC (16 years, 3 months ago) by yamt
Branch: MAIN
Changes since 1.91: +3 -3 lines
Diff to previous 1.91 (colored) to selected 1.88 (colored)

remove unnecessary assignments.

Revision 1.91 / (download) - annotate - [select for diffs], Sat Dec 1 01:07:34 2007 UTC (16 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.90: +6 -19 lines
Diff to previous 1.90 (colored) to selected 1.88 (colored)

- On 64-bit platforms 1/2 the default tsd values were garbage. Fix it.
- The lwpctl block is now needed on uniprocessors, for pthread_curcpu_np().

Revision 1.90 / (download) - annotate - [select for diffs], Mon Nov 19 15:14:12 2007 UTC (16 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.89: +2 -5 lines
Diff to previous 1.89 (colored) to selected 1.88 (colored)

Remove the debuglog stuff. ktrace is more useful now.

Revision 1.89 / (download) - annotate - [select for diffs], Wed Nov 14 19:28:23 2007 UTC (16 years, 4 months ago) by drochner
Branch: MAIN
Changes since 1.88: +3 -2 lines
Diff to previous 1.88 (colored)

Add pthread_equal() to libc stubs; this makes a lot of sense for
threadsafe libraries implementing own locking functions.
Ride on yesterday's minor version bumps.

Revision 1.88 / (download) - annotate - [selected], Tue Nov 13 17:20:09 2007 UTC (16 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.87: +64 -13 lines
Diff to previous 1.87 (colored)

Mutexes:

- Play scrooge again and chop more cycles off acquire/release.
- Spin while the lock holder is running on another CPU (adaptive mutexes).
- Do non-atomic release.

Threadreg:

- Add the necessary hooks to use a thread register.
- Add the code for i386, using %gs.
- Leave i386 code disabled until xen and COMPAT_NETBSD32 have the changes.

Revision 1.87 / (download) - annotate - [select for diffs], Tue Nov 13 15:57:10 2007 UTC (16 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.86: +32 -62 lines
Diff to previous 1.86 (colored) to selected 1.88 (colored)

For PR bin/37347:

- Override __libc_thr_init() instead of using our own constructor.
- Add pthread__getenv() and use instead of getenv(). This is used before
  we are up and running and unfortunatley getenv() takes locks.

Other changes:

- Cache the spinlock vectors in pthread__st. Internal spinlock operations
  now take 1 function call instead of 3 (i386).
- Use pthread__self() internally, not pthread_self().
- Use __attribute__ ((visibility("hidden"))) in some places.
- Kill PTHREAD_MAIN_DEBUG.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Nov 7 00:55:22 2007 UTC (16 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.85: +16 -4 lines
Diff to previous 1.85 (colored) to selected 1.88 (colored)

Use _lwp_setname() to pass thread names to the kernel.

Revision 1.80.2.1 / (download) - annotate - [select for diffs], Tue Nov 6 23:11:39 2007 UTC (16 years, 4 months ago) by matt
Branch: matt-armv6
CVS Tags: matt-armv6-prevmlocking
Changes since 1.80: +114 -74 lines
Diff to previous 1.80 (colored) to selected 1.88 (colored)

sync with HEAD

Revision 1.48.6.4 / (download) - annotate - [select for diffs], Sun Nov 4 04:26:57 2007 UTC (16 years, 4 months ago) by wrstuden
Branch: wrstuden-fixsa
Changes since 1.48.6.3: +39 -14 lines
Diff to previous 1.48.6.3 (colored) to branchpoint 1.48 (colored) next main 1.49 (colored) to selected 1.88 (colored)

Check in changes to locking behavior.

pthread__sched() now takes a parameter indicating if the run queue is
already locked. Useful in cases where we already hold pthread__runqueue_lock.

pthread__suspend() now requires callers explicitly lock pthread__runqueue_lock
so we avoid issues with locking order regarding pt_statelock.

Adjsut our lock hierarchy. pthread__runqueue_lock is now above
pt_statelock, triggering the above adjustments. Adjust a lot of routines
as a result. Also move pt_siglock way up in the hierarchy, making
pthread__kill() not violate locking. Add a few extra locks to the list.

Adjust a botch in how pthread_join() used pthread-spintrylock().

pthread_cancel() now correctly walks up the locks with thread->pt_sleeplock.
We can't just lock it, as it points to a lock in the top locking rung. So
try locking, and if it fails, unlock and re-lock. Add code to cope with
the target thread not being in the expected state (which was on a
blocked queue) after we get all the locks.

Add comments to describe what's going on in places that I got confused.

Now that pt_statelock is lower in the locking order than
pthread__runqueue_lock, we can explicitly lock a thread's state before
we take it off the run queue. Adjust sched_yield() accordingly and
add some locking calls that were commented out before (as they'd have
been locking violations).

pthread_next(): now that we can lock the state lock while holding the run
queue lock, do so. Set a thread's state to PT_STATE_RUNNING before we
pull it off the run queue. Since we always are going to switch to it,
set pt_vpid and pt_lastlwp while setting the state. pthread_next
callers now _don't_ set these values.

pthread__kill(): grab pthread__runqueue_lock before target->pt_statelock.
If we want to target a thread that is on a blocked queue, do the
pthread_spintrylock() dance. Unlock all three locks we're running around
with, lock target->pt_sleeplock, then re-lock them all. After we lock,
make sure that the thread's still on a blocked queue before proceeding. If
it's not, either exit (if we wanted to wake out of sigtimedwait())
or start it all over. If the thread has gone live, it may have blocked
our signal and it'd be quite weird to get a signal you'd disabled, just
because the signaller had been running before you blocked it.

Revision 1.48.6.3 / (download) - annotate - [select for diffs], Fri Oct 19 05:35:37 2007 UTC (16 years, 5 months ago) by wrstuden
Branch: wrstuden-fixsa
Changes since 1.48.6.2: +14 -10 lines
Diff to previous 1.48.6.2 (colored) to branchpoint 1.48 (colored) to selected 1.88 (colored)

Work on cleaning up lock ordering. Turns out that there's not too
much to do, other than fixing an issue in join and one I introduced.

Add volumous comment in pthread_int.h describing how I understand the
current locking to work.

pthread_join() considered pt_flaglock to be a higher-priority lock
than pt_join_lock. Life makes more sense if we flip that.

To not make a lot of routines messy, pthread__runqueue_lock has to be
lower in the lock ordering than pt_statelock. Adapt the changes I made
to sched_yield() to this ordering.

There still is a wart regarding setting the state of a thread
we are taking off of the run (or idle) queue. We can't lock
its pt_statelock as we have the runqueue lock held. For now,
go back to what the old code did which was just write over the info.
This isn't that bad as the only things that should be changing
the state of this thread should be run-queue savy. I need to check
this though....

Revision 1.85 / (download) - annotate - [select for diffs], Tue Oct 16 15:07:02 2007 UTC (16 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.84: +6 -2 lines
Diff to previous 1.84 (colored) to selected 1.88 (colored)

... but preserve the linked list, for the debugger only.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Oct 16 13:41:18 2007 UTC (16 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.83: +31 -15 lines
Diff to previous 1.83 (colored) to selected 1.88 (colored)

Replace the global thread list with a red-black tree. From joerg@.

Revision 1.48.6.2 / (download) - annotate - [select for diffs], Tue Sep 25 05:12:02 2007 UTC (16 years, 6 months ago) by wrstuden
Branch: wrstuden-fixsa
Changes since 1.48.6.1: +3 -3 lines
Diff to previous 1.48.6.1 (colored) to branchpoint 1.48 (colored) to selected 1.88 (colored)

Rename pt_blockedlwp to pt_lastlwp, and set it whenever we switch
to a new pthread. This way we always know on what lwp a given
thread is running.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Sep 11 18:08:10 2007 UTC (16 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (colored) to selected 1.88 (colored)

Put new threads on the tail of pthread__allqueue, for the debugger.

Revision 1.68.2.3 / (download) - annotate - [select for diffs], Mon Sep 10 10:54:04 2007 UTC (16 years, 6 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.68.2.2: +90 -70 lines
Diff to previous 1.68.2.2 (colored) to branchpoint 1.68 (colored) next main 1.69 (colored) to selected 1.88 (colored)

Sync with HEAD.

Revision 1.48.6.1 / (download) - annotate - [select for diffs], Mon Sep 10 05:24:51 2007 UTC (16 years, 6 months ago) by wrstuden
Branch: wrstuden-fixsa
Changes since 1.48: +10 -2 lines
Diff to previous 1.48 (colored) to selected 1.88 (colored)

Check in first step towards having pthread_kill() kill a thread running
on another CPU.

This change adds initial support for deferred signal handling. Just before
we go to sleep and while we hold &self->pt_statelock, check to see if we
have any deferred signals (blocked signals) pending. These are signals
that are not masked in our mask and which have been sent to us. We
were running when they came in. Further, since they are being handled
this way, there's a signal handler defined for them.

So unlock, run the signal handler(s), then carry on.

For condition variables, we consider this a spurious wakeup, so we just
return 0, having not unlocked the mutex. We run the handler with
the mutex held. This shouldn't matter, as you aren't supposed to play
with mutexes in signal handlers. :-)

For nanosleep(), we just process signals, then go to sleep.

For all other cases, we are in a loop with some external predicate. So
we process the signal then roll around the loop to see if it still applies.

In sched_yield(), spin until all deferred signals are gone. Since we hold
self->pt_statelock and that lock has to be held before sending a deferred
signal, no new deferred signals will come in until we're asleep.

While here, be more careful about locking while changing pt_state
to PT_STATE_RUNNING. Grab pt_statelock while doing it, and also set
next->pt_vpid to self->pt_vpid holding the same lock. Will make
the test to determine how to deliver a signal work right (since
a thread's vpid will soon matter in the general case). No longer
set next->pt_vpid in pthread__next().

Revision 1.82 / (download) - annotate - [select for diffs], Sat Sep 8 22:49:50 2007 UTC (16 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base5
Changes since 1.81: +46 -42 lines
Diff to previous 1.81 (colored) to selected 1.88 (colored)

- Get rid of self->pt_mutexhint and use pthread__mutex_owned() instead.
- Update some comments and fix minor bugs. Minor cosmetic changes.
- Replace some spinlocks with mutexes and rwlocks.
- Change the process private semaphores to use mutexes and condition
  variables instead of doing the synchronization directly. Spinlocks
  are no longer used by the semaphore code.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Sep 7 14:09:27 2007 UTC (16 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.80: +46 -30 lines
Diff to previous 1.80 (colored) to selected 1.88 (colored)

- Don't take the mutex's spinlock (ptr_interlock) in pthread_cond_wait().
  Instead, make the deferred wakeup list a per-thread array and pass down
  the lwpid_t's that way.

- In pthread_cond_wait(), take the mutex before dealing with early wakeup.
  In this way there should never be contention on the CV's spinlock if
  the app follows POSIX rules (there should only be contention on the
  user-provided mutex).

- Add a port of the kernel's rwlocks. The rwlock's spinlock is only taken if
  there is contention. This is enabled where atomic ops are available. Right
  now that is only i386 and amd64 because I don't have other hardware to
  test with. It's trivial to add stubs for other architectures as long as
  they have compare-and-swap. When we have proper atomic ops the old rwlock
  code can be removed.

- Add a new mutex implementation that's similar to the kernel's mutexes, but
  uses compare-and-swap to maintain the waiters list, so no spinlocks are
  involved. Same caveats apply as for the rwlocks.

Revision 1.68.2.2 / (download) - annotate - [select for diffs], Mon Sep 3 10:14:13 2007 UTC (16 years, 6 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.68.2.1: +293 -188 lines
Diff to previous 1.68.2.1 (colored) to branchpoint 1.68 (colored) to selected 1.88 (colored)

Sync with HEAD.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Aug 23 19:13:23 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base4
Branch point for: matt-armv6
Changes since 1.79: +4 -4 lines
Diff to previous 1.79 (colored) to selected 1.88 (colored)

Acquire the correct lock in pthread_detach(). Spotted by Jan Kryl.

Revision 1.79 / (download) - annotate - [select for diffs], Fri Aug 17 14:28:31 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base3
Changes since 1.78: +13 -5 lines
Diff to previous 1.78 (colored) to selected 1.88 (colored)

pthread_suspend_np, pthread_resume_np, pthread_detach: return correct code
on error.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Aug 16 13:54:16 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.77: +59 -78 lines
Diff to previous 1.77 (colored) to selected 1.88 (colored)

Trim fat off libpthread internal spinlock operations. Makes a mesurable
improvement across the board.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Aug 16 12:01:49 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.76: +67 -72 lines
Diff to previous 1.76 (colored) to selected 1.88 (colored)

- Reinitialize the absolute minimum when recycling user thread state.
  Chops another ~10% off create/join in a loop on i386.
- Disable low level debugging as this is stable. Improves benchmarks
  across the board by a small percentage. Uncontested mutex acquire
  and release in a loop becomes about 8% quicker.
- Minor cleanup.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Aug 16 01:09:34 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.75: +135 -5 lines
Diff to previous 1.75 (colored) to selected 1.88 (colored)

Remove PT_FIXEDSTACKSIZE_LG.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Aug 16 00:41:23 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.74: +20 -24 lines
Diff to previous 1.74 (colored) to selected 1.88 (colored)

Cache thread context for creation instead of setting it up every time.
Speeds create/join loop by about 10-15% on i386.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Aug 15 22:48:52 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.73: +36 -41 lines
Diff to previous 1.73 (colored) to selected 1.88 (colored)

Simplify pthread_join(). Knocks about 5% off pthread_create/join in a loop.

Revision 1.68.2.1 / (download) - annotate - [select for diffs], Wed Aug 15 13:46:51 2007 UTC (16 years, 7 months ago) by skrll
Branch: nick-csl-alignment
Changes since 1.68: +214 -161 lines
Diff to previous 1.68 (colored) to selected 1.88 (colored)

Sync with HEAD.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Aug 7 19:58:30 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base2
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored) to selected 1.88 (colored)

Missed variable rename..

Revision 1.72 / (download) - annotate - [select for diffs], Tue Aug 7 19:04:21 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.71: +74 -12 lines
Diff to previous 1.71 (colored) to selected 1.88 (colored)

Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.

Revision 1.71.2.2 / (download) - annotate - [select for diffs], Sat Aug 4 18:54:13 2007 UTC (16 years, 7 months ago) by ad
Branch: matt-mips64
Changes since 1.71.2.1: +1128 -0 lines
Diff to previous 1.71.2.1 (colored) to branchpoint 1.71 (colored) next main 1.72 (colored) to selected 1.88 (colored)

Make libpthread_dbg build again.

Revision 1.71.2.1, Sat Aug 4 18:54:12 2007 UTC (16 years, 7 months ago) by ad
Branch: matt-mips64
Changes since 1.71: +0 -1128 lines
FILE REMOVED

file pthread.c was added on branch matt-mips64 on 2007-08-04 18:54:13 +0000

Revision 1.71 / (download) - annotate - [select for diffs], Sat Aug 4 18:54:12 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
CVS Tags: matt-mips64-base
Branch point for: matt-mips64
Changes since 1.70: +3 -2 lines
Diff to previous 1.70 (colored) to selected 1.88 (colored)

Make libpthread_dbg build again.

Revision 1.70 / (download) - annotate - [select for diffs], Sat Aug 4 13:43:46 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.69: +21 -15 lines
Diff to previous 1.69 (colored) to selected 1.88 (colored)

Fix error in previous.

Revision 1.69 / (download) - annotate - [select for diffs], Sat Aug 4 13:37:48 2007 UTC (16 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.68: +134 -150 lines
Diff to previous 1.68 (colored) to selected 1.88 (colored)

Some significant performance improvements, and a fix for a race with pthread
detach/join.

- Make mutex acquire spin for a short time, as done with spinlocks.
- Make the number of spins controllable with the env var PTHREAD_NSPINS.
- Reduce the amount of time that libpthread internal spinlocks are held.
- Rely more on the barrier effects of park/unpark to avoid taking spinlocks.
- Simplify the locking around pthreads and the global queues.
- Align per-thread sync data on a 128 byte boundary.
- Offset thread stacks by a small amount to try and reduce cache thrash.

Revision 1.68 / (download) - annotate - [select for diffs], Sat Mar 24 18:51:59 2007 UTC (17 years ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base, hpcarm-cleanup
Branch point for: nick-csl-alignment
Changes since 1.67: +5 -4 lines
Diff to previous 1.67 (colored) to selected 1.88 (colored)

- Test+branch is usually cheaper than making an indirect function call,
  so avoid making them.
- When parking an LWP on a condition variable, point the hint argument at
  the mutex's waiters queue. Chances are we will be awoken from that later.

Revision 1.67 / (download) - annotate - [select for diffs], Wed Mar 14 23:33:42 2007 UTC (17 years ago) by ad
Branch: MAIN
Changes since 1.66: +34 -24 lines
Diff to previous 1.66 (colored) to selected 1.88 (colored)

- pthread__park: always check for cancellation.
- pthread__unpark: cosmetic changes.

Revision 1.66 / (download) - annotate - [select for diffs], Mon Mar 5 23:55:40 2007 UTC (17 years ago) by ad
Branch: MAIN
Changes since 1.65: +25 -34 lines
Diff to previous 1.65 (colored) to selected 1.88 (colored)

- Simplify the interface to pthread__park() and friends slightly.
- If sysctl() fails, complain.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Mar 2 18:58:45 2007 UTC (17 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.64: +4 -4 lines
Diff to previous 1.64 (colored) to selected 1.88 (colored)

Silence a gcc/lint warning.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Mar 2 18:53:51 2007 UTC (17 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.63: +4 -410 lines
Diff to previous 1.63 (colored) to selected 1.88 (colored)

Remove the PTHREAD_SA option. If M:N threads is reimplemented it's
better off done with a seperate library.

Revision 1.63 / (download) - annotate - [select for diffs], Fri Mar 2 17:40:55 2007 UTC (17 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.62: +5 -3 lines
Diff to previous 1.62 (colored) to selected 1.88 (colored)

pthread_detach: acquire the join lock before changing pt_flags.

Revision 1.62 / (download) - annotate - [select for diffs], Wed Feb 21 22:31:38 2007 UTC (17 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.61: +5 -4 lines
Diff to previous 1.61 (colored) to selected 1.88 (colored)

- Put detached & exiting threads on the tail of the deadqueue, not head.
- Don't forget to set PT_FLAG_DETACHED.

Revision 1.61 / (download) - annotate - [select for diffs], Wed Feb 21 22:25:57 2007 UTC (17 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.60: +4 -3 lines
Diff to previous 1.60 (colored) to selected 1.88 (colored)

Minor optimisation to previous: only check for continued existence of
the thread if it was detached.

Revision 1.60 / (download) - annotate - [select for diffs], Thu Feb 15 15:39:38 2007 UTC (17 years, 1 month ago) by yamt
Branch: MAIN
Changes since 1.59: +13 -9 lines
Diff to previous 1.59 (colored) to selected 1.88 (colored)

fix a race between pthread_exit and pthread_create.
inefficient, but better than crashing.

Revision 1.59 / (download) - annotate - [select for diffs], Fri Feb 9 23:53:24 2007 UTC (17 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.58: +5 -3 lines
Diff to previous 1.58 (colored) to selected 1.88 (colored)

Cast the return value of _lwp_unpark_all(), just in case.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jan 31 23:55:20 2007 UTC (17 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.57: +3 -3 lines
Diff to previous 1.57 (colored) to selected 1.88 (colored)

use __func__ instead of __FUNCTION__ which is a gcc extension.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Jan 20 20:02:36 2007 UTC (17 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 (colored) to selected 1.88 (colored)

pthread_create(): clear newthread->pt_sleeponq before calling _lwp_create().

Revision 1.56 / (download) - annotate - [select for diffs], Sat Jan 20 04:56:07 2007 UTC (17 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.55: +3 -3 lines
Diff to previous 1.55 (colored) to selected 1.88 (colored)

add a missing volatile.

Revision 1.55 / (download) - annotate - [select for diffs], Tue Jan 16 05:22:55 2007 UTC (17 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.54: +3 -2 lines
Diff to previous 1.54 (colored) to selected 1.88 (colored)

Fix a race between pthread_exit() and pthread_join().

Revision 1.54 / (download) - annotate - [select for diffs], Tue Jan 16 04:19:02 2007 UTC (17 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.53: +16 -10 lines
Diff to previous 1.53 (colored) to selected 1.88 (colored)

Fix a race between pthread_create() and pthread_exit() in the 1:1 case.

Revision 1.53 / (download) - annotate - [select for diffs], Tue Jan 16 01:35:16 2007 UTC (17 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.52: +8 -7 lines
Diff to previous 1.52 (colored) to selected 1.88 (colored)

Pass in the 'hint' argument when parking/unparking LWPs.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Dec 24 18:39:45 2006 UTC (17 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.51: +142 -58 lines
Diff to previous 1.51 (colored) to selected 1.88 (colored)

Fix bugs with and improve upon previous.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Dec 23 09:48:18 2006 UTC (17 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.50: +9 -2 lines
Diff to previous 1.50 (colored) to selected 1.88 (colored)

Add another comment.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Dec 23 05:18:56 2006 UTC (17 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.49: +4 -2 lines
Diff to previous 1.49 (colored) to selected 1.88 (colored)

Add a comment.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Dec 23 05:14:46 2006 UTC (17 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.48: +279 -17 lines
Diff to previous 1.48 (colored) to selected 1.88 (colored)

Conditionalised support for 1:1 threads. Needs associated kernel changes
and more work to be useful.

Revision 1.41.2.2 / (download) - annotate - [select for diffs], Sat May 13 16:41:35 2006 UTC (17 years, 10 months ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1
Changes since 1.41.2.1: +3 -1 lines
Diff to previous 1.41.2.1 (colored) to branchpoint 1.41 (colored) next main 1.42 (colored) to selected 1.88 (colored)

Pull up following revision(s) (requested by drochner in ticket #1314):
	lib/libpthread/pthread.c: revision 1.48
There is no point in using the internal sigprocmask() to initialize
the process' signal mask -- this ends up in a no-op.
Use the system call directly instead.
(This might be done in pthread_sig.c, but for now I wanted a simple
patch which is easily tested and pulled up.)

Revision 1.48 / (download) - annotate - [select for diffs], Mon Apr 24 18:39:36 2006 UTC (17 years, 11 months ago) by drochner
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: wrstuden-fixsa, netbsd-4
Changes since 1.47: +5 -3 lines
Diff to previous 1.47 (colored) to selected 1.88 (colored)

There is no point in using the internal sigprocmask() to initialize
the process' signal mask -- this ends up in a no-op.
Use the system call directly instead.
(This might be done in pthread_sig.c, but for now I wanted a simple
patch which is easily tested and pulled up.)

Revision 1.47 / (download) - annotate - [select for diffs], Sun Feb 12 11:41:53 2006 UTC (18 years, 1 month ago) by yamt
Branch: MAIN
Changes since 1.46: +2 -8 lines
Diff to previous 1.46 (colored) to selected 1.88 (colored)

- do PTHREAD_MLOCK_KLUDGE in pthread__stackid_setup, rather than callers,
  so that the main thread is not different from others.
  as a side effect, fix memory leak in pthread_create on error.
- make pthread__stackid_setup return a error rather than calling err(2).

Revision 1.41.2.1 / (download) - annotate - [select for diffs], Tue Nov 1 20:01:41 2005 UTC (18 years, 5 months ago) by jmc
Branch: netbsd-3
CVS Tags: netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0
Changes since 1.41: +35 -11 lines
Diff to previous 1.41 (colored) to selected 1.88 (colored)

Pullup revs 1.43-1.46 (requested by chs in ticket #926)
 In pthread_mutex_lock_slow(), pthread_rwlock_timedrdlock() and sem_wait(),
 call pthread__start() if it hasn't already been called. this avoids
 an internal assertion from the library if these routines are used
 before any threads are created and they need to sleep.
 PR#20256, PR#24241, PR#25722, PR#26096

 Fix the interaction between sigtimedwait() and pthread_kill(),
 both waking up a sleeping thread and avoiding going to sleep if
 a signal is already pending. PR#30348

 In pthread_kill() and pthread_suspend_np(), return without doing anything
 f the target thread is a zombie.
 In all the functions that didn't do so already, verify a pthread_t before
 dereferencing it (under #ifdef ERRORCHECK, since these checks are not
 mandated by the standard).

 Starting the pthread library (ie. calling pthread__start()) before
 any threads are created turned out to be not such a good idea.
 there are stronger requirements on what has to work in a forked child
 while a process is still single-threaded. so take all that stuff
 back out and fix the problems with single-threaded programs that
 are linked with libpthread differently, by checking if the library
 has been started and doing completely different stuff if it hasn't been:
 - for pthread_rwlock_timedrdlock(), just fail with EDEADLK immediately.
 - for sem_wait(), the only thing that can unlock the semaphore is a
 signal handler, so use sigsuspend() to wait for a signal.
 - for pthread_mutex_lock_slow(), just go into an infinite loop
 waiting for signals.

 If mlock() fails in pthread_create(), return EAGAIN instead of
 failing an assertion.

Revision 1.46 / (download) - annotate - [select for diffs], Wed Oct 19 02:44:45 2005 UTC (18 years, 5 months ago) by chs
Branch: MAIN
Changes since 1.45: +5 -3 lines
Diff to previous 1.45 (colored) to selected 1.88 (colored)

if mlock() fails in pthread_create(), return EAGAIN instead of
failing an assertion.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Oct 19 02:15:03 2005 UTC (18 years, 5 months ago) by chs
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored) to selected 1.88 (colored)

starting the pthread library (ie. calling pthread__start()) before
any threads are created turned out to be not such a good idea.
there are stronger requirements on what has to work in a forked child
while a process is still single-threaded.  so take all that stuff
back out and fix the problems with single-threaded programs that
are linked with libpthread differently, by checking if the library
has been started and doing completely different stuff if it hasn't been:
 - for pthread_rwlock_timedrdlock(), just fail with EDEADLK immediately.
 - for sem_wait(), the only thing that can unlock the semaphore is a
   signal handler, so use sigsuspend() to wait for a signal.
 - for pthread_mutex_lock_slow(), just go into an infinite loop
   waiting for signals.

I also noticed that there's a "sem2" test that has never worked in its
single-threaded form.  the problem there is that a signal handler tries
to take a sem_t interlock which is already held when the signal is received.
fix this too, by adding a single-threaded case for sig_trywait() that
blocks signals instead of using the userland interlock.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Oct 16 00:37:52 2005 UTC (18 years, 5 months ago) by chs
Branch: MAIN
Changes since 1.43: +32 -10 lines
Diff to previous 1.43 (colored) to selected 1.88 (colored)

in pthread_kill() and pthread_suspend_np(), return without doing anything
if the target thread is a zombie.

in all the functions that didn't do so already, verify a pthread_t before
dereferencing it (under #ifdef ERRORCHECK, since these checks are not
mandated by the standard).

clean up some debugging stuff.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Oct 16 00:07:24 2005 UTC (18 years, 5 months ago) by chs
Branch: MAIN
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored) to selected 1.88 (colored)

in pthread_mutex_lock_slow(), pthread_rwlock_timedrdlock() and sem_wait(),
call pthread__start() if it hasn't already been called.  this avoids
an internal assertion from the library if these routines are used
before any threads are created and they need to sleep.
fixes PR 20256, PR 24241, PR 25722, PR 26096.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Jul 1 12:35:18 2005 UTC (18 years, 9 months ago) by yamt
Branch: MAIN
Changes since 1.41: +2 -4 lines
Diff to previous 1.41 (colored) to selected 1.88 (colored)

make this compile without PTHREAD_MLOCK_KLUDGE.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Feb 26 20:33:06 2005 UTC (19 years, 1 month ago) by nathanw
Branch: MAIN
CVS Tags: netbsd-3-base
Branch point for: netbsd-3
Changes since 1.40: +4 -2 lines
Diff to previous 1.40 (colored) to selected 1.88 (colored)

Keep the kernel updated with signal action signal masks (act.sa_mask) until
threads are started, since before that the traditional signal invocation
method will be used. Fixes regress/lib/libpthread/sigmask2.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Feb 10 23:42:37 2005 UTC (19 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored) to selected 1.88 (colored)

Default back pthread__concurrency to 1 until we fix the regression test
related to pthread_kill().

Revision 1.39 / (download) - annotate - [select for diffs], Thu Feb 10 02:20:49 2005 UTC (19 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.38: +4 -5 lines
Diff to previous 1.38 (colored) to selected 1.88 (colored)

If $PTHREAD_CONCURRENCY is not set, set it to ncpu

Revision 1.38 / (download) - annotate - [select for diffs], Thu Feb 3 17:30:33 2005 UTC (19 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.37: +18 -2 lines
Diff to previous 1.37 (colored) to selected 1.88 (colored)

Add charles' mlock fixes, protected with PTHREAD_MLOCK_KLUDGE and enabled
by default, until we come up with a real fix.

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jan 6 17:38:29 2005 UTC (19 years, 2 months ago) by mycroft
Branch: MAIN
Changes since 1.36: +4 -2 lines
Diff to previous 1.36 (colored) to selected 1.88 (colored)

Add some additional assertions and debugging printf()s.

Revision 1.33.2.1 / (download) - annotate - [select for diffs], Mon Aug 30 10:01:22 2004 UTC (19 years, 7 months ago) by tron
Branch: netbsd-2-0
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2
Changes since 1.33: +49 -16 lines
Diff to previous 1.33 (colored) next main 1.34 (colored) to selected 1.88 (colored)

Pull up revision 1.36 (requested by yamt in ticket #801):
- fix pthread_detach with an already exit'ed thread.
  namely, put the thread to deadqueue rather than just leaking it.
- fix a race between pthread_detach/join and pthread_exit,
  which also causes dead thread leaks.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Aug 12 10:54:13 2004 UTC (19 years, 7 months ago) by yamt
Branch: MAIN
Changes since 1.35: +49 -16 lines
Diff to previous 1.35 (colored) to selected 1.88 (colored)

- fix pthread_detach with an already exit'ed thread.
  namely, put the thread to deadqueue rather than just leaking it.
- fix a race between pthread_detach/join and pthread_exit,
  which also causes dead thread leaks.

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jul 18 21:24:52 2004 UTC (19 years, 8 months ago) by chs
Branch: MAIN
Changes since 1.34: +7 -7 lines
Diff to previous 1.34 (colored) to selected 1.88 (colored)

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.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jun 25 16:33:32 2004 UTC (19 years, 9 months ago) by drochner
Branch: MAIN
Changes since 1.33: +6 -4 lines
Diff to previous 1.33 (colored) to selected 1.88 (colored)

const'ify the arguments to pthread__assertfunc and _errorfunc;
needed because the __func__ pseudo-var is strictly "const*" in gcc-3.4

Revision 1.33 / (download) - annotate - [select for diffs], Sun Mar 14 01:19:41 2004 UTC (20 years ago) by cl
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.32: +43 -8 lines
Diff to previous 1.32 (colored) to selected 1.88 (colored)

add libpthread part of concurrency support for SA on MP systems
- enable concurrency according to environment variable PTHREAD_CONCURRENCY
- add idle VP wakeup if there are additional jobs and idle VPs
- make reidlequeue per VP
- enable spinning for locks
- fix race condition in alarm processing
- fix race condition in mutex locking
- make debugging output line buffered and add VP prefix to debug lines

Revision 1.32 / (download) - annotate - [select for diffs], Wed Dec 31 16:45:48 2003 UTC (20 years, 3 months ago) by cl
Branch: MAIN
Changes since 1.31: +10 -10 lines
Diff to previous 1.31 (colored) to selected 1.88 (colored)

Handle block/unblock for threads in critical section without
sa_unblockyield.

XXX g/c sa_unblockyield in kernel later

Revision 1.31 / (download) - annotate - [select for diffs], Thu Dec 18 15:39:56 2003 UTC (20 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.30: +6 -3 lines
Diff to previous 1.30 (colored) to selected 1.88 (colored)

PR/23791: Patrick Latify: Fix memory leak on thread creation failure.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Nov 9 18:56:48 2003 UTC (20 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.29: +71 -4 lines
Diff to previous 1.29 (colored) to selected 1.88 (colored)

Add:

int    pthread_attr_setcreatesuspend_np(pthread_attr_t *);
int    pthread_suspend_np(pthread_t);
int    pthread_resume_np(pthread_t);

needed for java. Approved and fixed by cl.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Aug 13 18:52:01 2003 UTC (20 years, 7 months ago) by nathanw
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored) to selected 1.88 (colored)

Split out pthread_{set,get}specific() into a separate file and arrange
for that file to not be built with profiling. This makes it reasonable to
use pthread_{set,get}specific() to implement thread-safe profiline call counts.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Jul 21 22:24:09 2003 UTC (20 years, 8 months ago) by nathanw
Branch: MAIN
Changes since 1.27: +59 -39 lines
Diff to previous 1.27 (colored) to selected 1.88 (colored)

Lock accesses to pt_flags and pt_cancel.

When disabling cancellation, clear the pt_cancel flag if it was set
and note the cancellation request with PT_FLAG_CS_PENDING. This avoids
a problem where a cancellation request entered but not acted upon before
pthread_setcanclstate(PTHREAD_CANCEL_DISABLE) is called would still be
aceted upon before cancellation was re-enabled.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jul 21 22:17:14 2003 UTC (20 years, 8 months ago) by nathanw
Branch: MAIN
Changes since 1.26: +6 -4 lines
Diff to previous 1.26 (colored) to selected 1.88 (colored)

Use _sys_write() instead of write() in the assertion and error
functions, to avoid invoking the cancellation machinery in the middle
of trying to print an assertion or error message.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jul 21 22:14:57 2003 UTC (20 years, 8 months ago) by nathanw
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored) to selected 1.88 (colored)

Move initialization of variable 'nthreads' so that pthread_exit() from
the main thread, with no other threads created, exits cleanly instead
of triggering an assertion in pthread_next().

Revision 1.25 / (download) - annotate - [select for diffs], Fri Jul 18 22:33:45 2003 UTC (20 years, 8 months ago) by nathanw
Branch: MAIN
Changes since 1.24: +3 -359 lines
Diff to previous 1.24 (colored) to selected 1.88 (colored)

pthread.c was getting a bit unwieldly. Move pthread_attr stuff out
into a new file, and put the shared private structure definition in
pthread_int.h.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jul 18 22:12:30 2003 UTC (20 years, 8 months ago) by nathanw
Branch: MAIN
Changes since 1.23: +240 -53 lines
Diff to previous 1.23 (colored) to selected 1.88 (colored)

Implement a bunch of pthread_attr_() functions, which genuinely set and examine
pthread_attr_t objects, although most of the properties being set don't really
affect threads yet:

pthread_attr_{get,set}guardsize()
pthread_attr_{get,set}inheritsched()
pthread_attr_{get,set}scope()
pthread_attr_{get,set}stack()
pthread_attr_setstack{size,addr}()

Remove some useless assertions and error checks in the existing pthread_attr()
routines.

Implement pthread_attr_get_np(), to examine the attributes of an existing
thread. Idea and interface from FreeBSD.

Change PTHREAD_ERRORMODE environment variable to PTHREAD_DIAGASSERT, and
make it behave like libc's LIBC_DIAGASSERT. The way to disable error-checking
and aborting is now "PTHREAD_DIAGASSERT=AEL", rather than
"PTHREAD_ERRORMODE=ignore".

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jul 18 21:57:26 2003 UTC (20 years, 8 months ago) by nathanw
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored) to selected 1.88 (colored)

Add strong alias for setcancelstate.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jun 26 01:30:39 2003 UTC (20 years, 9 months ago) by nathanw
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored) to selected 1.88 (colored)

Initialize pt_trapuc in pthread__initthread().

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jun 6 21:06:07 2003 UTC (20 years, 9 months ago) by nathanw
Branch: MAIN
Changes since 1.20: +5 -2 lines
Diff to previous 1.20 (colored) to selected 1.88 (colored)

Tiny bit of infrastructure for ABI-supported thread-ID storage.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jun 2 16:59:26 2003 UTC (20 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.19: +30 -2 lines
Diff to previous 1.19 (colored) to selected 1.88 (colored)

Add pthread_attr_getstack{,size,addr} needed by jdk

Revision 1.19 / (download) - annotate - [select for diffs], Tue May 27 15:24:24 2003 UTC (20 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.18: +9 -10 lines
Diff to previous 1.18 (colored) to selected 1.88 (colored)

pass lint:
1. add new pthread__abort() and change pthread_assert(0) to it.
2. put constcond in the right place (in the macro).
3. no space after pthread__assert macro.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Apr 28 17:46:30 2003 UTC (20 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.17: +9 -3 lines
Diff to previous 1.17 (colored) to selected 1.88 (colored)

Move call to pthread__alarm_init() from pthread_init() (called at load
time) to pthread__start() (called on the first call of
pthread_create()), so that there's no opportunity for a fork() to
clear the per-process timer.

Problem pointed out by a test program from Mihai CHELARU on
current-users.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Apr 23 19:35:47 2003 UTC (20 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.16: +49 -2 lines
Diff to previous 1.16 (colored) to selected 1.88 (colored)

Introduce a pthread__error() macro, for detected application errors as
opposed to internal errors. The setting of the PTHREAD_ERRORMODE
environment variable determines the runtime behavior. Valid settings
are "ignore", "abort", and "print". The default is currently "abort".

Revision 1.16 / (download) - annotate - [select for diffs], Mon Apr 7 21:29:48 2003 UTC (20 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.15: +18 -2 lines
Diff to previous 1.15 (colored) to selected 1.88 (colored)

When threads are started, register an atfork callback to clear
pthread__started in the child process. This lets sleep() work in the
child, as required by POSIX.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Mar 10 22:16:37 2003 UTC (21 years ago) by nathanw
Branch: MAIN
Changes since 1.14: +2 -6 lines
Diff to previous 1.14 (colored) to selected 1.88 (colored)

Re-enable nanosleep(); kernel bug is squished (kern_time.c:1.67).

Revision 1.14 / (download) - annotate - [select for diffs], Sat Mar 8 08:03:34 2003 UTC (21 years ago) by lukem
Branch: MAIN
Changes since 1.13: +4 -3 lines
Diff to previous 1.13 (colored) to selected 1.88 (colored)

add __RCSID()

Revision 1.13 / (download) - annotate - [select for diffs], Fri Feb 28 18:37:44 2003 UTC (21 years, 1 month ago) by nathanw
Branch: MAIN
Changes since 1.12: +5 -1 lines
Diff to previous 1.12 (colored) to selected 1.88 (colored)

Disable userlevel nanosleep() until I find the timer/alarm bug that it
is tickling.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Feb 26 23:41:01 2003 UTC (21 years, 1 month ago) by nathanw
Branch: MAIN
Changes since 1.11: +5 -7 lines
Diff to previous 1.11 (colored) to selected 1.88 (colored)

In pthread_create(), rearrange name-setting code so that name is set
to NULL when the attribute structure does not have a private field
allocated.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Feb 26 22:02:48 2003 UTC (21 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.10: +171 -5 lines
Diff to previous 1.10 (colored) to selected 1.88 (colored)

Add support for naming a thread, using an API compatible with Tru64 Unix:
* pthread_attr_getname_np()
* pthread_attr_setname_np()
* pthread_getname_np()
* pthread_setname_np()

In addition to being query'able by the application (for log messages, etc.),
it is intended that these names can show up in the debugger.

Reviewed by nathanw.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Feb 22 00:53:29 2003 UTC (21 years, 1 month ago) by nathanw
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored) to selected 1.88 (colored)

In pthread_exit(), clear pt_canceled in addition to setting
PT_FLAG_CS_DISABLED in pt_flags.

Prevents cancellation cleanup handlers from thinking that they've been
canceled and exiting mid-handler. Problem spotted by Matt Thomas.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 15 04:34:40 2003 UTC (21 years, 1 month ago) by nathanw
Branch: MAIN
Changes since 1.8: +37 -11 lines
Diff to previous 1.8 (colored) to selected 1.88 (colored)

Define a pthread-specific assert function, pthread__assert(), that
bails out without trying to flush stdio buffers.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jan 31 04:59:40 2003 UTC (21 years, 2 months ago) by nathanw
Branch: MAIN
Changes since 1.7: +7 -8 lines
Diff to previous 1.7 (colored) to selected 1.88 (colored)

Use pthread__sched_sleepers() instead of iterating over sleep queues
ourself.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jan 29 14:03:08 2003 UTC (21 years, 2 months ago) by drochner
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored) to selected 1.88 (colored)

cosmetics

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jan 25 00:37:01 2003 UTC (21 years, 2 months ago) by nathanw
Branch: MAIN
Changes since 1.5: +16 -10 lines
Diff to previous 1.5 (colored) to selected 1.88 (colored)

Make pthread_join() accomodate spurious wakeups from pthread__block().

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jan 19 21:58:24 2003 UTC (21 years, 2 months ago) by thorpej
Branch: MAIN
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored) to selected 1.88 (colored)

Add some threadlib stubs that are used by X:
* thr_create() (stub in libc aborts)
* thr_exit() (stub in libc calls exit())
* thr_yield() (stub in libc does nothing)

Also make the libc thr_self() stub not abort.

XXX Should we add thrattr_*() stubs for setting the detach-state?

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jan 19 16:03:50 2003 UTC (21 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.3: +4 -3 lines
Diff to previous 1.3 (colored) to selected 1.88 (colored)

- constify the get functions
- remove argument variable names since they pollute the namespace
- add mock implementation of the missing stack functions
XXX: we need to do this right [i.e. actually get and set sizes and addresses]
but the current stack setup makes this a bit complicated.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jan 18 18:45:52 2003 UTC (21 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.2: +5 -3 lines
Diff to previous 1.2 (colored) to selected 1.88 (colored)

de-lint

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jan 18 10:34:15 2003 UTC (21 years, 2 months ago) by thorpej
Branch: MAIN
Changes since 1.1: +835 -0 lines
Diff to previous 1.1 (colored) to selected 1.88 (colored)

Merge the nathanw_sa branch.

Revision 1.1.2.44 / (download) - annotate - [select for diffs], Sat Jan 11 01:21:33 2003 UTC (21 years, 2 months ago) by nathanw
Branch: nathanw_sa
CVS Tags: nathanw_sa_end
Changes since 1.1.2.43: +8 -4 lines
Diff to previous 1.1.2.43 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored) to selected 1.88 (colored)

Add some debug logging to pthread__idle(). Be more agressive about the
assertion if we return from sa_yield() by creating an artifical
lock-count, so it doesn't get reclaimed mid-assert.

Revision 1.1.2.43 / (download) - annotate - [select for diffs], Thu Jan 9 19:27:51 2003 UTC (21 years, 2 months ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.42: +3 -3 lines
Diff to previous 1.1.2.42 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Remove trailing semicolon from __strong_alias().

Revision 1.1.2.42 / (download) - annotate - [select for diffs], Wed Jan 8 19:34:22 2003 UTC (21 years, 2 months ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.41: +17 -33 lines
Diff to previous 1.1.2.41 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Rewrite the way libpthread provides thread primitives to libc, using
strong and weak aliases (the way cancelation points are handled).

Work around lame Unix static library semantics which could cause
the wrong thread primitives or cancelation point functions to be
included in a statically-linked program.

THIS IS AN ABI CHANGE.  People running the nathanw_sa branch should
ensure that their libc and libpthread are in sync after updating.

Revision 1.1.2.41 / (download) - annotate - [select for diffs], Fri Jan 3 22:04:55 2003 UTC (21 years, 2 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.40: +5 -1 lines
Diff to previous 1.1.2.40 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Silent failures are annoying.
Sprinkle some assert(0) after NOTREACHED points.

Revision 1.1.2.40 / (download) - annotate - [select for diffs], Thu Jan 2 19:06:20 2003 UTC (21 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.39: +4 -4 lines
Diff to previous 1.1.2.39 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Oops, left a few too many extern declarations around. (Save buffers
*before* commiting!)

Revision 1.1.2.39 / (download) - annotate - [select for diffs], Thu Jan 2 06:41:07 2003 UTC (21 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.38: +48 -48 lines
Diff to previous 1.1.2.38 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Clean up the namespace a bit; make a few more things static, and make sure
all private globals are prefixed with pthread__.

Revision 1.1.2.38 / (download) - annotate - [select for diffs], Thu Jan 2 02:21:25 2003 UTC (21 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.37: +19 -12 lines
Diff to previous 1.1.2.37 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Newline police.

Revision 1.1.2.37 / (download) - annotate - [select for diffs], Mon Dec 30 22:24:34 2002 UTC (21 years, 3 months ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.36: +4 -1 lines
Diff to previous 1.1.2.36 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Add support for using RAS lock primitives on uniprocessors where
RAS is available.

Revision 1.1.2.36 / (download) - annotate - [select for diffs], Fri Dec 20 01:06:16 2002 UTC (21 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.35: +2 -1 lines
Diff to previous 1.1.2.35 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Set the type of an idle thread to PT_THREAD_IDLE only when it is created,
not every time it's scheduled (left over from vestigal any-thread-can-be-idle
code).

Revision 1.1.2.35 / (download) - annotate - [select for diffs], Wed Dec 18 22:51:47 2002 UTC (21 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.34: +4 -4 lines
Diff to previous 1.1.2.34 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Start debugging subsystem later, after the main() thread has been
created, so that lockcounts (called back by mutexes locked by libc)
aren't referencing garbage.

Revision 1.1.2.34 / (download) - annotate - [select for diffs], Mon Dec 16 18:16:40 2002 UTC (21 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.33: +16 -1 lines
Diff to previous 1.1.2.33 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

More debugging hooks.

Revision 1.1.2.33 / (download) - annotate - [select for diffs], Mon Nov 18 08:41:57 2002 UTC (21 years, 4 months ago) by skrll
Branch: nathanw_sa
Changes since 1.1.2.32: +2 -2 lines
Diff to previous 1.1.2.32 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Typo in comment.

Revision 1.1.2.32 / (download) - annotate - [select for diffs], Mon Oct 28 17:41:15 2002 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.31: +42 -51 lines
Diff to previous 1.1.2.31 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Implement sched_yield().

Clean up trailing whitespace.

Revision 1.1.2.31 / (download) - annotate - [select for diffs], Mon Oct 28 16:23:46 2002 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.30: +37 -6 lines
Diff to previous 1.1.2.30 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

As pointed out recently on comp.programming.threads, POSIX requires
that pthread_detach() and pthread_join() must return ESRCH, not invoke
undefined behavior, even if handed completely nonsensical pthread_t values.
So, search through the list of threads to see if the pthread_t value is
valid.

Revision 1.1.2.30 / (download) - annotate - [select for diffs], Sun Oct 27 23:35:01 2002 UTC (21 years, 5 months ago) by thorpej
Branch: nathanw_sa
Changes since 1.1.2.29: +2 -2 lines
Diff to previous 1.1.2.29 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Cosmetic changes.

Revision 1.1.2.29 / (download) - annotate - [select for diffs], Tue Oct 22 01:28:20 2002 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.28: +2 -2 lines
Diff to previous 1.1.2.28 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Use _INITCONTEXT_U() instead of _getucontext_u() to prime a fresh context.

Revision 1.1.2.28 / (download) - annotate - [select for diffs], Mon Oct 7 19:30:32 2002 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.27: +4 -4 lines
Diff to previous 1.1.2.27 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Rename started to pthread__started and make it avaliable to other
files.

Revision 1.1.2.27 / (download) - annotate - [select for diffs], Mon Oct 7 19:28:14 2002 UTC (21 years, 5 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.26: +20 -11 lines
Diff to previous 1.1.2.26 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Comment formatting.

Revision 1.1.2.26 / (download) - annotate - [select for diffs], Wed Aug 14 18:41:50 2002 UTC (21 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.25: +2 -1 lines
Diff to previous 1.1.2.25 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Infrastructure for machine-dependent init code.

Revision 1.1.2.25 / (download) - annotate - [select for diffs], Mon May 20 19:18:44 2002 UTC (21 years, 10 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.24: +3 -2 lines
Diff to previous 1.1.2.24 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Many signal improvements:

 - Implement sigsuspend()
 - Take pending signals that are unblocked in pthread_sigmask().
 - Tweak the signal mask passed by sigaction() to permit us to manage
   our own thread-specific signal masks.
 - Don't try to deliver signals to zombie threads.
 - Prevent a race between deciding a thread can take a signal and actually
   taking it.
 - Don't put threads that are blocked in a syscall on the run queue.
 - Add debug logging.

Revision 1.1.2.24 / (download) - annotate - [select for diffs], Thu May 2 16:49:24 2002 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.23: +35 -1 lines
Diff to previous 1.1.2.23 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Different way of integrating with libc: Create a vector type for pthread
operations; libc will have a pointer to such a vector. When the pthread
library is loaded, set libc's pointer to a vector of real operations.
This removes the reliance on weak symbol magic, which didn't work
for static binaries, and as an aesthetic side effect, we don't have to
export a bunch of ugly _libc_pthread_* wrappers.

Revision 1.1.2.23 / (download) - annotate - [select for diffs], Sun Apr 28 23:57:49 2002 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.22: +2 -1 lines
Diff to previous 1.1.2.22 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Explicitly set the state of the first thread to RUNNING.

Revision 1.1.2.22 / (download) - annotate - [select for diffs], Fri Apr 26 17:46:49 2002 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.21: +4 -1 lines
Diff to previous 1.1.2.21 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Track the object (and queue and lock!) when sleeping to join a thread.

Revision 1.1.2.21 / (download) - annotate - [select for diffs], Wed Apr 24 05:27:15 2002 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.20: +18 -6 lines
Diff to previous 1.1.2.20 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Create pthread IDs.

Revision 1.1.2.20 / (download) - annotate - [select for diffs], Thu Apr 11 02:52:45 2002 UTC (21 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.19: +13 -9 lines
Diff to previous 1.1.2.19 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Revert weak aliases.

Recycle the thread structures and stacks of threads that have been put on
on the dead queue, so that pthread_create() ... pthread_join() isn't a
resource leak.

Revision 1.1.2.19 / (download) - annotate - [select for diffs], Mon Mar 25 03:46:00 2002 UTC (22 years ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.18: +6 -1 lines
Diff to previous 1.1.2.18 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Provide interfaces to libc.

Revision 1.1.2.18 / (download) - annotate - [select for diffs], Fri Mar 1 01:20:09 2002 UTC (22 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.17: +2 -2 lines
Diff to previous 1.1.2.17 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Loop-hoist a comment.

Revision 1.1.2.17 / (download) - annotate - [select for diffs], Thu Feb 21 05:07:09 2002 UTC (22 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.16: +2 -1 lines
Diff to previous 1.1.2.16 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Block signals in idle threads.

Revision 1.1.2.16 / (download) - annotate - [select for diffs], Tue Feb 19 23:56:08 2002 UTC (22 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.15: +11 -15 lines
Diff to previous 1.1.2.15 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Move alarm initialization into pthread_alarms.c.

Revision 1.1.2.15 / (download) - annotate - [select for diffs], Wed Feb 6 19:20:19 2002 UTC (22 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.14: +2 -8 lines
Diff to previous 1.1.2.14 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Move a couple of debugging declarations to pthread_debug.c, where they belong.

Add a debug routine to print the pthread event counters if the environment
variable PTHREAD_DEBUGCOUNTERS is set.

Revision 1.1.2.14 / (download) - annotate - [select for diffs], Mon Jan 28 19:05:48 2002 UTC (22 years, 2 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.13: +78 -12 lines
Diff to previous 1.1.2.13 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Cancellation support.
This includes implementing pthread_cancel() and pthread_testcancel(),
making pthread_join() and pthread_cond_wait() cancellation points,
introducing new states to distinguish waiting on a sleep queue
from waiting in the kernel, and introducing a locking protocol around
changing a thread's run state.

Revision 1.1.2.13 / (download) - annotate - [select for diffs], Sun Dec 30 02:18:17 2001 UTC (22 years, 3 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.12: +159 -9 lines
Diff to previous 1.1.2.12 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

pt_spin_t -> pthread_spin_t.
Implement basic cancellation functions.
Implement pthread__errno().

Revision 1.1.2.12 / (download) - annotate - [select for diffs], Tue Sep 25 19:39:28 2001 UTC (22 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.11: +2 -2 lines
Diff to previous 1.1.2.11 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Use getcontext() instead of _getcontext() before initializing the
new thread state with makecontext(), since the callee-save registers saved
by _getcontext() may not include the registers needed by makecontext().

Unfortunately, this implies a syscall for every new thread creation.

Revision 1.1.2.11 / (download) - annotate - [select for diffs], Tue Sep 4 21:17:52 2001 UTC (22 years, 6 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.10: +2 -1 lines
Diff to previous 1.1.2.10 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

#include <string.h> for memset prototype.

Revision 1.1.2.10 / (download) - annotate - [select for diffs], Wed Aug 8 19:36:49 2001 UTC (22 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.9: +1 -18 lines
Diff to previous 1.1.2.9 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

pthread_malloc() and pthread_free() are superfluous.

Revision 1.1.2.9 / (download) - annotate - [select for diffs], Wed Aug 8 19:07:34 2001 UTC (22 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.8: +23 -4 lines
Diff to previous 1.1.2.8 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Keep track of the total number of normal threads, and exit() from
pthread_exit() if the count goes to 0.

Revision 1.1.2.8 / (download) - annotate - [select for diffs], Wed Aug 8 16:38:16 2001 UTC (22 years, 7 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.7: +29 -8 lines
Diff to previous 1.1.2.7 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Split pthread__start() into pthread__start() and pthread__init();
pthread__init() is the code that needs to run whenever the thread
library is linked in and usable; pthread__start() doesn't run until
the first new thread is created.

Revision 1.1.2.7 / (download) - annotate - [select for diffs], Wed Aug 1 23:45:16 2001 UTC (22 years, 8 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.6: +3 -1 lines
Diff to previous 1.1.2.6 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Initialize pt_sleepuc and pt_switchto (!).

Revision 1.1.2.6 / (download) - annotate - [select for diffs], Tue Jul 24 21:17:34 2001 UTC (22 years, 8 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.5: +2 -3 lines
Diff to previous 1.1.2.5 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Unlock the correct spinlock (Ye gods).

Revision 1.1.2.5 / (download) - annotate - [select for diffs], Tue Jul 17 20:22:41 2001 UTC (22 years, 8 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.4: +4 -0 lines
Diff to previous 1.1.2.4 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Add a mechanisim for debugging that is less likely to change scheduling
behaviour than using printf (writing to a shared memory segment), and a
simple tool for dumping the buffer. Partly inspired by the kernel msgbuf
code.

Revision 1.1.2.4 / (download) - annotate - [select for diffs], Tue Jul 17 20:18:39 2001 UTC (22 years, 8 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.3: +11 -9 lines
Diff to previous 1.1.2.3 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Create more idle threads. In the current system, we need one for every level
of preemption nesting.

Revision 1.1.2.3 / (download) - annotate - [select for diffs], Fri Jul 13 02:42:38 2001 UTC (22 years, 8 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.2: +37 -1 lines
Diff to previous 1.1.2.2 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Note copyright.
Standardize RCS IDs.

Revision 1.1.2.2 / (download) - annotate - [select for diffs], Fri Jul 13 02:14:00 2001 UTC (22 years, 8 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.1.2.1: +30 -51 lines
Diff to previous 1.1.2.1 (colored) to branchpoint 1.1 (colored) to selected 1.88 (colored)

Convert to new queue type.

Remove a level of indirection in the pthread_attr_t type.

Revision 1.1.2.1 / (download) - annotate - [select for diffs], Mon Mar 5 23:51:54 2001 UTC (23 years ago) by nathanw
Branch: nathanw_sa
Changes since 1.1: +472 -0 lines
Diff to previous 1.1 (colored) to selected 1.88 (colored)

The beginnings of a scheduler activations-based pthread library.

Revision 1.1, Mon Mar 5 23:51:54 2001 UTC (23 years ago) by nathanw
Branch: MAIN
CVS Tags: nathanw_sa_before_merge
Branch point for: nathanw_sa
FILE REMOVED

file pthread.c was initially added on branch nathanw_sa.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>