Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * fs/timerfd.c |
| 3 | * |
| 4 | * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> |
| 5 | * |
| 6 | * |
| 7 | * Thanks to Thomas Gleixner for code reviews and useful comments. |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | #include <linux/file.h> |
| 12 | #include <linux/poll.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/fs.h> |
| 15 | #include <linux/sched.h> |
| 16 | #include <linux/kernel.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 17 | #include <linux/slab.h> |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 18 | #include <linux/list.h> |
| 19 | #include <linux/spinlock.h> |
| 20 | #include <linux/time.h> |
| 21 | #include <linux/hrtimer.h> |
| 22 | #include <linux/anon_inodes.h> |
| 23 | #include <linux/timerfd.h> |
Adrian Bunk | 45cc2b9 | 2008-04-29 00:58:59 -0700 | [diff] [blame] | 24 | #include <linux/syscalls.h> |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 25 | |
| 26 | struct timerfd_ctx { |
| 27 | struct hrtimer tmr; |
| 28 | ktime_t tintv; |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 29 | ktime_t moffs; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 30 | wait_queue_head_t wqh; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 31 | u64 ticks; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 32 | int expired; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 33 | int clockid; |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 34 | bool might_cancel; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | /* |
| 38 | * This gets called when the timer event triggers. We set the "expired" |
| 39 | * flag, but we do not re-arm the timer (in case it's necessary, |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 40 | * tintv.tv64 != 0) until the timer is accessed. |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 41 | */ |
| 42 | static enum hrtimer_restart timerfd_tmrproc(struct hrtimer *htmr) |
| 43 | { |
| 44 | struct timerfd_ctx *ctx = container_of(htmr, struct timerfd_ctx, tmr); |
| 45 | unsigned long flags; |
| 46 | |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 47 | spin_lock_irqsave(&ctx->wqh.lock, flags); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 48 | ctx->expired = 1; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 49 | ctx->ticks++; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 50 | wake_up_locked(&ctx->wqh); |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 51 | spin_unlock_irqrestore(&ctx->wqh.lock, flags); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 52 | |
| 53 | return HRTIMER_NORESTART; |
| 54 | } |
| 55 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 56 | static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx) |
| 57 | { |
Arjan van de Ven | 7636947 | 2008-09-01 15:00:14 -0700 | [diff] [blame] | 58 | ktime_t remaining; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 59 | |
Arjan van de Ven | 7636947 | 2008-09-01 15:00:14 -0700 | [diff] [blame] | 60 | remaining = hrtimer_expires_remaining(&ctx->tmr); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 61 | return remaining.tv64 < 0 ? ktime_set(0, 0): remaining; |
| 62 | } |
| 63 | |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 64 | static bool timerfd_canceled(struct timerfd_ctx *ctx) |
| 65 | { |
| 66 | ktime_t moffs; |
| 67 | |
| 68 | if (!ctx->might_cancel) |
| 69 | return false; |
| 70 | |
| 71 | moffs = ktime_get_monotonic_offset(); |
| 72 | |
| 73 | if (moffs.tv64 == ctx->moffs.tv64) |
| 74 | return false; |
| 75 | |
| 76 | ctx->moffs = moffs; |
| 77 | return true; |
| 78 | } |
| 79 | |
| 80 | static int timerfd_setup(struct timerfd_ctx *ctx, int flags, |
| 81 | const struct itimerspec *ktmr) |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 82 | { |
| 83 | enum hrtimer_mode htmode; |
| 84 | ktime_t texp; |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 85 | int clockid = ctx->clockid; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 86 | |
| 87 | htmode = (flags & TFD_TIMER_ABSTIME) ? |
| 88 | HRTIMER_MODE_ABS: HRTIMER_MODE_REL; |
| 89 | |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 90 | ctx->might_cancel = false; |
| 91 | if (htmode == HRTIMER_MODE_ABS && ctx->clockid == CLOCK_REALTIME && |
| 92 | (flags & TFD_TIMER_CANCELON_SET)) { |
| 93 | clockid = CLOCK_REALTIME_COS; |
| 94 | ctx->might_cancel = true; |
| 95 | } |
| 96 | |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 97 | texp = timespec_to_ktime(ktmr->it_value); |
| 98 | ctx->expired = 0; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 99 | ctx->ticks = 0; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 100 | ctx->tintv = timespec_to_ktime(ktmr->it_interval); |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 101 | hrtimer_init(&ctx->tmr, clockid, htmode); |
Arjan van de Ven | 7636947 | 2008-09-01 15:00:14 -0700 | [diff] [blame] | 102 | hrtimer_set_expires(&ctx->tmr, texp); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 103 | ctx->tmr.function = timerfd_tmrproc; |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 104 | if (texp.tv64 != 0) { |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 105 | hrtimer_start(&ctx->tmr, texp, htmode); |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 106 | if (timerfd_canceled(ctx)) |
| 107 | return -ECANCELED; |
| 108 | } |
| 109 | return 0; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | static int timerfd_release(struct inode *inode, struct file *file) |
| 113 | { |
| 114 | struct timerfd_ctx *ctx = file->private_data; |
| 115 | |
| 116 | hrtimer_cancel(&ctx->tmr); |
| 117 | kfree(ctx); |
| 118 | return 0; |
| 119 | } |
| 120 | |
| 121 | static unsigned int timerfd_poll(struct file *file, poll_table *wait) |
| 122 | { |
| 123 | struct timerfd_ctx *ctx = file->private_data; |
| 124 | unsigned int events = 0; |
| 125 | unsigned long flags; |
| 126 | |
| 127 | poll_wait(file, &ctx->wqh, wait); |
| 128 | |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 129 | spin_lock_irqsave(&ctx->wqh.lock, flags); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 130 | if (ctx->ticks) |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 131 | events |= POLLIN; |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 132 | spin_unlock_irqrestore(&ctx->wqh.lock, flags); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 133 | |
| 134 | return events; |
| 135 | } |
| 136 | |
| 137 | static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count, |
| 138 | loff_t *ppos) |
| 139 | { |
| 140 | struct timerfd_ctx *ctx = file->private_data; |
| 141 | ssize_t res; |
Davide Libenzi | 0982840 | 2007-07-26 10:41:07 -0700 | [diff] [blame] | 142 | u64 ticks = 0; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 143 | |
| 144 | if (count < sizeof(ticks)) |
| 145 | return -EINVAL; |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 146 | spin_lock_irq(&ctx->wqh.lock); |
Michal Nazarewicz | 8120a8a | 2010-05-05 12:53:12 +0200 | [diff] [blame] | 147 | if (file->f_flags & O_NONBLOCK) |
| 148 | res = -EAGAIN; |
| 149 | else |
| 150 | res = wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks); |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 151 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 152 | if (ctx->ticks) { |
| 153 | ticks = ctx->ticks; |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 154 | |
| 155 | /* |
| 156 | * If clock has changed, we do not care about the |
| 157 | * ticks and we do not rearm the timer. Userspace must |
| 158 | * reevaluate anyway. |
| 159 | */ |
| 160 | if (timerfd_canceled(ctx)) { |
| 161 | ticks = 0; |
| 162 | ctx->expired = 0; |
| 163 | res = -ECANCELED; |
| 164 | } |
| 165 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 166 | if (ctx->expired && ctx->tintv.tv64) { |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 167 | /* |
| 168 | * If tintv.tv64 != 0, this is a periodic timer that |
| 169 | * needs to be re-armed. We avoid doing it in the timer |
| 170 | * callback to avoid DoS attacks specifying a very |
| 171 | * short timer period. |
| 172 | */ |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 173 | ticks += hrtimer_forward_now(&ctx->tmr, |
| 174 | ctx->tintv) - 1; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 175 | hrtimer_restart(&ctx->tmr); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 176 | } |
| 177 | ctx->expired = 0; |
| 178 | ctx->ticks = 0; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 179 | } |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 180 | spin_unlock_irq(&ctx->wqh.lock); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 181 | if (ticks) |
Davide Libenzi | 0982840 | 2007-07-26 10:41:07 -0700 | [diff] [blame] | 182 | res = put_user(ticks, (u64 __user *) buf) ? -EFAULT: sizeof(ticks); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 183 | return res; |
| 184 | } |
| 185 | |
| 186 | static const struct file_operations timerfd_fops = { |
| 187 | .release = timerfd_release, |
| 188 | .poll = timerfd_poll, |
| 189 | .read = timerfd_read, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 190 | .llseek = noop_llseek, |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 191 | }; |
| 192 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 193 | static struct file *timerfd_fget(int fd) |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 194 | { |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 195 | struct file *file; |
| 196 | |
| 197 | file = fget(fd); |
| 198 | if (!file) |
| 199 | return ERR_PTR(-EBADF); |
| 200 | if (file->f_op != &timerfd_fops) { |
| 201 | fput(file); |
| 202 | return ERR_PTR(-EINVAL); |
| 203 | } |
| 204 | |
| 205 | return file; |
| 206 | } |
| 207 | |
Heiko Carstens | 836f92a | 2009-01-14 14:14:33 +0100 | [diff] [blame] | 208 | SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 209 | { |
Al Viro | 2030a42 | 2008-02-23 06:46:49 -0500 | [diff] [blame] | 210 | int ufd; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 211 | struct timerfd_ctx *ctx; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 212 | |
Ulrich Drepper | e38b36f | 2008-07-23 21:29:42 -0700 | [diff] [blame] | 213 | /* Check the TFD_* constants for consistency. */ |
| 214 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); |
| 215 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); |
| 216 | |
Davide Libenzi | 610d18f | 2009-02-18 14:48:18 -0800 | [diff] [blame] | 217 | if ((flags & ~TFD_CREATE_FLAGS) || |
| 218 | (clockid != CLOCK_MONOTONIC && |
| 219 | clockid != CLOCK_REALTIME)) |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 220 | return -EINVAL; |
| 221 | |
| 222 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
| 223 | if (!ctx) |
| 224 | return -ENOMEM; |
| 225 | |
| 226 | init_waitqueue_head(&ctx->wqh); |
| 227 | ctx->clockid = clockid; |
| 228 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 229 | ctx->moffs = ktime_get_monotonic_offset(); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 230 | |
Ulrich Drepper | 11fcb6c | 2008-07-23 21:29:26 -0700 | [diff] [blame] | 231 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
Roland Dreier | 628ff7c | 2009-12-18 09:41:24 -0800 | [diff] [blame] | 232 | O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); |
Al Viro | 2030a42 | 2008-02-23 06:46:49 -0500 | [diff] [blame] | 233 | if (ufd < 0) |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 234 | kfree(ctx); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 235 | |
| 236 | return ufd; |
| 237 | } |
| 238 | |
Heiko Carstens | 836f92a | 2009-01-14 14:14:33 +0100 | [diff] [blame] | 239 | SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, |
| 240 | const struct itimerspec __user *, utmr, |
| 241 | struct itimerspec __user *, otmr) |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 242 | { |
| 243 | struct file *file; |
| 244 | struct timerfd_ctx *ctx; |
| 245 | struct itimerspec ktmr, kotmr; |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 246 | int ret; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 247 | |
| 248 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) |
| 249 | return -EFAULT; |
| 250 | |
Davide Libenzi | 610d18f | 2009-02-18 14:48:18 -0800 | [diff] [blame] | 251 | if ((flags & ~TFD_SETTIME_FLAGS) || |
| 252 | !timespec_valid(&ktmr.it_value) || |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 253 | !timespec_valid(&ktmr.it_interval)) |
| 254 | return -EINVAL; |
| 255 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 256 | file = timerfd_fget(ufd); |
| 257 | if (IS_ERR(file)) |
| 258 | return PTR_ERR(file); |
| 259 | ctx = file->private_data; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 260 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 261 | /* |
| 262 | * We need to stop the existing timer before reprogramming |
| 263 | * it to the new values. |
| 264 | */ |
| 265 | for (;;) { |
| 266 | spin_lock_irq(&ctx->wqh.lock); |
| 267 | if (hrtimer_try_to_cancel(&ctx->tmr) >= 0) |
| 268 | break; |
Davide Libenzi | 18963c0 | 2007-05-18 12:02:33 -0700 | [diff] [blame] | 269 | spin_unlock_irq(&ctx->wqh.lock); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 270 | cpu_relax(); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 273 | /* |
| 274 | * If the timer is expired and it's periodic, we need to advance it |
| 275 | * because the caller may want to know the previous expiration time. |
| 276 | * We do not update "ticks" and "expired" since the timer will be |
| 277 | * re-programmed again in the following timerfd_setup() call. |
| 278 | */ |
| 279 | if (ctx->expired && ctx->tintv.tv64) |
| 280 | hrtimer_forward_now(&ctx->tmr, ctx->tintv); |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 281 | |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 282 | kotmr.it_value = ktime_to_timespec(timerfd_get_remaining(ctx)); |
| 283 | kotmr.it_interval = ktime_to_timespec(ctx->tintv); |
| 284 | |
| 285 | /* |
| 286 | * Re-program the timer to the new value ... |
| 287 | */ |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 288 | ret = timerfd_setup(ctx, flags, &ktmr); |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 289 | |
| 290 | spin_unlock_irq(&ctx->wqh.lock); |
| 291 | fput(file); |
| 292 | if (otmr && copy_to_user(otmr, &kotmr, sizeof(kotmr))) |
| 293 | return -EFAULT; |
| 294 | |
Thomas Gleixner | 99ee531 | 2011-04-27 14:16:42 +0200 | [diff] [blame^] | 295 | return ret; |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 296 | } |
| 297 | |
Heiko Carstens | d4e8204 | 2009-01-14 14:14:34 +0100 | [diff] [blame] | 298 | SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) |
Davide Libenzi | 4d672e7 | 2008-02-04 22:27:26 -0800 | [diff] [blame] | 299 | { |
| 300 | struct file *file; |
| 301 | struct timerfd_ctx *ctx; |
| 302 | struct itimerspec kotmr; |
| 303 | |
| 304 | file = timerfd_fget(ufd); |
| 305 | if (IS_ERR(file)) |
| 306 | return PTR_ERR(file); |
| 307 | ctx = file->private_data; |
| 308 | |
| 309 | spin_lock_irq(&ctx->wqh.lock); |
| 310 | if (ctx->expired && ctx->tintv.tv64) { |
| 311 | ctx->expired = 0; |
| 312 | ctx->ticks += |
| 313 | hrtimer_forward_now(&ctx->tmr, ctx->tintv) - 1; |
| 314 | hrtimer_restart(&ctx->tmr); |
| 315 | } |
| 316 | kotmr.it_value = ktime_to_timespec(timerfd_get_remaining(ctx)); |
| 317 | kotmr.it_interval = ktime_to_timespec(ctx->tintv); |
| 318 | spin_unlock_irq(&ctx->wqh.lock); |
| 319 | fput(file); |
| 320 | |
| 321 | return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0; |
Davide Libenzi | b215e28 | 2007-05-10 22:23:16 -0700 | [diff] [blame] | 322 | } |
| 323 | |