posix-timers.h
来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 99 行
H
99 行
#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);};#if defined(CONFIG_HIGH_RES_TIMERS)struct now_struct { unsigned long jiffies; long sub_jiffie;};/* * The following locking assumes that irq off. */static inline voidposix_get_now (struct now_struct *now){ unsigned long seq; (now)->jiffies = jiffies; do { seq = read_seqbegin(&xtime_lock); (now)->sub_jiffie = get_arch_cycles((now)->jiffies); } while (read_seqretry(&xtime_lock, seq)); while (unlikely(((now)->sub_jiffie - arch_cycles_per_jiffy) > 0)) { (now)->sub_jiffie = (now)->sub_jiffie - arch_cycles_per_jiffy; (now)->jiffies++; }}static inline intposix_time_before (const struct timer_list* t, const struct now_struct* now){ const long diff = (long)t->expires - (long)now->jiffies; return (diff < 0) || ((diff == 0) && (t->sub_expires < now->sub_jiffie)); }static inline void posix_bump_timer (struct k_itimer* t, const struct now_struct now) { t->it_timer.expires += t->it_incr; t->it_timer.sub_expires += t->it_sub_incr; if ((t->it_timer.sub_expires - arch_cycles_per_jiffy) >= 0) { t->it_timer.sub_expires -= arch_cycles_per_jiffy; t->it_timer.expires++; } t->it_overrun++;}#else /* defined(CONFIG_HIGH_RES_TIMERS) */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 /* defined(CONFIG_HIGH_RES_TIMERS) */#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?