[PATCH 3/4] kern_ntptime: Add syscall ntp_adjtime for rtems

Moyano, Gabriel gabriel.moyano at dlr.de
Thu Feb 3 15:19:22 UTC 2022


---
 freebsd/sys/kern/kern_ntptime.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/freebsd/sys/kern/kern_ntptime.c b/freebsd/sys/kern/kern_ntptime.c
index 518adab5..f9465ea0 100644
--- a/freebsd/sys/kern/kern_ntptime.c
+++ b/freebsd/sys/kern/kern_ntptime.c
@@ -52,6 +52,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/timepps.h>
 #include <sys/syscallsubr.h>
 #include <sys/sysctl.h>
+#ifdef __rtems__
+#include <sys/file.h>
+#endif /* __rtems__ */
 
 #ifdef PPS_SYNC
 FEATURE(pps_sync, "Support usage of external PPS signal by kernel PLL");
@@ -495,6 +498,24 @@ sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_args *uap)
 	return (error);
 }
 
+#ifdef __rtems__
+int
+ntp_adjtime(struct timex* t)
+{
+    struct thread *td = rtems_bsd_get_curthread_or_null();
+    struct ntp_adjtime_args uap = {
+        .tp = t
+    };
+    int error;
+    if (td != NULL) {
+        error = sys_ntp_adjtime(td, &uap);
+    } else {
+        error = ENOMEM;
+    }
+    return rtems_bsd_error_to_status_and_errno(error);
+}
+#endif /* __rtems__ */
+
 /*
  * second_overflow() - called after ntp_tick_adjust()
  *
-- 
2.17.1



More information about the devel mailing list