source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/posix-timers.h

Last change on this file was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#ifndef _linux_POSIX_TIMERS_H
2#define _linux_POSIX_TIMERS_H
3
4
5struct k_clock {
6        int res;                /* in nano seconds */
7        int (*clock_getres) (clockid_t which_clock, struct timespec *tp);
8        struct k_clock_abs *abs_struct;
9        int (*clock_set) (clockid_t which_clock, struct timespec * tp);
10        int (*clock_get) (clockid_t which_clock, struct timespec * tp);
11        int (*timer_create) (struct k_itimer *timer);
12        int (*nsleep) (clockid_t which_clock, int flags, struct timespec *);
13        int (*timer_set) (struct k_itimer * timr, int flags,
14                          struct itimerspec * new_setting,
15                          struct itimerspec * old_setting);
16        int (*timer_del) (struct k_itimer * timr);
17#define TIMER_RETRY 1
18        void (*timer_get) (struct k_itimer * timr,
19                           struct itimerspec * cur_setting);
20};
21
22void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock);
23
24/* Error handlers for timer_create, nanosleep and settime */
25int do_posix_clock_notimer_create(struct k_itimer *timer);
26int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *);
27int do_posix_clock_nosettime(clockid_t, struct timespec *tp);
28
29/* function to call to trigger timer event */
30int posix_timer_event(struct k_itimer *timr, int si_private);
31
32struct now_struct {
33        unsigned long jiffies;
34};
35
36#define posix_get_now(now) (now)->jiffies = jiffies;
37#define posix_time_before(timer, now) \
38                      time_before((timer)->expires, (now)->jiffies)
39
40#define posix_bump_timer(timr, now)                                     \
41         do {                                                           \
42              long delta, orun;                                         \
43              delta = now.jiffies - (timr)->it.real.timer.expires;      \
44              if (delta >= 0) {                                         \
45                   orun = 1 + (delta / (timr)->it.real.incr);           \
46                  (timr)->it.real.timer.expires +=                      \
47                         orun * (timr)->it.real.incr;                   \
48                  (timr)->it_overrun += orun;                           \
49              }                                                         \
50            }while (0)
51
52int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *);
53int posix_cpu_clock_get(clockid_t which_clock, struct timespec *);
54int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp);
55int posix_cpu_timer_create(struct k_itimer *);
56int posix_cpu_nsleep(clockid_t, int, struct timespec *);
57int posix_cpu_timer_set(struct k_itimer *, int,
58                        struct itimerspec *, struct itimerspec *);
59int posix_cpu_timer_del(struct k_itimer *);
60void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *);
61
62void posix_cpu_timer_schedule(struct k_itimer *);
63
64void run_posix_cpu_timers(struct task_struct *);
65void posix_cpu_timers_exit(struct task_struct *);
66void posix_cpu_timers_exit_group(struct task_struct *);
67
68void set_process_cpu_timer(struct task_struct *, unsigned int,
69                           cputime_t *, cputime_t *);
70
71#endif
Note: See TracBrowser for help on using the repository browser.