[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks
Module: xenomai-3 Branch: master Commit: dac2df243bcd146a040329df3885131ae77bd5b9 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dac2df243bcd146a040329df3885131ae77bd5b9 Author: Philippe GerumDate: 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(>timer, , timerfd_handler, + xntimer_init(>timer, clock, timerfd_handler, curr ? curr->sched : NULL, XNTIMER_UGRAVITY); xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL); xnselect_init(>read_select); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks
Module: xenomai-3 Branch: wip/drivers Commit: dac2df243bcd146a040329df3885131ae77bd5b9 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dac2df243bcd146a040329df3885131ae77bd5b9 Author: Philippe GerumDate: 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(>timer, , timerfd_handler, + xntimer_init(>timer, clock, timerfd_handler, curr ? curr->sched : NULL, XNTIMER_UGRAVITY); xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL); xnselect_init(>read_select); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks
Module: xenomai-3 Branch: next Commit: dac2df243bcd146a040329df3885131ae77bd5b9 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dac2df243bcd146a040329df3885131ae77bd5b9 Author: Philippe GerumDate: 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(>timer, , timerfd_handler, + xntimer_init(>timer, clock, timerfd_handler, curr ? curr->sched : NULL, XNTIMER_UGRAVITY); xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL); xnselect_init(>read_select); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks
Module: xenomai-3 Branch: stable-3.0.x Commit: dac2df243bcd146a040329df3885131ae77bd5b9 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dac2df243bcd146a040329df3885131ae77bd5b9 Author: Philippe GerumDate: 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(>timer, , timerfd_handler, + xntimer_init(>timer, clock, timerfd_handler, curr ? curr->sched : NULL, XNTIMER_UGRAVITY); xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL); xnselect_init(>read_select); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks
Module: xenomai-3 Branch: stable-3.0.x Commit: 6bbe209033f8dde34df107329622a6bc77808d3c URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6bbe209033f8dde34df107329622a6bc77808d3c Author: Philippe GerumDate: Fri Nov 4 16:25:21 2016 +0100 cobalt/posix/timerfd: allow usage with external clocks Same as e6cd961. --- include/cobalt/kernel/timer.h |2 +- kernel/cobalt/posix/timerfd.c |8 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/cobalt/kernel/timer.h b/include/cobalt/kernel/timer.h index f45a753..d92c8c8 100644 --- a/include/cobalt/kernel/timer.h +++ b/include/cobalt/kernel/timer.h @@ -163,7 +163,7 @@ typedef struct { }) #define xntimerq_destroy(q) do { } while (0) -#define xntimerq_empty(q) ((q)->head != NULL) +#define xntimerq_empty(q) ((q)->head == NULL) #define xntimerq_head(q) ((q)->head) 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(>timer, , timerfd_handler, + xntimer_init(>timer, clock, timerfd_handler, curr ? curr->sched : NULL, XNTIMER_UGRAVITY); xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL); xnselect_init(>read_select); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/posix/timerfd: allow usage with external clocks
Module: xenomai-3 Branch: stable-3.0.x Commit: d950f784da24274cae1ab40b52238409b1ad573f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d950f784da24274cae1ab40b52238409b1ad573f Author: Philippe GerumDate: 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(>timer, , timerfd_handler, + xntimer_init(>timer, clock, timerfd_handler, curr ? curr->sched : NULL, XNTIMER_UGRAVITY); xnsynch_init(>readers, XNSYNCH_PRIO | XNSYNCH_NOPIP, NULL); xnselect_init(>read_select); ___ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git