nearly-tickless-tinc
Loïc Grenié
loic.grenie at gmail.com
Wed Jun 1 10:15:26 CEST 2011
2011/5/31 Guus Sliepen <guus at tinc-vpn.org>:
> On Mon, May 30, 2011 at 08:39:48AM +0200, Loïc Grenié wrote:
>
>> My wife has a Mac with MacOS/X (I think). I should be able to compile
>> something next week. pselect seems to be available since at least 10.3
>
> Great.
I'll test asap.
>> 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.
>> PS: in my first patch, the signal mask I gave as last argument of
>> pselect() was wrong, sorry. The attached patch should be correct.
>
> 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 ?
0) leave as is
1) #ifdef HAVE_PSELECT inside main_loop
2) something similar to:
#ifdef HAVE_PSELECT
#define tinc_pselect pselect
#define tinc_timespec timespec
#define tinc_sec tv_sec
#define tinc_nsec tv_nsec
#else
#define tinc_pselect(a,b,c,d,e,f) select((a),(b),(c),(d),(e))
#define tinc_timespec timeval
#define tinc_sec tv_sec
#define tinc_nsec tv_usec
#endif
with
struct tinc_timespec tv;
[...]
tv.tinc_sec = use_pselect?next_event-now:1;
tv.tinc_nsec = 0;
[...]
r = tinc_pselect(...)
in main_loop
3) something else ?
Thanks,
Loïc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tinc-pselect.diff
Type: text/x-diff
Size: 5236 bytes
Desc: not available
URL: <http://www.tinc-vpn.org/pipermail/tinc-devel/attachments/20110601/0e42fc75/attachment.diff>
More information about the tinc-devel
mailing list