fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / kernel / posix-timers.c
index e081fef..4d5f8c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/kernel/posix_timers.c
+ * linux/kernel/posix-timers.c
  *
  *
  * 2002-10-15  Posix Clocks & timers
@@ -48,6 +48,7 @@
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/module.h>
+#include <linux/vs_context.h>
 
 /*
  * Management arrays for POSIX timers.  Timers are kept in slab memory
@@ -70,7 +71,7 @@
 /*
  * Lets keep our timers in a slab cache :-)
  */
-static kmem_cache_t *posix_timers_cache;
+static struct kmem_cache *posix_timers_cache;
 static struct idr posix_timers_id;
 static DEFINE_SPINLOCK(idr_lock);
 
@@ -298,6 +299,10 @@ void do_schedule_next_timer(struct siginfo *info)
 
 int posix_timer_event(struct k_itimer *timr,int si_private)
 {
+       struct vx_info_save vxis;
+       int ret;
+
+       enter_vx_info(task_get_vx_info(timr->it_process), &vxis);
        memset(&timr->sigq->info, 0, sizeof(siginfo_t));
        timr->sigq->info.si_sys_private = si_private;
        /* Send signal to the process that owns this timer.*/
@@ -310,11 +315,11 @@ int posix_timer_event(struct k_itimer *timr,int si_private)
 
        if (timr->it_sigev_notify & SIGEV_THREAD_ID) {
                struct task_struct *leader;
-               int ret = send_sigqueue(timr->it_sigev_signo, timr->sigq,
-                                       timr->it_process);
 
+               ret = send_sigqueue(timr->it_sigev_signo, timr->sigq,
+                                   timr->it_process);
                if (likely(ret >= 0))
-                       return ret;
+                       goto out;
 
                timr->it_sigev_notify = SIGEV_SIGNAL;
                leader = timr->it_process->group_leader;
@@ -322,8 +327,12 @@ int posix_timer_event(struct k_itimer *timr,int si_private)
                timr->it_process = leader;
        }
 
-       return send_group_sigqueue(timr->it_sigev_signo, timr->sigq,
+       ret = send_group_sigqueue(timr->it_sigev_signo, timr->sigq,
                                   timr->it_process);
+out:
+       leave_vx_info(&vxis);
+       put_vx_info(vxis.vxi);
+       return ret;
 }
 EXPORT_SYMBOL_GPL(posix_timer_event);
 
@@ -973,3 +982,24 @@ sys_clock_nanosleep(const clockid_t which_clock, int flags,
        return CLOCK_DISPATCH(which_clock, nsleep,
                              (which_clock, flags, &t, rmtp));
 }
+
+/*
+ * nanosleep_restart for monotonic and realtime clocks
+ */
+static int common_nsleep_restart(struct restart_block *restart_block)
+{
+       return hrtimer_nanosleep_restart(restart_block);
+}
+
+/*
+ * This will restart clock_nanosleep. This is required only by
+ * compat_clock_nanosleep_restart for now.
+ */
+long
+clock_nanosleep_restart(struct restart_block *restart_block)
+{
+       clockid_t which_clock = restart_block->arg0;
+
+       return CLOCK_DISPATCH(which_clock, nsleep_restart,
+                             (restart_block));
+}