Module: xenomai-jki Branch: for-forge Commit: 45461b6d137898a4cdf62fb7d38687870adfb75d URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=45461b6d137898a4cdf62fb7d38687870adfb75d
Author: Jan Kiszka <jan.kis...@siemens.com> Date: Tue Mar 7 18:23:20 2017 +0100 kernel/cobalt/posix: Convert put_siginfo callback into boolean We want to pass the information "compat invocation" to the extension signal_copyinfo as well and therefore need it in boolean form. To avoid unneeded conversions, pass it as bool from the source to the sink. Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- kernel/cobalt/posix/signal.c | 31 ++++++++++++++----------------- kernel/cobalt/posix/signal.h | 8 ++------ kernel/cobalt/posix/syscall32.c | 4 ++-- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/kernel/cobalt/posix/signal.c b/kernel/cobalt/posix/signal.c index 0281cb5..11e128f 100644 --- a/kernel/cobalt/posix/signal.c +++ b/kernel/cobalt/posix/signal.c @@ -17,6 +17,7 @@ */ #include <linux/sched.h> #include <cobalt/kernel/assert.h> +#include <cobalt/kernel/compat.h> #include "internal.h" #include "signal.h" #include "thread.h" @@ -238,10 +239,7 @@ static int signal_put_siginfo(void __user *u_si, const struct siginfo *si, } static int signal_wait(sigset_t *set, xnticks_t timeout, - void __user *u_si, - int (*put_siginfo)(void __user *u_si, - const struct siginfo *si, - int overrun)) + void __user *u_si, bool compat) { struct cobalt_sigpending *sigp = NULL; struct cobalt_sigwait_context swc; @@ -343,7 +341,10 @@ done: if (u_si == NULL) goto out; /* Return signo only. */ - ret = put_siginfo(u_si, sip, overrun); + if (compat) + ret = sys32_put_siginfo(u_si, sip, overrun); + else + ret = signal_put_siginfo(u_si, sip, overrun); if (ret) goto out; @@ -373,7 +374,7 @@ fail: int __cobalt_sigwait(sigset_t *set) { - return signal_wait(set, XN_INFINITE, NULL, NULL); + return signal_wait(set, XN_INFINITE, NULL, false); } COBALT_SYSCALL(sigwait, primary, @@ -385,7 +386,7 @@ COBALT_SYSCALL(sigwait, primary, if (cobalt_copy_from_user(&set, u_set, sizeof(set))) return -EFAULT; - sig = signal_wait(&set, XN_INFINITE, NULL, NULL); + sig = signal_wait(&set, XN_INFINITE, NULL, false); if (sig < 0) return sig; @@ -395,9 +396,7 @@ COBALT_SYSCALL(sigwait, primary, int __cobalt_sigtimedwait(sigset_t *set, const struct timespec *timeout, void __user *u_si, - int (*put_siginfo)(void __user *u_si, - const struct siginfo *si, - int overrun)) + bool compat) { xnticks_t ticks; @@ -408,7 +407,7 @@ int __cobalt_sigtimedwait(sigset_t *set, if (ticks++ == 0) ticks = XN_NONBLOCK; - return signal_wait(set, ticks, u_si, put_siginfo); + return signal_wait(set, ticks, u_si, compat); } COBALT_SYSCALL(sigtimedwait, nonrestartable, @@ -425,16 +424,14 @@ COBALT_SYSCALL(sigtimedwait, nonrestartable, if (cobalt_copy_from_user(&timeout, u_timeout, sizeof(timeout))) return -EFAULT; - return __cobalt_sigtimedwait(&set, &timeout, u_si, signal_put_siginfo); + return __cobalt_sigtimedwait(&set, &timeout, u_si, false); } int __cobalt_sigwaitinfo(sigset_t *set, void __user *u_si, - int (*put_siginfo)(void __user *u_si, - const struct siginfo *si, - int overrun)) + bool compat) { - return signal_wait(set, XN_INFINITE, u_si, put_siginfo); + return signal_wait(set, XN_INFINITE, u_si, compat); } COBALT_SYSCALL(sigwaitinfo, nonrestartable, @@ -445,7 +442,7 @@ COBALT_SYSCALL(sigwaitinfo, nonrestartable, if (cobalt_copy_from_user(&set, u_set, sizeof(set))) return -EFAULT; - return __cobalt_sigwaitinfo(&set, u_si, signal_put_siginfo); + return __cobalt_sigwaitinfo(&set, u_si, false); } COBALT_SYSCALL(sigpending, primary, (old_sigset_t __user *u_set)) diff --git a/kernel/cobalt/posix/signal.h b/kernel/cobalt/posix/signal.h index 993c48b..a4edc09 100644 --- a/kernel/cobalt/posix/signal.h +++ b/kernel/cobalt/posix/signal.h @@ -61,15 +61,11 @@ int __cobalt_sigwait(sigset_t *set); int __cobalt_sigtimedwait(sigset_t *set, const struct timespec *timeout, void __user *u_si, - int (*put_siginfo)(void __user *u_si, - const struct siginfo *si, - int overrun)); + bool compat); int __cobalt_sigwaitinfo(sigset_t *set, void __user *u_si, - int (*put_siginfo)(void __user *u_si, - const struct siginfo *si, - int overrun)); + bool compat); int __cobalt_sigqueue(pid_t pid, int sig, const union sigval *value); diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c index bc8b9d9..8763675 100644 --- a/kernel/cobalt/posix/syscall32.c +++ b/kernel/cobalt/posix/syscall32.c @@ -596,7 +596,7 @@ COBALT_SYSCALL32emu(sigtimedwait, nonrestartable, if (ret) return ret; - return __cobalt_sigtimedwait(&set, &timeout, u_si, sys32_put_siginfo); + return __cobalt_sigtimedwait(&set, &timeout, u_si, true); } COBALT_SYSCALL32emu(sigwaitinfo, nonrestartable, @@ -610,7 +610,7 @@ COBALT_SYSCALL32emu(sigwaitinfo, nonrestartable, if (ret) return ret; - return __cobalt_sigwaitinfo(&set, u_si, sys32_put_siginfo); + return __cobalt_sigwaitinfo(&set, u_si, true); } COBALT_SYSCALL32emu(sigpending, primary, (compat_old_sigset_t __user *u_set)) _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git