[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-3 Branch: master Commit: 496b0b95d4eb780ce8c3ba769151697204606b60 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=496b0b95d4eb780ce8c3ba769151697204606b60 Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |1 + 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index b31517f..d17ea56 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..329ff3b 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,4 @@ --wrap kill --wrap sleep --wrap mmap +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-3 Branch: next Commit: 496b0b95d4eb780ce8c3ba769151697204606b60 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=496b0b95d4eb780ce8c3ba769151697204606b60 Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |1 + 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index b31517f..d17ea56 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..329ff3b 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,4 @@ --wrap kill --wrap sleep --wrap mmap +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-gch Branch: for-forge Commit: f1af3ef972088fcedc931b73c49d3a9ae00a4d2f URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=f1af3ef972088fcedc931b73c49d3a9ae00a4d2f Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |1 + 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index b31517f..d17ea56 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..329ff3b 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,4 @@ --wrap kill --wrap sleep --wrap mmap +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-gch Branch: for-forge Commit: 8d79307f9bc02d363791f998150d8e4fb2195061 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=8d79307f9bc02d363791f998150d8e4fb2195061 Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |1 + 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index b31517f..d17ea56 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..329ff3b 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,4 @@ --wrap kill --wrap sleep --wrap mmap +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-gch Branch: for-forge Commit: fb9724f7f9ae3e70c3ad89d5f6191cd280e89c73 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=fb9724f7f9ae3e70c3ad89d5f6191cd280e89c73 Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |2 ++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index b31517f..d17ea56 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..b8c9942 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,5 @@ --wrap kill --wrap sleep --wrap mmap +--wrap gettimeofday +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-gch Branch: for-forge Commit: 7b891e43a22f939a5010d975984f4f6d87c2eda4 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=7b891e43a22f939a5010d975984f4f6d87c2eda4 Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |2 ++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index 501cdec..b35dfd4 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..b8c9942 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,5 @@ --wrap kill --wrap sleep --wrap mmap +--wrap gettimeofday +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-gch Branch: for-forge Commit: b42a420fd679b9cc8b937d4448d8dfc880d84b1b URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=b42a420fd679b9cc8b937d4448d8dfc880d84b1b Author: Gilles Chanteperdrix Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |2 ++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index 501cdec..b35dfd4 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret == 0) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, &ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..b8c9942 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,5 @@ --wrap kill --wrap sleep --wrap mmap +--wrap gettimeofday +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git