[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2] linux-user/signal.c: define __SIGRTMIN/MAX for n
From: |
Natanael Copa |
Subject: |
[Qemu-devel] [PATCH v2] linux-user/signal.c: define __SIGRTMIN/MAX for non-GNU platforms |
Date: |
Wed, 4 Jun 2014 09:49:00 +0200 |
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.
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
- [Qemu-devel] [PATCH v2] linux-user/signal.c: define __SIGRTMIN/MAX for non-GNU platforms,
Natanael Copa <=