Commit Graph

394 Commits

Author SHA1 Message Date
kleink 5af00b0b39 pthread_sigmask(): Add restrict qualifier to set, oset args. 2006-01-07 20:10:29 +00:00
uwe 6b8eb49dd6 Use PLT for PIC calls to avoid text relocs in the shared library. 2006-01-06 22:46:14 +00:00
uwe 55ad9313a6 In PIC code call setcontext(2) via PLT to avoid text reloc in the
shared library.
2006-01-04 17:44:53 +00:00
skrll 73b7bdcee7 A couple of fixes to make libpthread really shared, i.e. not have text re-
locations:

	- Don't declare pthread__switch_away global
	- Do the PIC dance for pthread__switch_return_point and
	  pthread__locked_switch. Ideally these (and other) symbols would
	  be hidden.

Thanks to uwe@, dyoung@ and elad@ for help.

XXX sh3 is still to be done.
XXX vax does strange things.
2006-01-04 12:43:43 +00:00
uwe ffaa72c2cc Adapt to new PIC macros that are now in <machine/asm.h>. Same binary
code is generated (still with text relocs, but eliminating them is the
next step).
2005-12-31 05:08:28 +00:00
perry ce666bb8ce __asm__ -> __asm 2005-12-24 23:10:08 +00:00
perry 4e11af46bc Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 21:11:15 +00:00
christos d7e5caf4fd include libc after our own files to fix ports that have 2 assym.h's. One
in pthread and one in libc.
2005-12-13 22:07:20 +00:00
chs 3ad2320789 if mlock() fails in pthread_create(), return EAGAIN instead of
failing an assertion.
2005-10-19 02:44:45 +00:00
chs 0e67554241 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.
2005-10-19 02:15:03 +00:00
chs ba70e96a09 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.
2005-10-16 00:37:52 +00:00
chs c190c7de90 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.  fixes PR 30348.
2005-10-16 00:31:35 +00:00
chs 2415c56ed0 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.
2005-10-16 00:07:24 +00:00
kleink 34ef731cb3 Change the sched_*() functions to return -1 and set errno to ENOSYS
(per the standard) instead of returning ENOSYS.  Noted by Ian Zagorskih
in PR kern/30970.
2005-10-09 11:17:28 +00:00
tv 21eb6bbacb pthread_attr_getschedpolicy() wasn't setting the return buffer at all.
SCHED_OTHER happens to be 0, so this assignment to "int *" succeeds,
and becomes a no-op.

Fix by dereferencing "policy" to do the assignment, thus filling the
return buffer with 0.
2005-09-21 15:27:14 +00:00
christos f1cc481dfe XXX: Work around libpthread's "intimate" connection with libc. 2005-09-13 02:45:38 +00:00
christos 0393abcb27 Revert part of previous; we need to merge acts.sa_mask into our pthread mask.
Thanks martin...
2005-07-26 20:16:07 +00:00
christos 9d60b1fc89 - removed bogus acts.sa_mask setting.
- unblock the signal we are currently delivering, because it might have
  been blocked if we are woken up by another thread.
2005-07-26 20:11:02 +00:00
nathanw 0774992407 Add cancellation protection to pthread_once() as per the standard; if
the once routine is cancelled, the effect on once_control is as if
pthread_once() was never called.

Bug report and fix from PR lib/30734.
2005-07-16 23:14:53 +00:00
yamt 9493e4bf43 make this compile without PTHREAD_MLOCK_KLUDGE. 2005-07-01 12:35:18 +00:00
peter d4cc3cce89 Create links for pthread_attr_setschedparam.3
and pthread_attr_getschedparam.3 to pthread_attr.3.

From Igor Sobrado in PR/29997.
2005-06-17 18:37:24 +00:00
wiz 52e496a68e New sentence, new line. 2005-06-17 18:26:53 +00:00
wiz 27d002e8de New sentence, new line.
Break much too long line.
2005-06-17 18:23:52 +00:00
peter a28acffec8 Don't create links to pthread_barierattr_init.3 and
pthread_barierattr_destroy.3 but to pthread_barrierattr_init.3
and pthread_barrierattr_destroy.3 (note the 2 rs in barrier).
2005-06-17 18:23:19 +00:00
peter 568accb2c0 Fix various spelling errors.
From Igor Sobrado in PR/29997.
2005-06-17 18:07:06 +00:00
thorpej d93ab54e03 Use TOOL_GENASSYM. Part of PR toolchain/30350 2005-05-30 16:02:56 +00:00
nathanw 5f7a108732 Avoid passing along a timespec with a negative number of seconds if
the current time plus the caller-supplied time to sleep wraps the
time_t. Instead, sleep until INT_MAX.
2005-04-19 16:38:57 +00:00
matt 38b7b2fcde Merge updates to algorithms from i386 switch code. 2005-04-09 20:53:19 +00:00
matt 7fa678813d Add STACKSPACE 2005-04-09 20:50:27 +00:00
matt e722e50c79 Rework and cleanup. Don't use REI, fake a call frame instead. 2005-04-09 20:49:02 +00:00
kleink 9cf9c2316b Add restrict qualifiers to <pthread.h> function arguments. 2005-03-21 17:55:07 +00:00
kleink 34579587e1 Include <sys/select.h> explicitly rather than relying on other headers
to do it.
2005-03-21 09:00:49 +00:00
kleink 363c26d4ba Interpose cancellation points in pollts() and pselect(), bringing us
to libc.so.12.127 and libpthread.so.0.6.
2005-03-18 11:23:44 +00:00
jwise f579845294 Lint warning police -- don't use `//' for comments in C code. 2005-03-17 17:23:21 +00:00
kleink ebf592f1e6 Move up the definition of __LIBC12_SOURCE__; since <poll.h> now includes
<sys/sigtypes.h> this is needed earlier.
2005-03-10 00:34:23 +00:00
nathanw 22f226cf84 Correct the order of arguments to __sigplusset() in two places to correct
the signal mask experienced by signal handlers in threaded programs.
Fixes regress/lib/libpthread/sigmask3.
2005-02-27 18:25:01 +00:00
nathanw 916de87872 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.
2005-02-26 20:33:06 +00:00
nathanw 1eaf7124f7 Fetch the old signal mask for the signal action whether or not we're
setting a new signal action; this makes sigaction(sig, NULL, &oact)
return a sensible value in the signal mask instead of stack trash.

Addresses PR lib/29536.

XXX the mask seen by signal handlers in a program linked with
libpthread but not yet multithreaded will not reflect masks set here.
2005-02-26 18:15:25 +00:00
christos b35aef8d4b Default back pthread__concurrency to 1 until we fix the regression test
related to pthread_kill().
2005-02-10 23:42:37 +00:00
christos 3a610280bb If $PTHREAD_CONCURRENCY is not set, set it to ncpu 2005-02-10 02:20:49 +00:00
christos cca9405683 Add charles' mlock fixes, protected with PTHREAD_MLOCK_KLUDGE and enabled
by default, until we come up with a real fix.
2005-02-03 17:30:33 +00:00
daniel 760b46e0e9 Document PTHREAD_CONCURRENCY, ack by wiz@. 2005-02-01 11:38:27 +00:00
nathanw efffd0e96a pthread_rwlock_timedrdlock() and pthread_rwlock_timedwrlock():
After exiting the try-again loop, make one more test of the lock
conditions, in case it was released while a signal handler kept the
thread busy past the alarm expiration.
2005-01-09 01:57:38 +00:00
nathanw 6a562a3a84 pthread_rwlock_timedrdlock() and pthread_rwlock_timedwrlock():
Expand the test for valid values of abs_timeout to check for negative
values of tv_sec and tv_nsec.
2005-01-09 01:47:20 +00:00
mycroft 6951dd53b1 Fix a pasto. 2005-01-06 17:42:31 +00:00
mycroft 077972bfb2 Replace the even-odd test for incrementing unblockgen with a simple
blockgen!=unblockgen.  I'm not sure this is 100% correct, but it partly
alleviates a problem with multiple unblocks for the same thread getting
stacked up.
2005-01-06 17:40:22 +00:00
mycroft 75a9478818 Add some additional assertions and debugging printf()s. 2005-01-06 17:38:29 +00:00
mycroft e890aef258 Use TIMER_RELTIME rather than the constant 0 in one place. 2005-01-06 17:34:52 +00:00
mycroft 8fa85b4a65 gettimeofday();TIMEVAL_TO_TIMESPEC(); is exactly equivalent to
clock_gettime(CLOCK_REALTIME), except the latter may have more preicison
some day.  So, use that.
2005-01-06 17:33:36 +00:00
nathanw 74718675cc Avoid passing zero-valued timespecs to timer_settime() when we want to set
a timer, as that will clear the timer instead. Pass in a safely in-the-past
value instead.
Addresses PR lib/28700.

(XXX passing in values between 0 and 1000 nanoseconds will still fail, but
 that bug needs to be fixed in timer_settime(), not here)
2004-12-29 20:47:39 +00:00