Module: xenomai-3
Branch: next
Commit: dac2df243bcd146a040329df3885131ae77bd5b9
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dac2df243bcd146a040329df3885131ae77bd5b9

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Nov  4 16:25:21 2016 +0100

cobalt/posix/timerfd: allow usage with external clocks

Same as e6cd961.

---

 kernel/cobalt/posix/timerfd.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/posix/timerfd.c b/kernel/cobalt/posix/timerfd.c
index 90c4b3f..132aba8 100644
--- a/kernel/cobalt/posix/timerfd.c
+++ b/kernel/cobalt/posix/timerfd.c
@@ -166,12 +166,14 @@ COBALT_SYSCALL(timerfd_create, lostage, (int clockid, int 
flags))
 {
        struct cobalt_tfd *tfd;
        struct xnthread *curr;
+       struct xnclock *clock;
        int ret, ufd;
 
-       if (clockid != CLOCK_REALTIME && clockid != CLOCK_MONOTONIC)
+       if (flags & ~TFD_CREATE_FLAGS)
                return -EINVAL;
 
-       if (flags & ~TFD_CREATE_FLAGS)
+       clock = cobalt_clock_find(clockid);
+       if (clock == NULL)
                return -EINVAL;
 
        tfd = xnmalloc(sizeof(*tfd));
@@ -189,7 +191,7 @@ COBALT_SYSCALL(timerfd_create, lostage, (int clockid, int 
flags))
        tfd->fd.oflags = (flags & TFD_NONBLOCK) ? O_NONBLOCK : 0;
        tfd->clockid = clockid;
        curr = xnthread_current();
-       xntimer_init(&tfd->timer, &nkclock, timerfd_handler,
+       xntimer_init(&tfd->timer, clock, timerfd_handler,
                     curr ? curr->sched : NULL, XNTIMER_UGRAVITY);
        xnsynch_init(&tfd->readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL);
        xnselect_init(&tfd->read_select);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to