lkml.org 
[lkml]   [2014]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/3] timerfd: Implement show_fdinfo method
On 04/08/2014 10:42 AM, Cyrill Gorcunov wrote:
> On Tue, Apr 08, 2014 at 10:17:14AM +0400, Vladimir Davydov 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",
>> IMO, one would expect to setup the timer on restore by passing the
>> values of settime_flags, it_value, and it_interval obtained from the
>> fdinfo to sys_timerfd_settime, but this will be incorrect, because AFAIU
>> the it_value you report here is always relative to the current time, no
>> matter whether TFD_TIMER_ABSTIME was set in settime_flags or not. Is it OK?
> Hi Vladimir! Well it_value returns remaining time so it's up to user to
> adjust this value when restore with abs time. That said one can examinate
> if abs flag was set and restore accordingly. If this is vague I'm open
> to change it to more clear way. Ideas?

If it's intended, it should be documented explicitly I think. Currently
in the doc patch I see nothing about whether expiration time is absolute
or relative:

> 'it_value' and 'it_interval' are the expiration time and interval for the timer.

Thanks.


\
 
 \ /
  Last update: 2014-04-08 09:41    [W:0.066 / U:3.736 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site