Skip to Content.
Sympa Menu

freetds - Re: [freetds] always poll, even without poll(2)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] always poll, even without poll(2)
  • Date: Mon, 22 Dec 2008 23:16:12 -0500

Frediano Ziglio wrote:
>
> Mmmm... I would put fakepoll.h in include/replacements directory. Also
> there is similar function named tds_REPLACED so perhaps it would be
> better to call this function tds_poll for coherence. Also for
> coherence in include/replacements.h I used defines like
>
> #define poll(a,b,c) tds_poll(a,b,c)
>
> if poll is not defined. You could include
> include/replacements/fakepoll.h in include/replacements.h or just
> include <replacements/fakepoll.h> when used.

Will do.

I think this is wrong, though:

> Sat Dec 20 20:11:46 CET 2008
> * src/replacements/fakepoll.c:
> fix win32 portability issue

http://msdn.microsoft.com/en-us/library/ms740141(VS.85).aspx

Microsoft says they *ignore* nfds (parameter 1 of select(2)). So it's OK
to pass any value to Win32's select() function.

More important, we should check against FD_SETSIZE even on Win32:

"The variable FD_SETSIZE determines the maximum number of descriptors
in
a set. (The default value of FD_SETSIZE is 64, which can be modified by
defining FD_SETSIZE to another value before including Winsock2.h.)"

but the count, not the maxfd, is what matters.

I updated fakepoll.c according to that theory. I left in the maxfd
computation because preprocessor directives make code hard to read and
understand. The fewer we have, the better, even if it means a few extra
cycles.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page