Re: [patch 1/3] timerfd: Implement show_fdinfo method

From: Thomas Gleixner
Date: Wed May 21 2014 - 17:42:00 EST


On Tue, 29 Apr 2014, Cyrill Gorcunov wrote:
>
> +static int timerfd_show(struct seq_file *m, struct file *file)
> +{
> + struct timerfd_ctx *ctx = file->private_data;
> + struct itimerspec t;
> +
> + spin_lock_irq(&ctx->wqh.lock);
> + t.it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
> + t.it_interval = ktime_to_timespec(ctx->tintv);
> + spin_unlock_irq(&ctx->wqh.lock);
> +
> + return seq_printf(m,
> + "clockid: %d\n"
> + "ticks: %llu\n"
> + "settime flags: 0%o\n"
> + "it_value: (%llu, %llu)\n"
> + "it_interval: (%llu, %llu)\n",
> + ctx->clockid, (unsigned long long)ctx->ticks,
> + ctx->settime_flags,
> + (unsigned long long)t.it_value.tv_sec,
> + (unsigned long long)t.it_value.tv_nsec,
> + (unsigned long long)t.it_interval.tv_sec,
> + (unsigned long long)t.it_interval.tv_nsec);
> +}

Shouldn't this depend on CONFIG_PROCFS?

> static const struct file_operations timerfd_fops = {
> .release = timerfd_release,
> .poll = timerfd_poll,
> .read = timerfd_read,
> .llseek = noop_llseek,
> + .show_fdinfo = timerfd_show,
> };
>
> static int timerfd_fget(int fd, struct fd *p)
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/