File: posix-timers.h

package info (click to toggle)
kernel-source-2.6.8 2.6.8-17sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 221,748 kB
  • ctags: 678,840
  • sloc: ansic: 3,793,905; asm: 183,914; sh: 57,062; makefile: 10,502; perl: 2,733; yacc: 2,601; cpp: 1,712; lex: 1,513; lisp: 218; awk: 59; python: 45
file content (44 lines) | stat: -rw-r--r-- 1,354 bytes parent folder | download
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
#ifndef _linux_POSIX_TIMERS_H
#define _linux_POSIX_TIMERS_H

#include <linux/spinlock.h>
#include <linux/list.h>

struct k_clock_abs {
	struct list_head list;
	spinlock_t lock;
};
struct k_clock {
	int res;		/* in nano seconds */
	struct k_clock_abs *abs_struct;
	int (*clock_set) (struct timespec * tp);
	int (*clock_get) (struct timespec * tp);
	int (*nsleep) (int flags,
		       struct timespec * new_setting,
		       struct itimerspec * old_setting);
	int (*timer_set) (struct k_itimer * timr, int flags,
			  struct itimerspec * new_setting,
			  struct itimerspec * old_setting);
	int (*timer_del) (struct k_itimer * timr);
	void (*timer_get) (struct k_itimer * timr,
			   struct itimerspec * cur_setting);
};
struct now_struct {
	unsigned long jiffies;
};

#define posix_get_now(now) (now)->jiffies = jiffies;
#define posix_time_before(timer, now) \
                      time_before((timer)->expires, (now)->jiffies)

#define posix_bump_timer(timr, now)					\
         do {								\
              long delta, orun;						\
	      delta = now.jiffies - (timr)->it_timer.expires;		\
              if (delta >= 0) {						\
	           orun = 1 + (delta / (timr)->it_incr);		\
	          (timr)->it_timer.expires += orun * (timr)->it_incr;	\
                  (timr)->it_overrun += orun;				\
              }								\
            }while (0)
#endif