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