diff options
author | Laurent Vivier <laurent@vivier.eu> | 2018-04-24 21:26:16 +0200 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2018-04-30 09:47:47 +0200 |
commit | befb7447a08744ea74ed1a73a03541762d9016aa (patch) | |
tree | b2c3817e5be34147807e91b91cdfac444f5415e3 /linux-user/signal-common.h | |
parent | 2b3f64cbf3e00f5042d120b4c23ed66078431f8c (diff) |
linux-user: create a dummy per arch signal.c
Create a signal-common.h for future use by these new files
and use it in the existing signal.c
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180424192635.6027-2-laurent@vivier.eu>
Diffstat (limited to 'linux-user/signal-common.h')
-rw-r--r-- | linux-user/signal-common.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h new file mode 100644 index 0000000000..838b6e9198 --- /dev/null +++ b/linux-user/signal-common.h @@ -0,0 +1,50 @@ +/* + * Emulation of Linux signals + * + * Copyright (c) 2003 Fabrice Bellard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGNAL_COMMON_H +#define SIGNAL_COMMON_H +extern struct target_sigaltstack target_sigaltstack_used; + +static inline int on_sig_stack(unsigned long sp) +{ + return (sp - target_sigaltstack_used.ss_sp + < target_sigaltstack_used.ss_size); +} + +static inline int sas_ss_flags(unsigned long sp) +{ + return (target_sigaltstack_used.ss_size == 0 ? SS_DISABLE + : on_sig_stack(sp) ? SS_ONSTACK : 0); +} + +static inline void target_sigemptyset(target_sigset_t *set) +{ + memset(set, 0, sizeof(*set)); +} + +void host_to_target_sigset_internal(target_sigset_t *d, + const sigset_t *s); +void target_to_host_sigset_internal(sigset_t *d, + const target_sigset_t *s); +void tswap_siginfo(target_siginfo_t *tinfo, + const target_siginfo_t *info); +void set_sigmask(const sigset_t *set); +void force_sig(int sig); +void force_sigsegv(int oldsig); +#endif |