Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ...

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Davide Libenzi <davidel@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Andrew Morton <akpm@...>, Linus Torvalds <torvalds@...>
Date: Monday, March 12, 2007 - 6:19 am

Davide,

On Sun, 2007-03-11 at 16:04 -0700, Davide Libenzi wrote:

Please move the validation for clockid, tmrtype and the timerspec into
sys_timerfd. Do it before anything else. Also please validate both
it_value and it_interval unconditionally. Userspace should not send
uninitialized stuff at all.

The TFD_TIMER_SEQ thing is quite different to all other timer interfaces
which POSIX provides. Both itimers and posixtimers use the it_interval
value to distinguish between one shot and periodic timers.

I think we should keep this new interface analogous, so programmers
don't get more confused, than they are already. :)

This also allows relative and absolute starting points for both one shot
and sequential timers.

Please use it_value == 0 to stop the timer. This is the same as for
itimers and posixtimers. Right now you have to close the fd to stop a
timer, but that's not necessarily what you want. 

Why do you want to store information, which is only relevant for setup
in ctx ?

If you do the validation right in sys_timerfd and get rid of
TFD_TIMER_SEQ and the various useless fields, then timerfd_setup() boils
down to

	ctx->ticks = 0;
	ctx->tintv = tintv;
	hrtimer_init(&ctx->tmr, clockid, htmode);
	ctx->tmr.function = timerfd_tmrproc;

	if (texp.tv64 != 0)
		hrtimer_start(&ctx->tmr, texp, htmode);

and in the timer function you simply check for

	if (ctx->tintv.tv64 != 0) 

instead of the TIMER_SEQ mode.


Do validation of clockid, tmrtype and ktmr here.


	return -ENOMEM;


	return -EBADF;


	return -EINVAL;


	-ENOPARSE. You probably mean: We need to stop an already running timer
before we do a new setup.


		return error;


	tglx


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 6/9] signalfd/timerfd v3 - timerfd core ..., Davide Libenzi, (Sun Mar 11, 7:04 pm)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Thomas Gleixner, (Mon Mar 12, 6:19 am)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Davide Libenzi, (Mon Mar 12, 2:46 pm)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Davide Libenzi, (Mon Mar 12, 3:00 pm)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Davide Libenzi, (Sun Mar 11, 7:13 pm)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Nicholas Miell, (Sun Mar 11, 7:50 pm)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Davide Libenzi, (Sun Mar 11, 8:16 pm)
Re: [patch 6/9] signalfd/timerfd v3 - timerfd core ..., Nicholas Miell, (Sun Mar 11, 7:52 pm)