From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N1LoP-00067r-CZ for qemu-devel@nongnu.org; Fri, 23 Oct 2009 11:12:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N1LoM-00065R-13 for qemu-devel@nongnu.org; Fri, 23 Oct 2009 11:12:16 -0400 Received: from [199.232.76.173] (port=57186 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N1LoJ-00065C-16 for qemu-devel@nongnu.org; Fri, 23 Oct 2009 11:12:11 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:60897) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N1LoI-0007aQ-EQ for qemu-devel@nongnu.org; Fri, 23 Oct 2009 11:12:10 -0400 Message-ID: <4AE1C7C4.2070805@mail.berlios.de> Date: Fri, 23 Oct 2009 17:12:04 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/5] linux-user: remove hardcoded value of _NSIG in signal.c References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: Riku Voipio , qemu-devel@nongnu.org, Arnaud Patard Aurelien Jarno schrieb: > From: Arnaud Patard > > In a bunch of places, 64 is used as value of _NSIG but it's wrong > at least on MIPS were _NSIG is 128. > > Signed-off-by: Arnaud Patard > Signed-off-by: Aurelien Jarno > --- > linux-user/signal.c | 12 ++++++------ > 1 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/linux-user/signal.c b/linux-user/signal.c > index 2df17aa..6620ce3 100644 > --- a/linux-user/signal.c > +++ b/linux-user/signal.c > @@ -44,7 +44,7 @@ static struct target_sigaction sigact_table[TARGET_NSIG]; > static void host_signal_handler(int host_signum, siginfo_t *info, > void *puc); > > -static uint8_t host_to_target_signal_table[65] = { > +static uint8_t host_to_target_signal_table[_NSIG+1] = { > [SIGHUP] = TARGET_SIGHUP, > [SIGINT] = TARGET_SIGINT, > [SIGQUIT] = TARGET_SIGQUIT, > @@ -87,7 +87,7 @@ static uint8_t host_to_target_signal_table[65] = { > [__SIGRTMIN] = __SIGRTMAX, > [__SIGRTMAX] = __SIGRTMIN, > }; > -static uint8_t target_to_host_signal_table[65]; > +static uint8_t target_to_host_signal_table[_NSIG+1]; > > static inline int on_sig_stack(unsigned long sp) > { > @@ -103,14 +103,14 @@ static inline int sas_ss_flags(unsigned long sp) > > int host_to_target_signal(int sig) > { > - if (sig > 64) > + if (sig > _NSIG) > return sig; > return host_to_target_signal_table[sig]; > } > > int target_to_host_signal(int sig) > { > - if (sig > 64) > + if (sig > _NSIG) > return sig; > return target_to_host_signal_table[sig]; > } > @@ -311,11 +311,11 @@ void signal_init(void) > int host_sig; > > /* generate signal conversion tables */ > - for(i = 1; i <= 64; i++) { > + for(i = 1; i <= _NSIG; i++) { > if (host_to_target_signal_table[i] == 0) > host_to_target_signal_table[i] = i; > } > - for(i = 1; i <= 64; i++) { > + for(i = 1; i <= _NSIG; i++) { > j = host_to_target_signal_table[i]; > target_to_host_signal_table[j] = i; > } > At least in my linux installation, _NSIG is 65 (x86) or 128 (mips), so the patch above should replace 64 by (_NSIG - 1) and 65 by _NSIG. But perhaps it does no harm if the code allocates an unused signal at the end. For my tests with mips host and tci, I used static uint8_t target_to_host_signal_table[_NSIG] Regards, Stefan