All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [patch 2/2] add-SIGPROF-get-set_signals
@ 2004-09-12 18:26 blaisorblade_spam
  2004-09-13  3:32 ` [uml-devel] " Jeff Dike
  0 siblings, 1 reply; 7+ messages in thread
From: blaisorblade_spam @ 2004-09-12 18:26 UTC (permalink / raw)
  To: jdike; +Cc: user-mode-linux-devel, blaisorblade_spam


Since local_irq_save() and local_irq_disable() should match (apart from saving the
flags), [gs]et_signals must match [un]block_signals, i.e. they must act onto
SIGPROF, too. At least IMHO.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
---

 uml-linux-2.6.8.1-paolo/arch/um/kernel/signal_user.c |   20 +++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff -puN arch/um/kernel/signal_user.c~uml-add-SIGPROF-get-set_signals arch/um/kernel/signal_user.c
--- uml-linux-2.6.8.1/arch/um/kernel/signal_user.c~uml-add-SIGPROF-get-set_signals	2004-08-29 14:40:54.102986872 +0200
+++ uml-linux-2.6.8.1-paolo/arch/um/kernel/signal_user.c	2004-08-29 14:40:54.104986568 +0200
@@ -83,14 +83,21 @@ void unblock_signals(void)
 
 #define SIGIO_BIT 0
 #define SIGVTALRM_BIT 1
+#define SIGPROF_BIT 2
 
-static int enable_mask(sigset_t *mask)
+/*
+ * Inverts the signal mask:
+ * @mask: a sigset_t* point to the mask of blocked signals.
+ * Returns a mask (of different type) of *unblocked* signals.
+ */
+static inline int enable_mask(const sigset_t *mask)
 {
 	int sigs;
 
 	sigs = sigismember(mask, SIGIO) ? 0 : 1 << SIGIO_BIT;
 	sigs |= sigismember(mask, SIGVTALRM) ? 0 : 1 << SIGVTALRM_BIT;
 	sigs |= sigismember(mask, SIGALRM) ? 0 : 1 << SIGVTALRM_BIT;
+	sigs |= sigismember(mask, SIGPROF) ? 0 : 1 << SIGPROF_BIT;
 	return(sigs);
 }
 
@@ -103,21 +110,26 @@ int get_signals(void)
 	return(enable_mask(&mask));
 }
 
+/*Returns the old mask of the old active signals (not sigset_t, but
+ * suitable for set_signals.*/
 int set_signals(int enable)
 {
 	sigset_t mask;
+	sigset_t old_mask;
 	int ret;
 
 	sigemptyset(&mask);
-	if(enable & (1 << SIGIO_BIT)) 
+	if(enable & (1 << SIGIO_BIT))
 		sigaddset(&mask, SIGIO);
 	if(enable & (1 << SIGVTALRM_BIT)){
 		sigaddset(&mask, SIGVTALRM);
 		sigaddset(&mask, SIGALRM);
 	}
-	if(sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0)
+	if(enable & (1 << SIGPROF_BIT))
+		sigaddset(&mask, SIGPROF);
+	if(sigprocmask(SIG_UNBLOCK, &mask, &old_mask) < 0)
 		panic("Failed to enable signals");
-	ret = enable_mask(&mask);
+	ret = enable_mask(&old_mask);
 	sigemptyset(&mask);
 	if((enable & (1 << SIGIO_BIT)) == 0) 
 		sigaddset(&mask, SIGIO);
_


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-17 23:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-12 18:26 [uml-devel] [patch 2/2] add-SIGPROF-get-set_signals blaisorblade_spam
2004-09-13  3:32 ` [uml-devel] " Jeff Dike
2004-09-13 18:12   ` BlaisorBlade
2004-09-13 22:15     ` Jeff Dike
2004-09-14 19:26     ` Jeff Dike
2004-09-17 18:52       ` BlaisorBlade
2004-09-18  0:45         ` Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.