Commit 4cb05961c2d637d2cad237755e544d725a941b9a
1 parent
f8ed7070
Perform target->host signal mapping for *kill syscalls.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4625 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
10 additions
and
4 deletions
linux-user/qemu.h
... | ... | @@ -187,6 +187,7 @@ void signal_init(void); |
187 | 187 | int queue_signal(int sig, target_siginfo_t *info); |
188 | 188 | void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); |
189 | 189 | void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); |
190 | +int target_to_host_signal(int sig); | |
190 | 191 | long do_sigreturn(CPUState *env); |
191 | 192 | long do_rt_sigreturn(CPUState *env); |
192 | 193 | abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp); | ... | ... |
linux-user/signal.c
... | ... | @@ -113,11 +113,15 @@ static inline int sas_ss_flags(unsigned long sp) |
113 | 113 | |
114 | 114 | static inline int host_to_target_signal(int sig) |
115 | 115 | { |
116 | + if (sig > 64) | |
117 | + return sig; | |
116 | 118 | return host_to_target_signal_table[sig]; |
117 | 119 | } |
118 | 120 | |
119 | -static inline int target_to_host_signal(int sig) | |
121 | +int target_to_host_signal(int sig) | |
120 | 122 | { |
123 | + if (sig > 64) | |
124 | + return sig; | |
121 | 125 | return target_to_host_signal_table[sig]; |
122 | 126 | } |
123 | 127 | ... | ... |
linux-user/syscall.c
... | ... | @@ -3488,7 +3488,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, |
3488 | 3488 | ret = 0; |
3489 | 3489 | break; |
3490 | 3490 | case TARGET_NR_kill: |
3491 | - ret = get_errno(kill(arg1, arg2)); | |
3491 | + ret = get_errno(kill(arg1, target_to_host_signal(arg2))); | |
3492 | 3492 | break; |
3493 | 3493 | case TARGET_NR_rename: |
3494 | 3494 | { |
... | ... | @@ -5583,13 +5583,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, |
5583 | 5583 | |
5584 | 5584 | #if defined(TARGET_NR_tkill) && defined(__NR_tkill) |
5585 | 5585 | case TARGET_NR_tkill: |
5586 | - ret = get_errno(sys_tkill((int)arg1, (int)arg2)); | |
5586 | + ret = get_errno(sys_tkill((int)arg1, target_to_host_signal(arg2))); | |
5587 | 5587 | break; |
5588 | 5588 | #endif |
5589 | 5589 | |
5590 | 5590 | #if defined(TARGET_NR_tgkill) && defined(__NR_tgkill) |
5591 | 5591 | case TARGET_NR_tgkill: |
5592 | - ret = get_errno(sys_tgkill((int)arg1, (int)arg2, (int)arg3)); | |
5592 | + ret = get_errno(sys_tgkill((int)arg1, (int)arg2, | |
5593 | + target_to_host_signal(arg3))); | |
5593 | 5594 | break; |
5594 | 5595 | #endif |
5595 | 5596 | ... | ... |