VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / linux / posix-timers.h
index 637d2fb..ec4910e 100644 (file)
@@ -1,8 +1,16 @@
 #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,
@@ -23,8 +31,14 @@ struct now_struct {
 #define posix_time_before(timer, now) \
                       time_before((timer)->expires, (now)->jiffies)
 
-#define posix_bump_timer(timr) do { \
-                        (timr)->it_timer.expires += (timr)->it_incr; \
-                        (timr)->it_overrun++;               \
-                       }while (0)
+#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