|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 2/3] lib/uktime: Add the missing changes from newlib's time.c
This patch copies the changes that were only in the newlib's time.c
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
lib/uktime/time.c | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/lib/uktime/time.c b/lib/uktime/time.c
index f884531f..7469fd38 100644
--- a/lib/uktime/time.c
+++ b/lib/uktime/time.c
@@ -35,16 +35,21 @@
* THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
*/
+#include <errno.h>
#include <time.h>
+#include <utime.h>
#include <uk/plat/time.h>
-#include <errno.h>
#include <uk/config.h>
#if CONFIG_HAVE_SCHED
#include <uk/sched.h>
#else
#include <uk/plat/lcpu.h>
#endif
-#include <uk/essentials.h>
+
+int utime(const char *filename __unused, const struct utimbuf *times __unused)
+{
+ return 0;
+}
#ifndef CONFIG_HAVE_SCHED
/* Workaround until Unikraft changes interface for something more
@@ -92,6 +97,18 @@ int nanosleep(const struct timespec *req, struct timespec
*rem)
return 0;
}
+int usleep(useconds_t usec)
+{
+ struct timespec ts;
+
+ ts.tv_sec = (long int) (usec / 1000000);
+ ts.tv_nsec = (long int) ukarch_time_usec_to_nsec(usec % 1000000);
+ if (nanosleep(&ts, &ts))
+ return -1;
+
+ return 0;
+}
+
unsigned int sleep(unsigned int seconds)
{
struct timespec ts;
@@ -118,7 +135,12 @@ int gettimeofday(struct timeval *tv, void *tz __unused)
return 0;
}
-int clock_gettime(clockid_t clk_id, struct timespec *tp)
+int clock_getres(clockid_t clk_id __unused, struct timespec *res __unused)
+{
+ return 0;
+}
+
+int clock_gettime(clockid_t clk_id __unused, struct timespec *tp __unused)
{
__nsec now;
@@ -143,3 +165,14 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp)
tp->tv_nsec = ukarch_time_subsec(now);
return 0;
}
+
+int clock_settime(clockid_t clk_id __unused, const struct timespec *tp
__unused)
+{
+ return 0;
+}
+
+int times(struct tm *buf __unused)
+{
+ errno = ENODATA;
+ return -1;
+}
--
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |