From: Riku Voipio <riku.voipio@iki.fi>
To: Natanael Copa <ncopa@alpinelinux.org>
Cc: qemu-devel@nongnu.org
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 [thread overview]
Message-ID: <20140606082705.GA28984@afflict.kos.to> (raw)
In-Reply-To: <1401868140-20928-1-git-send-email-ncopa@alpinelinux.org>
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 <ncopa@alpinelinux.org>
> ---
> 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
>
next prev parent reply other threads:[~2014-06-06 8:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1398781051-16207-1-git-send-email-ncopa@alpinelinux.org>
[not found] ` <1398781051-16207-6-git-send-email-ncopa@alpinelinux.org>
[not found] ` <535FB70D.5070304@redhat.com>
[not found] ` <20140429165358.45c092a0@ncopa-desktop.alpinelinux.org>
[not found] ` <535FBEF5.5070001@redhat.com>
[not found] ` <20140429220631.732ed7c3@ncopa-laptop>
2014-05-02 12:43 ` [Qemu-devel] [PATCH 5/5] linux-user/signal.c: define __SIGRTMIN/MAX for non-GNU platforms Riku Voipio
2014-06-04 7:49 ` [Qemu-devel] [PATCH v2] " Natanael Copa
2014-06-06 8:27 ` Riku Voipio [this message]
2014-06-06 9:48 ` Paolo Bonzini
2014-05-02 13:06 ` [Qemu-devel] [PATCH 0/5] fix building with musl libc Paolo Bonzini
2014-06-03 23:37 ` Peter Maydell
2014-06-04 5:56 ` Natanael Copa
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=20140606082705.GA28984@afflict.kos.to \
--to=riku.voipio@iki.fi \
--cc=ncopa@alpinelinux.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).