aboutsummaryrefslogtreecommitdiff
path: root/linux-user/signal.c
diff options
context:
space:
mode:
authorTimothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>2016-05-27 15:51:52 +0100
committerRiku Voipio <riku.voipio@linaro.org>2016-06-07 16:39:07 +0300
commit907f5fddaa673ac3f6dc955df6eac2870e3603f4 (patch)
tree0f4efd98a08fda6fea76aa7c15b3b6ee83f66723 /linux-user/signal.c
parent8fdb9fef3d63b5e245a496e4999ebb599b9b9496 (diff)
downloadqemu-arm-907f5fddaa673ac3f6dc955df6eac2870e3603f4.tar.gz
linux-user: Remove real-time signal queuing
As host signals are now blocked whenever guest signals are blocked, the queue of realtime signals is now in Linux. The QEMU queue is now redundant and can be removed. (We already did not queue non-RT signals, and none of the calls to queue_signal() except the one in host_signal_handler() pass an RT signal number.) Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk> Message-id: 1441497448-32489-23-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: minor commit message tweak] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r--linux-user/signal.c70
1 files changed, 13 insertions, 57 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 2c6790d872..5db1c0b87b 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -441,27 +441,6 @@ void signal_init(void)
}
}
-/* signal queue handling */
-
-static inline struct sigqueue *alloc_sigqueue(CPUArchState *env)
-{
- CPUState *cpu = ENV_GET_CPU(env);
- TaskState *ts = cpu->opaque;
- struct sigqueue *q = ts->first_free;
- if (!q)
- return NULL;
- ts->first_free = q->next;
- return q;
-}
-
-static inline void free_sigqueue(CPUArchState *env, struct sigqueue *q)
-{
- CPUState *cpu = ENV_GET_CPU(env);
- TaskState *ts = cpu->opaque;
-
- q->next = ts->first_free;
- ts->first_free = q;
-}
/* abort execution with signal */
static void QEMU_NORETURN force_sig(int target_sig)
@@ -524,37 +503,20 @@ int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
CPUState *cpu = ENV_GET_CPU(env);
TaskState *ts = cpu->opaque;
struct emulated_sigtable *k;
- struct sigqueue *q, **pq;
trace_user_queue_signal(env, sig);
k = &ts->sigtab[sig - 1];
- pq = &k->first;
- if (sig < TARGET_SIGRTMIN) {
- /* if non real time signal, we queue exactly one signal */
- if (!k->pending)
- q = &k->info;
- else
- return 0;
- } else {
- if (!k->pending) {
- /* first signal */
- q = &k->info;
- } else {
- q = alloc_sigqueue(env);
- if (!q)
- return -EAGAIN;
- while (*pq != NULL)
- pq = &(*pq)->next;
- }
- }
- *pq = q;
- q->info = *info;
- q->next = NULL;
- k->pending = 1;
- /* signal that a new signal is pending */
- atomic_set(&ts->signal_pending, 1);
- return 1; /* indicates that the signal was queued */
+ /* we queue exactly one signal */
+ if (k->pending) {
+ return 0;
+ }
+
+ k->info = *info;
+ k->pending = 1;
+ /* signal that a new signal is pending */
+ atomic_set(&ts->signal_pending, 1);
+ return 1; /* indicates that the signal was queued */
}
#ifndef HAVE_SAFE_SYSCALL
@@ -5783,16 +5745,12 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig)
sigset_t set;
target_sigset_t target_old_set;
struct target_sigaction *sa;
- struct sigqueue *q;
TaskState *ts = cpu->opaque;
struct emulated_sigtable *k = &ts->sigtab[sig - 1];
trace_user_handle_signal(cpu_env, sig);
/* dequeue signal */
- q = k->first;
- k->first = q->next;
- if (!k->first)
- k->pending = 0;
+ k->pending = 0;
sig = gdb_handlesig(cpu, sig);
if (!sig) {
@@ -5857,10 +5815,10 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig)
#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) \
|| defined(TARGET_OPENRISC) || defined(TARGET_TILEGX)
/* These targets do not have traditional signals. */
- setup_rt_frame(sig, sa, &q->info, &target_old_set, cpu_env);
+ setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env);
#else
if (sa->sa_flags & TARGET_SA_SIGINFO)
- setup_rt_frame(sig, sa, &q->info, &target_old_set, cpu_env);
+ setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env);
else
setup_frame(sig, sa, &target_old_set, cpu_env);
#endif
@@ -5868,8 +5826,6 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig)
sa->_sa_handler = TARGET_SIG_DFL;
}
}
- if (q != &k->info)
- free_sigqueue(cpu_env, q);
}
void process_pending_signals(CPUArchState *cpu_env)