y2038: cobalt/posix/monitor: Adding monitor_wait64
PATCH 1/3 y2038: cobalt/posix/monitor: Adding monitor_wait64
Add a syscall specific for monitor_wait with 64bit time_t.
Signed-off-by Song Chen <[email protected]>
--- include/cobalt/uapi/syscall.h | 2 +- kernel/cobalt/posix/monitor.c | 31 ++++++++++++++++++++++++++++++- kernel/cobalt/posix/monitor.h | 9 +++++++++ kernel/cobalt/posix/syscall32.c | 8 ++++++++ kernel/cobalt/posix/syscall32.h | 6 ++++++ 5 files changed, 54 insertions(+), 2 deletions(-)
include/cobalt/uapi/syscall.h +1 -0
@@ -132,7 +132,7 @@#define sc_cobalt_mq_timedsend64 109#define sc_cobalt_mq_timedreceive64 110#define sc_cobalt_sigtimedwait64 111 +#define sc_cobalt_monitor_wait64 112#define __NR_COBALT_SYSCALLS 128/* Power of 2 */
kernel/cobalt/posix/monitor.c +30 -1
@@ -20,6 +20,7 @@#include "clock.h" #include "monitor.h" #include <trace/events/cobalt-posix.h> +#include <cobalt/kernel/time.h> /* * The Cobalt monitor is a double-wait condition object, serializing
@@ -218,8 +219,11 @@ int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon, handle =cobalt_get_handle_from_user (&u_mon->handle); -if (ts) +if (ts) { +if (!timespec64_valid (ts)) +return -EINVAL ; timeout =ts2ns (ts) +1 ; + }xnlock_get_irqsave (&nklock, s);
@@ -307,6 +311,31 @@ COBALT_SYSCALL(monitor_wait, nonrestartable,return __cobalt_monitor_wait (u_mon, event, tsp, u_ret); } +int __cobalt_monitor_wait64 (struct cobalt_monitor_shadow __user *u_mon, +int event,const struct __kernel_timespec __user *u_ts, +int __user *u_ret) +{ +struct timespec64 ts, *tsp =NULL ; +int ret; + +if (u_ts) { + tsp = &ts; + ret =cobalt_get_timespec64 (&ts, u_ts); +if (ret) +return ret; + } + +return __cobalt_monitor_wait (u_mon, event, tsp, u_ret); +} + +COBALT_SYSCALL (monitor_wait64, nonrestartable, + (struct cobalt_monitor_shadow __user *u_mon, + int event, const struct __kernel_timespec __user *u_ts, + int __user *u_ret)) +{ +return __cobalt_monitor_wait64 (u_mon, event, u_ts, u_ret); +} +COBALT_SYSCALL (monitor_sync, nonrestartable, (struct cobalt_monitor_shadow __user *u_mon)) {
kernel/cobalt/posix/monitor.h +9 -0
@@ -42,6 +42,10 @@ int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon, int event, const struct timespec64 *ts, int __user *u_ret); +int __cobalt_monitor_wait64 (struct cobalt_monitor_shadow __user *u_mon, +int event,const struct __kernel_timespec __user *u_ts, +int __user *u_ret); + COBALT_SYSCALL_DECL(monitor_init, (struct cobalt_monitor_shadow __user *u_monsh, clockid_t clk_id,
@@ -61,6 +65,11 @@ COBALT_SYSCALL_DECL(monitor_wait, int event, const struct __user_old_timespec __user *u_ts, int __user *u_ret)); +COBALT_SYSCALL_DECL (monitor_wait64, + (struct cobalt_monitor_shadow __user *u_monsh, + int event, const struct __kernel_timespec __user *u_ts, + int__user *u_ret)); +COBALT_SYSCALL_DECL (monitor_destroy, (struct cobalt_monitor_shadow __user *u_monsh));
kernel/cobalt/posix/syscall32.c +8 -0
@@ -770,6 +770,14 @@ COBALT_SYSCALL32emu(monitor_wait, nonrestartable,return __cobalt_monitor_wait (u_mon, event, tsp, u_ret); } +COBALT_SYSCALL32emu (monitor_wait64, nonrestartable, + (struct cobalt_monitor_shadow __user *u_mon, + int event, const struct __kernel_timespec __user *u_ts, + int __user *u_ret)) +{ +return __cobalt_monitor_wait64 (u_mon, event, u_ts, u_ret); +} + COBALT_SYSCALL32emu(event_wait, primary, (struct cobalt_event_shadow __user *u_event, unsigned int bits,
kernel/cobalt/posix/syscall32.h +6 -0
@@ -219,6 +219,12 @@ COBALT_SYSCALL32emu_DECL(monitor_wait, int event, const struct old_timespec32 __user *u_ts, int __user *u_ret)); +COBALT_SYSCALL32emu_DECL (monitor_wait64, + (struct cobalt_monitor_shadow __user *u_mon, + int event, + const struct __kernel_timespec __user *u_ts, + int__user *u_ret)); + COBALT_SYSCALL32emu_DECL(event_wait, (struct cobalt_event_shadow __user *u_event, unsigned int bits,
Signature · 1 line
2.7.4