linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] sigfix-2.5.40-B1
@ 2002-10-02 16:39 Ingo Molnar
  0 siblings, 0 replies; only message in thread
From: Ingo Molnar @ 2002-10-02 16:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel


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);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-02 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-02 16:39 [patch] sigfix-2.5.40-B1 Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).