mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
7fb5ef350b
commit
0a99f09383
3 changed files with 66 additions and 23 deletions
|
@ -1199,3 +1199,26 @@ void process_pending_signals(CPUArchState *cpu_env)
|
|||
}
|
||||
ts->in_sigsuspend = 0;
|
||||
}
|
||||
|
||||
int process_sigsuspend_mask(sigset_t **pset, target_ulong sigset,
|
||||
target_ulong sigsize)
|
||||
{
|
||||
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
||||
sigset_t *host_set = &ts->sigsuspend_mask;
|
||||
target_sigset_t *target_sigset;
|
||||
|
||||
if (sigsize != sizeof(*target_sigset)) {
|
||||
/* Like the kernel, we enforce correct size sigsets */
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
|
||||
target_sigset = lock_user(VERIFY_READ, sigset, sigsize, 1);
|
||||
if (!target_sigset) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
target_to_host_sigset(host_set, target_sigset);
|
||||
unlock_user(target_sigset, sigset, 0);
|
||||
|
||||
*pset = host_set;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue