diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2022-03-15 01:43:05 -0700 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2022-03-22 13:06:21 +0100 |
commit | 0a99f09383a0f08e5b7cd0c187166f7eff6014ad (patch) | |
tree | 2abdbdbe06597f322edc415cf59e6a05d45f835c /linux-user/signal-common.h | |
parent | 7fb5ef350bb434644fe1ac8eeb973543e017c932 (diff) |
linux-user: Split out helpers for sigsuspend
Two new functions: process_sigsuspend_mask and finish_sigsuspend_mask.
Move the size check and copy-from-user code.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220315084308.433109-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/signal-common.h')
-rw-r--r-- | linux-user/signal-common.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 2113165a75..6a7e4a93fc 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -92,4 +92,30 @@ abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx, */ int block_signals(void); /* Returns non zero if signal pending */ +/** + * process_sigsuspend_mask: read and apply syscall-local signal mask + * + * Read the guest signal mask from @sigset, length @sigsize. + * Convert that to a host signal mask and save it to sigpending_mask. + * + * Return value: negative target errno, or zero; + * store &sigpending_mask into *pset on success. + */ +int process_sigsuspend_mask(sigset_t **pset, target_ulong sigset, + target_ulong sigsize); + +/** + * finish_sigsuspend_mask: finish a sigsuspend-like syscall + * + * Set in_sigsuspend if we need to use the modified sigset + * during process_pending_signals. + */ +static inline void finish_sigsuspend_mask(int ret) +{ + if (ret != -QEMU_ERESTARTSYS) { + TaskState *ts = (TaskState *)thread_cpu->opaque; + ts->in_sigsuspend = 1; + } +} + #endif |