]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/posix-timers.c
Add cgroupstats
[mirror_ubuntu-bionic-kernel.git] / kernel / posix-timers.c
index 7a15afb73ed0352d9ee31f6d03334255c716e5a9..d11f579d189a1b75f753addcdfba961f7561b74b 100644 (file)
@@ -241,7 +241,8 @@ static __init int init_posix_timers(void)
        register_posix_clock(CLOCK_MONOTONIC, &clock_monotonic);
 
        posix_timers_cache = kmem_cache_create("posix_timers_cache",
-                                       sizeof (struct k_itimer), 0, 0, NULL);
+                                       sizeof (struct k_itimer), 0, SLAB_PANIC,
+                                       NULL);
        idr_init(&posix_timers_id);
        return 0;
 }
@@ -712,7 +713,7 @@ sys_timer_getoverrun(timer_t timer_id)
 {
        struct k_itimer *timr;
        int overrun;
-       long flags;
+       unsigned long flags;
 
        timr = lock_timer(timer_id, &flags);
        if (!timr)
@@ -784,7 +785,7 @@ sys_timer_settime(timer_t timer_id, int flags,
        struct k_itimer *timr;
        struct itimerspec new_spec, old_spec;
        int error = 0;
-       long flag;
+       unsigned long flag;
        struct itimerspec *rtn = old_setting ? &old_spec : NULL;
 
        if (!new_setting)
@@ -836,7 +837,7 @@ asmlinkage long
 sys_timer_delete(timer_t timer_id)
 {
        struct k_itimer *timer;
-       long flags;
+       unsigned long flags;
 
 retry_delete:
        timer = lock_timer(timer_id, &flags);
@@ -980,9 +981,20 @@ sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp)
 static int common_nsleep(const clockid_t which_clock, int flags,
                         struct timespec *tsave, struct timespec __user *rmtp)
 {
-       return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ?
-                                HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
-                                which_clock);
+       struct timespec rmt;
+       int ret;
+
+       ret = hrtimer_nanosleep(tsave, rmtp ? &rmt : NULL,
+                               flags & TIMER_ABSTIME ?
+                               HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
+                               which_clock);
+
+       if (ret && rmtp) {
+               if (copy_to_user(rmtp, &rmt, sizeof(*rmtp)))
+                       return -EFAULT;
+       }
+
+       return ret;
 }
 
 asmlinkage long