diff options
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r-- | fs/timerfd.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index 77183f047f65..709603cac9e6 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -315,12 +315,49 @@ static int timerfd_show(struct seq_file *m, struct file *file) | |||
315 | #define timerfd_show NULL | 315 | #define timerfd_show NULL |
316 | #endif | 316 | #endif |
317 | 317 | ||
318 | #ifdef CONFIG_CHECKPOINT_RESTORE | ||
319 | static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
320 | { | ||
321 | struct timerfd_ctx *ctx = file->private_data; | ||
322 | int ret = 0; | ||
323 | |||
324 | switch (cmd) { | ||
325 | case TFD_IOC_SET_TICKS: { | ||
326 | u64 ticks; | ||
327 | |||
328 | if (copy_from_user(&ticks, (u64 __user *)arg, sizeof(ticks))) | ||
329 | return -EFAULT; | ||
330 | if (!ticks) | ||
331 | return -EINVAL; | ||
332 | |||
333 | spin_lock_irq(&ctx->wqh.lock); | ||
334 | if (!timerfd_canceled(ctx)) { | ||
335 | ctx->ticks = ticks; | ||
336 | if (ticks) | ||
337 | wake_up_locked(&ctx->wqh); | ||
338 | } else | ||
339 | ret = -ECANCELED; | ||
340 | spin_unlock_irq(&ctx->wqh.lock); | ||
341 | break; | ||
342 | } | ||
343 | default: | ||
344 | ret = -ENOTTY; | ||
345 | break; | ||
346 | } | ||
347 | |||
348 | return ret; | ||
349 | } | ||
350 | #else | ||
351 | #define timerfd_ioctl NULL | ||
352 | #endif | ||
353 | |||
318 | static const struct file_operations timerfd_fops = { | 354 | static const struct file_operations timerfd_fops = { |
319 | .release = timerfd_release, | 355 | .release = timerfd_release, |
320 | .poll = timerfd_poll, | 356 | .poll = timerfd_poll, |
321 | .read = timerfd_read, | 357 | .read = timerfd_read, |
322 | .llseek = noop_llseek, | 358 | .llseek = noop_llseek, |
323 | .show_fdinfo = timerfd_show, | 359 | .show_fdinfo = timerfd_show, |
360 | .unlocked_ioctl = timerfd_ioctl, | ||
324 | }; | 361 | }; |
325 | 362 | ||
326 | static int timerfd_fget(int fd, struct fd *p) | 363 | static int timerfd_fget(int fd, struct fd *p) |