2002-10-02 16:24:10

by Ingo Molnar

[permalink] [raw]
Subject: [patch] sigfix-2.5.40-B1


this patch (ontop of the previous signal patch) fixes one more
thread-signals testcase. POSIX treats threads in sigwait() as a special
thing - eg. the 'action' of a signal must not be considered for a thread
that is in sigwait(). Ie. if no handler is defined and the only thread
accepting a given signal is one in sigwait(), then the signal must be
queued to that signal.

this should fix Axel Zeuner's sigwait() testcase.

Ingo

--- linux/include/linux/sched.h.orig Wed Oct 2 18:10:24 2002
+++ linux/include/linux/sched.h Wed Oct 2 18:12:14 2002
@@ -430,6 +430,7 @@
#define PF_FROZEN 0x00040000 /* frozen for system suspend */
#define PF_SYNC 0x00080000 /* performing fsync(), etc */
#define PF_FSTRANS 0x00100000 /* inside a filesystem transaction */
+#define PF_SIGWAIT 0x00200000 /* inside sigwait */

/*
* Ptrace flags
--- linux/kernel/signal.c.orig Wed Oct 2 18:08:39 2002
+++ linux/kernel/signal.c Wed Oct 2 18:14:05 2002
@@ -886,6 +886,10 @@
ret = specific_send_sig_info(sig, info, p, 1);
goto out_unlock;
}
+ if (t->flags & PF_SIGWAIT) {
+ ret = specific_send_sig_info(sig, info, t, 0);
+ goto out_unlock;
+ }
if (sig_kernel_broadcast(sig) || sig_kernel_coredump(sig)) {
ret = __broadcast_thread_group(p, sig);
goto out_unlock;
@@ -1485,12 +1489,14 @@

sigandsets(&current->blocked, &current->blocked, &these);
recalc_sigpending();
+ current->flags |= PF_SIGWAIT;
spin_unlock_irq(&current->sig->siglock);

current->state = TASK_INTERRUPTIBLE;
timeout = schedule_timeout(timeout);

spin_lock_irq(&current->sig->siglock);
+ current->flags &= ~PF_SIGWAIT;
sig = dequeue_signal(&current->sig->shared_pending, &these, &info);
if (!sig)
sig = dequeue_signal(&current->pending, &these, &info);