linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] [patch 1/1] add-SIGPROF-get-set_signals
@ 2004-09-13 18:13 blaisorblade_spam
  2004-09-13 22:34 ` [uml-devel] " Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: blaisorblade_spam @ 2004-09-13 18:13 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 |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 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-09-12 18:04:27.000000000 +0200
+++ uml-linux-2.6.8.1-paolo/arch/um/kernel/signal_user.c	2004-09-13 20:12:58.544305736 +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,18 +110,25 @@ 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;
 	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(enable & (1 << SIGPROF_BIT))
+		sigaddset(&mask, SIGPROF);
+	/* This is safe - sigprocmask is a syscall, so it must copy locally the
+	 * value of new_set, do his work and then, at the end, write to
+	 * old_set.*/
 	if(sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0)
 		panic("Failed to enable signals");
 	ret = enable_mask(&mask);
_


-------------------------------------------------------
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] 2+ messages in thread

* [uml-devel] Re: [patch 1/1] add-SIGPROF-get-set_signals
  2004-09-13 18:13 [uml-devel] [patch 1/1] add-SIGPROF-get-set_signals blaisorblade_spam
@ 2004-09-13 22:34 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2004-09-13 22:34 UTC (permalink / raw)
  To: blaisorblade_spam; +Cc: user-mode-linux-devel

blaisorblade_spam@yahoo.it said:
> 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. 

Applied with some minor rewording of the comment, thanks.

				Jeff



-------------------------------------------------------
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] 2+ messages in thread

end of thread, other threads:[~2004-09-13 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-13 18:13 [uml-devel] [patch 1/1] add-SIGPROF-get-set_signals blaisorblade_spam
2004-09-13 22:34 ` [uml-devel] " Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox