All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Stefan Weil <weil@mail.berlios.de>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	qemu-devel@nongnu.org, Arnaud Patard <arnaud.patard@rtp-net.org>
Subject: Re: [Qemu-devel] [PATCH 1/5] linux-user: remove hardcoded value of _NSIG in signal.c
Date: Fri, 23 Oct 2009 17:21:50 +0200	[thread overview]
Message-ID: <4AE1CA0E.1070408@aurel32.net> (raw)
In-Reply-To: <4AE1C7C4.2070805@mail.berlios.de>

Stefan Weil a écrit :
> Aurelien Jarno schrieb:
>> From: Arnaud Patard <arnaud.patard@rtp-net.org>
>>
>> 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 <arnaud.patard@rtp-net.org>
>> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>> ---
>>  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]
> 

>From /usr/include/bits/signum.h:
#define   _NSIG           65      /* Biggest signal number + 1

I confirm that all use of _NSIG of them should be decremented by one.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

      reply	other threads:[~2009-10-23 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22 20:17 [Qemu-devel] [PATCH 0/5] MIPS(EL) host support Aurelien Jarno
2009-10-22 19:31 ` [Qemu-devel] [PATCH 5/5] tcg/mips: use direct jumps Aurelien Jarno
2009-10-22 20:17 ` [Qemu-devel] [PATCH 2/5] cpu-all.h: fix cpu_get_real_ticks on mips host Aurelien Jarno
2009-10-22 20:17 ` [Qemu-devel] [PATCH 4/5] tcg: increase TCG_MAX_OP_SIZE to 192 Aurelien Jarno
2009-10-22 20:17 ` [Qemu-devel] [PATCH 3/5] tcg: initial mips support Aurelien Jarno
2009-10-22 20:17 ` [Qemu-devel] [PATCH 1/5] linux-user: remove hardcoded value of _NSIG in signal.c Aurelien Jarno
2009-10-23 15:12   ` Stefan Weil
2009-10-23 15:21     ` Aurelien Jarno [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE1CA0E.1070408@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=arnaud.patard@rtp-net.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=weil@mail.berlios.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.