Commit 0760c45b authored by Song Chen's avatar Song Chen Committed by Jan Kiszka
Browse files

y2038: cobalt/posix/event: Adding event_wait64



Add a syscall specific for event_wait with 64bit time_t.
Signed-off-by: default avatarSong Chen <chensong_2000@189.cn>
[Florian: Tracing, reformatting/rebasing]
Signed-off-by: default avatarFlorian Bezdeka <florian.bezdeka@siemens.com>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 24e67935
......@@ -133,6 +133,7 @@
#define sc_cobalt_mq_timedreceive64 110
#define sc_cobalt_sigtimedwait64 111
#define sc_cobalt_monitor_wait64 112
#define sc_cobalt_event_wait64 113
#define __NR_COBALT_SYSCALLS 128 /* Power of 2 */
......
......@@ -20,6 +20,7 @@
#include "clock.h"
#include "event.h"
#include <trace/events/cobalt-posix.h>
#include <cobalt/kernel/time.h>
/*
* Cobalt event notification services
......@@ -119,7 +120,7 @@ int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
handle = cobalt_get_handle_from_user(&u_event->handle);
if (ts) {
if ((unsigned long)ts->tv_nsec >= ONE_BILLION)
if (!timespec64_valid(ts))
return -EINVAL;
timeout = ts2ns(ts);
......@@ -189,6 +190,24 @@ out:
return ret;
}
int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
unsigned int bits,
unsigned int __user *u_bits_r,
int mode, const struct __kernel_timespec __user *u_ts)
{
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_event_wait(u_event, bits, u_bits_r, mode, tsp);
}
COBALT_SYSCALL(event_wait, primary,
(struct cobalt_event_shadow __user *u_event,
unsigned int bits,
......@@ -208,6 +227,15 @@ COBALT_SYSCALL(event_wait, primary,
return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
}
COBALT_SYSCALL(event_wait64, primary,
(struct cobalt_event_shadow __user *u_event,
unsigned int bits,
unsigned int __user *u_bits_r,
int mode, const struct __kernel_timespec __user *u_ts))
{
return __cobalt_event_wait64(u_event, bits, u_bits_r, mode, u_ts);
}
COBALT_SYSCALL(event_sync, current,
(struct cobalt_event_shadow __user *u_event))
{
......
......@@ -41,6 +41,11 @@ int __cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
unsigned int __user *u_bits_r,
int mode, const struct timespec64 *ts);
int __cobalt_event_wait64(struct cobalt_event_shadow __user *u_event,
unsigned int bits, unsigned int __user *u_bits_r,
int mode,
const struct __kernel_timespec __user *u_ts);
COBALT_SYSCALL_DECL(event_init,
(struct cobalt_event_shadow __user *u_evtsh,
unsigned int value,
......@@ -53,6 +58,13 @@ COBALT_SYSCALL_DECL(event_wait,
int mode,
const struct __user_old_timespec __user *u_ts));
COBALT_SYSCALL_DECL(event_wait64,
(struct cobalt_event_shadow __user *u_evtsh,
unsigned int bits,
unsigned int __user *u_bits_r,
int mode,
const struct __kernel_timespec __user *u_ts));
COBALT_SYSCALL_DECL(event_sync,
(struct cobalt_event_shadow __user *u_evtsh));
......
......@@ -795,6 +795,15 @@ COBALT_SYSCALL32emu(event_wait, primary,
return __cobalt_event_wait(u_event, bits, u_bits_r, mode, tsp);
}
COBALT_SYSCALL32emu(event_wait64, primary,
(struct cobalt_event_shadow __user *u_event,
unsigned int bits,
unsigned int __user *u_bits_r,
int mode, const struct __kernel_timespec __user *u_ts))
{
return __cobalt_event_wait64(u_event, bits, u_bits_r, mode, u_ts);
}
COBALT_SYSCALL32emu(select, primary,
(int nfds,
compat_fd_set __user *u_rfds,
......
......@@ -230,6 +230,13 @@ COBALT_SYSCALL32emu_DECL(event_wait,
unsigned int __user *u_bits_r,
int mode, const struct old_timespec32 __user *u_ts));
COBALT_SYSCALL32emu_DECL(event_wait64,
(struct cobalt_event_shadow __user *u_event,
unsigned int bits,
unsigned int __user *u_bits_r,
int mode,
const struct __kernel_timespec __user *u_ts));
COBALT_SYSCALL32emu_DECL(select,
(int nfds,
compat_fd_set __user *u_rfds,
......
......@@ -165,7 +165,8 @@
__cobalt_symbolic_syscall(mq_timedsend64), \
__cobalt_symbolic_syscall(mq_timedreceive64), \
__cobalt_symbolic_syscall(sigtimedwait64), \
__cobalt_symbolic_syscall(monitor_wait64))
__cobalt_symbolic_syscall(monitor_wait64), \
__cobalt_symbolic_syscall(event_wait64))
DECLARE_EVENT_CLASS(cobalt_syscall_entry,
TP_PROTO(unsigned int nr),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment