Xenomai 3.3.2
Loading...
Searching...
No Matches
timer.h
1/*
2 * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef _COBALT_POSIX_TIMER_H
19#define _COBALT_POSIX_TIMER_H
20
21#include <linux/types.h>
22#include <linux/time.h>
23#include <linux/list.h>
24#include <cobalt/kernel/timer.h>
25#include <xenomai/posix/signal.h>
26#include <xenomai/posix/syscall.h>
27
28struct cobalt_timer {
29 struct xntimer timerbase;
30 timer_t id;
31 int overruns;
32 clockid_t clockid;
33 pid_t target;
34 struct cobalt_sigpending sigp;
35 struct cobalt_extref extref;
36};
37
38int cobalt_timer_deliver(struct cobalt_thread *waiter,
39 timer_t timerid);
40
41void cobalt_timer_reclaim(struct cobalt_process *p);
42
43static inline timer_t cobalt_timer_id(const struct cobalt_timer *timer)
44{
45 return timer->id;
46}
47
48struct cobalt_timer *
49cobalt_timer_by_id(struct cobalt_process *p, timer_t timer_id);
50
51void cobalt_timer_handler(struct xntimer *xntimer);
52
53void __cobalt_timer_getval(struct xntimer *__restrict__ timer,
54 struct itimerspec64 *__restrict__ value);
55
56int __cobalt_timer_setval(struct xntimer *__restrict__ timer, int clock_flag,
57 const struct itimerspec64 *__restrict__ value);
58
59int __cobalt_timer_create(clockid_t clock,
60 const struct sigevent *sev,
61 timer_t __user *u_tm);
62
63int __cobalt_timer_settime(timer_t timerid, int flags,
64 const struct itimerspec64 *__restrict__ value,
65 struct itimerspec64 *__restrict__ ovalue);
66
67int __cobalt_timer_gettime(timer_t timerid, struct itimerspec64 *value);
68
69COBALT_SYSCALL_DECL(timer_create,
70 (clockid_t clock,
71 const struct sigevent __user *u_sev,
72 timer_t __user *u_tm));
73
74COBALT_SYSCALL_DECL(timer_delete, (timer_t tm));
75
76COBALT_SYSCALL_DECL(timer_settime,
77 (timer_t tm, int flags,
78 const struct old_itimerspec32 __user *u_newval,
79 struct old_itimerspec32 __user *u_oldval));
80
81COBALT_SYSCALL_DECL(timer_settime64,
82 (timer_t tm, int flags,
83 const struct __kernel_itimerspec __user *u_newval,
84 struct __kernel_itimerspec __user *u_oldval));
85
86COBALT_SYSCALL_DECL(timer_gettime,
87 (timer_t tm, struct old_itimerspec32 __user *u_val));
88
89COBALT_SYSCALL_DECL(timer_gettime64,
90 (timer_t tm, struct __kernel_itimerspec __user *u_val));
91
92COBALT_SYSCALL_DECL(timer_getoverrun, (timer_t tm));
93
94#endif /* !_COBALT_POSIX_TIMER_H */
int timer_create(clockid_t clockid, const struct sigevent *__restrict__ evp, timer_t *__restrict__ timerid))
Create a timer.
Definition timer.c:75
int timer_delete(timer_t timerid))
Delete a timer object.
Definition timer.c:106
int timer_getoverrun(timer_t timerid))
Get expiration overruns count since the most recent timer expiration signal delivery.
Definition timer.c:255