Commit Graph

35 Commits

Author SHA1 Message Date
nathanw f83d3766b4 Mark when a thread has taken a signal. 2004-08-24 01:46:30 +00:00
chs 94a458cedd enhance MI pthreads code to support hppa:
- statically initialize all global spin locks.  on hppa, 0 means
   the lock is held, so leaving them with the default value doesn't work.
 - compare functions pointers using a function-pointer type rather than
   an integral type.  on hppa, function pointers may be indirect,
   so we need to trigger gcc to emit calls to the function-pointer
   canonicalization routines in the millicode.
 - on hppa the stack grows up, so handle that using the STACK_* macros.
2004-07-18 21:24:52 +00:00
lha 8b387b156a Fix a problem where pthread_kill can set a signal while the process
have the signal blocked, this ends up making target thread getting
later stuck in a loop if it uses pthread_sigmask.

ok, cl and christos
2004-03-24 20:01:37 +00:00
cl f35871411a make siglongjmp out of a signal handler work:
- strong alias __sigprocmask14 to pthread_sigmask
- call _sys___sigprocmask14 where appropriate
- make pthread_sigmask not set the signal mask lazily when pthreads
  aren't started yet
2004-01-02 19:24:44 +00:00
cl 82b6b2dbda Handle block/unblock for threads in critical section without
sa_unblockyield.

XXX g/c sa_unblockyield in kernel later
2003-12-31 16:45:48 +00:00
cl 11127744bf Save the old mask in the old context, not in the new one. 2003-11-25 23:55:27 +00:00
cl d109665f1d Honor SA_NODEFER in pthread__deliver_signal(). This should help code which
makes a longjmp out of a signal handler.

Also add missing si_code argument to debugging printf in pthread__kill().
2003-11-25 22:45:33 +00:00
christos 5077d05f7b GC sigcontext<->mcontext code and __HAVE_SIGINFO. All supported archs have
siginfo implemented.
2003-11-25 22:36:32 +00:00
christos 69658517e0 - don't store sigmask on the stack, we could store it in the right place
[in the context]
- this has the side effect of fixing the problem of the signal mask not
  being preserved properly upon signal return, found and fixed by cl.
- add si_code to the tramp debugging output (requested by cl).
2003-11-25 22:26:44 +00:00
uwe 4b13bb93a0 Follow-up to previous. In pthread__signal_tramp() maskp is below
siginfo on the stack, so get it from there.  ss_sp no longer points to
the the mask.  Pointed out by cl@.
2003-11-20 17:45:00 +00:00
uwe f5cd7f26ed Undo previous. In pthread__deliver_signal set uc->uc_stack.ss_sp = uc;
(as it used to be before 1.1.2.12) so that makecontext doesn't stomp
on the data we allocated on the stack.  Correct the debugging printf
to print olduc instead of target->pt_uc (we have pt_trapuc now, and
olduc can be pt_trapuc).
2003-11-20 17:16:41 +00:00
yamt d7b65981fb pthread__deliver_signal: swap oldmask and siginfo so that signal
handler's stack doesn't stomp siginfo.
this also fixes !__HAVE_SIGINFO, in that case
pthread__signal_tramp assumes uc->uc_stack.ss_sp points the old
signal mask.

pointed by uwe@.
2003-11-20 15:46:42 +00:00
christos 38b1c6f405 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.
2003-11-09 18:56:48 +00:00
yamt 5cd18e71cc in pthread__deliver_signal(),
copy siginfo_t into the stack of the target thread
rather than relying on the luck that on-stack siginfo_t stay valid.
2003-10-16 13:38:28 +00:00
christos 86d645082f fix syntax; thanks aymeric 2003-09-13 17:19:55 +00:00
christos d1bb4290e8 explicitly use a sigset_t * variable to recover the signal mask pointer. 2003-09-13 15:26:38 +00:00
drochner 45a9abb6af make it compile with PTHREAD_SIG_DEBUG again 2003-09-12 15:31:00 +00:00
kleink 8742dcef75 Fix pasto in previous. 2003-09-12 10:10:39 +00:00
christos 138df80b74 convert to use siginfo/ucontext style of signal delivery instead of
sigcontext. Approved by nathanw.
2003-09-12 00:37:17 +00:00
nathanw e1fb9dd8e8 In pthread__deliver_signal(), correctly use pt_trapuc or pt_uc as the
context-to-restore instead of always using pt_uc.

Fixes a problem with signal handlers for synchronous signals noted by
Matthias Drochner on current-users.
2003-08-22 17:35:52 +00:00
nathanw 0878df5d25 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.
2003-07-21 22:24:09 +00:00
fvdl 2949ab0051 Take the normal return path in sigtimedwait when the current thread was
canceled as well. From Stephan Uphoff.
2003-07-17 18:15:21 +00:00
christos 143f5a277a 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.
2003-05-27 15:24:24 +00:00
nathanw a0628261fe Use pthread__assert() instead of plain assert(), as the latter has
locking issues.
2003-03-20 01:03:52 +00:00
nathanw a25b9285d9 Add a wrapper for the execve() system call that arranges for the current
thread sigal mask to be propagated into the new process image.
2003-03-14 22:27:34 +00:00
lukem f043c0fb57 add __RCSID() 2003-03-08 08:03:34 +00:00
lha c2d825cbda If pthreads hasn't started yet when calling sigsuspend, use the systemcall 2003-02-28 17:30:07 +00:00
jdolecek e6781abf3f interposition sigtimedwait() with a thread-aware version, which uses
single proxy thread to do the actual syscall, and blocks other threads
in userland
2003-02-15 21:18:59 +00:00
nathanw 6adb81d685 Move debug toggle to pthread_debug.h. 2003-02-15 04:38:58 +00:00
nathanw f66d2f37f7 More rototilling:
* Implement pthread_kill().

  * Return the old thread mask, not the old process mask, in our
    interpositioned sigaction call.

  * Refer to _NSIG, not NSIG.

  * Gut pthread_sigmask(). It was handling a lot of corner cases that
    weren't legal anyway. Handle unblocked signals with a new
    pthread__kill_self() routine (also used by pthread_kill()).

  * Be more consistent with locking around pt_sigacts[].
2003-01-30 01:12:42 +00:00
jdolecek 5e8bddc2e7 __sigaction14(): sanity check 'sig' before use, same way as sigaction1()
in kernel
2003-01-28 21:04:37 +00:00
nathanw fe8e8dad4a More signal rearranging:
- Signal handlers now simply continue executing the current thread,
   rather than trying to put themselves back on the queue that they came
   from, which was rather fragile. As a result, all callers of
   pthread__block() must be prepared to handle spurious wakeups.

 - When a signal arrives for a thread that is blocked in the kernel,
   note this in another field in pthread_st and set a flag. Process the
   signal and set up the trampoline for the handler *after* the thread
   unblocks, so that both the trampoline and the returned state from
   the kernel are preserved.

 - Factor out some code into a pthread__deliver_signal() routine;
   the signal-taking code in pthread_sigmask() should be able to use this
   soon.

This is still gross, and there are still some terrible MP issues lurking here,
but progress crawls along.
2003-01-25 00:43:38 +00:00
jdolecek 254ff213ae unlock pt_statelock _after_ changing pt_state, not before
problem found and fix suggested by Nick Hudson
2003-01-24 17:43:45 +00:00
christos 9631ace572 de-lint 2003-01-18 18:40:52 +00:00
thorpej c62a74e6d5 Merge the nathanw_sa branch. 2003-01-18 10:32:11 +00:00