From: Florian Bezdeka <florian.bezdeka@siemens.com>
To: xenomai@lists.linux.dev, jan.kiszka@siemens.com
Cc: Florian Bezdeka <florian.bezdeka@siemens.com>
Subject: [PATCH v2 02/14] y2038: cobalt/posix/timer: Adding timer_settime64
Date: Mon, 15 May 2023 16:50:02 +0200 [thread overview]
Message-ID: <20230508-florian-y2038-part-two-v2-2-a12f69d870d7@siemens.com> (raw)
In-Reply-To: <20230508-florian-y2038-part-two-v2-0-a12f69d870d7@siemens.com>
Add a syscall specific for timer_settime with 64bit time_t.
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
include/cobalt/uapi/syscall.h | 1 +
kernel/cobalt/posix/timer.c | 27 +++++++++++++++++++++++++++
kernel/cobalt/posix/timer.h | 5 +++++
kernel/cobalt/trace/cobalt-posix.h | 3 ++-
4 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 9646a0d97..77184bd22 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -136,6 +136,7 @@
#define sc_cobalt_event_wait64 113
#define sc_cobalt_recvmmsg64 114
#define sc_cobalt_cond_wait_prologue64 115
+#define sc_cobalt_timer_settime64 116
#define __NR_COBALT_SYSCALLS 128 /* Power of 2 */
diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index a115ded53..09843bcfb 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <cobalt/kernel/time.h>
#include <linux/module.h>
#include <linux/cred.h>
#include <linux/err.h>
@@ -495,6 +496,32 @@ COBALT_SYSCALL(timer_settime, primary,
return 0;
}
+COBALT_SYSCALL(timer_settime64, primary,
+ (timer_t tm, int flags,
+ const struct __kernel_itimerspec __user *u_newval,
+ struct __kernel_itimerspec __user *u_oldval))
+{
+ struct itimerspec64 newv, oldv, *oldvp = &oldv;
+ int ret;
+
+ if (u_oldval == NULL)
+ oldvp = NULL;
+
+ if (cobalt_get_itimerspec64(&newv, u_newval))
+ return -EFAULT;
+
+ ret = __cobalt_timer_settime(tm, flags, &newv, oldvp);
+ if (ret)
+ return ret;
+
+ if (oldvp && cobalt_put_itimerspec64(u_oldval, oldvp)) {
+ __cobalt_timer_settime(tm, flags, oldvp, NULL);
+ return -EFAULT;
+ }
+
+ return 0;
+}
+
COBALT_SYSCALL(timer_gettime, current,
(timer_t tm, struct __user_old_itimerspec __user *u_val))
{
diff --git a/kernel/cobalt/posix/timer.h b/kernel/cobalt/posix/timer.h
index 3b580d470..16d3a572a 100644
--- a/kernel/cobalt/posix/timer.h
+++ b/kernel/cobalt/posix/timer.h
@@ -78,6 +78,11 @@ COBALT_SYSCALL_DECL(timer_settime,
const struct __user_old_itimerspec __user *u_newval,
struct __user_old_itimerspec __user *u_oldval));
+COBALT_SYSCALL_DECL(timer_settime64,
+ (timer_t tm, int flags,
+ const struct __kernel_itimerspec __user *u_newval,
+ struct __kernel_itimerspec __user *u_oldval));
+
COBALT_SYSCALL_DECL(timer_gettime,
(timer_t tm, struct __user_old_itimerspec __user *u_val));
diff --git a/kernel/cobalt/trace/cobalt-posix.h b/kernel/cobalt/trace/cobalt-posix.h
index c7eef7fba..5f99b1162 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -168,7 +168,8 @@
__cobalt_symbolic_syscall(monitor_wait64), \
__cobalt_symbolic_syscall(event_wait64), \
__cobalt_symbolic_syscall(recvmmsg64), \
- __cobalt_symbolic_syscall(cond_wait_prologue64))
+ __cobalt_symbolic_syscall(cond_wait_prologue64), \
+ __cobalt_symbolic_syscall(timer_settime64))
DECLARE_EVENT_CLASS(cobalt_syscall_entry,
TP_PROTO(unsigned int nr),
--
2.39.2
next prev parent reply other threads:[~2023-05-15 14:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 14:50 [PATCH v2 00/14] y2038: Part two - timer and timerfd support Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 01/14] y2038: cobalt: Introduce some itimerspec64 related helpers Florian Bezdeka
2023-05-15 14:50 ` Florian Bezdeka [this message]
2023-05-15 14:50 ` [PATCH v2 03/14] y2038: cobalt/posix/timer: Use timespec64_valid() for validation Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 04/14] y2038: lib/cobalt: Dispatch timer_settime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 05/14] y2038: testsuite/smokey/y2038: Adding tests for timer_settime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 06/14] y2038: cobalt/posix/timer: Adding timer_gettime64 Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 07/14] y2038: lib/cobalt: Dispatch timer_gettime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 08/14] y2038: testsuite/smokey/y2038: Adding tests for timer_gettime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 09/14] y2038: cobalt/posix/timerfd: Adding timerfd_settime64 Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 10/14] y2038: lib/cobalt: Dispatch timerfd_settime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 11/14] y2038: testsuite/smokey/y2038: Adding tests for timerfd_settime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 12/14] y2038: cobalt/posix/timerfd: Adding timerfd_gettime64 Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 13/14] y2038: lib/cobalt: Dispatch timerfd_gettime Florian Bezdeka
2023-05-15 14:50 ` [PATCH v2 14/14] y2038: testsuite/smokey/y2038: Adding tests for timerfd_gettime Florian Bezdeka
2023-05-16 6:43 ` [PATCH v2 00/14] y2038: Part two - timer and timerfd support Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230508-florian-y2038-part-two-v2-2-a12f69d870d7@siemens.com \
--to=florian.bezdeka@siemens.com \
--cc=jan.kiszka@siemens.com \
--cc=xenomai@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).