qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] linux-user/signal.c: define __SIGRTMIN/MAX f


From: Riku Voipio
Subject: Re: [Qemu-devel] [PATCH v2] linux-user/signal.c: define __SIGRTMIN/MAX for non-GNU platforms
Date: Fri, 6 Jun 2014 11:27:05 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Wed, Jun 04, 2014 at 09:49:00AM +0200, Natanael Copa wrote:
> The __SIGRTMIN and __SIGRTMAX are glibc internals and are not available
> on all platforms, so we define those if they are missing. We also check
> that those corresponds with the posix variables SIGRTMIN/SIGRTMAX which
> may only be available during runtime.
> 
> This is needed for musl libc.

After all, the idea of asserts doesn't work on glibc it seems:

qemu-arm qemu-smoke/armel/busybox ls -ld .
qemu-arm: linux-user/signal.c:393: signal_init: Assertion `32 == 
(__libc_current_sigrtmin ())' failed.
Aborted

Quick test on my amd64/glibc 2.18 system:

printf("RTMIN: %d RTMAX: %d\n", SIGRTMIN, SIGRTMAX);
RTMIN: 34 RTMAX: 64

While: /usr/include/bits/signum.h
#define __SIGRTMIN  32


> Signed-off-by: Natanael Copa <address@hidden>
> ---
> Changes v1 -> v2:
>  - replace NSIG with _NSIG since thats use everywhere else in the code.
>  - add runtime asserts.
> 
>  linux-user/signal.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 5b8a01f..67771ad 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -32,6 +32,13 @@
>  
>  //#define DEBUG_SIGNAL
>  
> +#ifndef __SIGRTMIN
> +#define __SIGRTMIN 32
> +#endif
> +#ifndef __SIGRTMAX
> +#define __SIGRTMAX (_NSIG-1)
> +#endif
> +
>  static struct target_sigaltstack target_sigaltstack_used = {
>      .ss_sp = 0,
>      .ss_size = 0,
> @@ -379,6 +386,13 @@ void signal_init(void)
>      int i, j;
>      int host_sig;
>  
> +    /* SIGRTMIN/SIGRTMAX might be runtime variables so we cannot use them
> +       to declare the host_to_target_signal table. But we are interacting
> +       with a given kernel where the values will be fixed. Check that the
> +       runtime values actually corresponds. */
> +    assert(__SIGRTMIN == SIGRTMIN);
> +    assert(__SIGRTMAX == SIGRTMAX);
> +
>      /* generate signal conversion tables */
>      for(i = 1; i < _NSIG; i++) {
>          if (host_to_target_signal_table[i] == 0)
> -- 
> 2.0.0
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]