nearly-tickless-tinc
Loïc Grenié
loic.grenie at gmail.com
Thu Jun 2 10:43:43 CEST 2011
2011/6/1 Guus Sliepen <guus at tinc-vpn.org>:
> On Wed, Jun 01, 2011 at 10:15:26AM +0200, Loïc Grenié wrote:
>
>> >> However, once again, if pselect() is not available or not compatible or
>> >> whatever it can be emulated with a select:
>> >
>> > Yes. You can add a check in configure.in for pselect(), and add the necessary
>> > #ifdefs to ensure it automatically selects the right thing.
>>
>> What do you think about the racy "glibc pselect" ? Right now I do
>> not test for it. It is probably possible to test for it using
>> syscall(2), either
>> at compile time or at runtime.
>
> Well, it is not so critical, and the problem is only with kernels that are more
> than five years old.
tincd is not tickless anyway: there is a tick for keepalive, that means that
signal handling will be at most delayed.
> If you really want, you could add a runtime check using the uname() function.
I do not "really" want. If you think it's not critical, I'm happy
to leave it
that way.
>> > Looks good! If you can add the configure.in checks, and write a description for
>> > your patch, I can commit it to the git repository without any changes :)
>>
>> We'll see ! Right now I have hijacked timespec and tv_nsec in net.c
>> -- when not using pselect() -- to streamline mail_loop source code -- it's
>> probably not very good software engineering. What do you prefer ?
>
> Hm, in this case it is better to explicitly use #ifdef ... #else ... #endif in
> the main loop, instead of #defining tinc_pselect and friends. With the former
> it is more clear what happens.
Here you go !
It is probably a good idea to also change time comparison: with this
patch "now" is evaluated after pselect(), thus with code like this:
timeout = now+1;
[... pselect() lasting 1s ... ]
if (timeout < now) {
contional code
}
conditional code will not get executed. It would be if comparison were
timeout <= now (the instruction "next_event++;" in the patch would
also disappear). I can take care of it.
Thanks,
Loïc
More information about the tinc-devel
mailing list