[freetds] always poll, even without poll(2)

Frediano Ziglio freddy77 at gmail.com
Sat Dec 20 08:12:18 EST 2008


2008/12/20 James K. Lowden <jklowden at freetds.org>:
> I added src/replacements/fakepoll.c tonight.  Quite a bit cleaner than
> what I found on the 'Net, if I do say so myself, but the guts are the
> same.  You can learn a lot about poll/select by working on a function that
> does one in terms of the other.
>
> Currently it's named "fakepoll()" because when I named it "poll()", it
> supplanted poll(2) on my machine.  (Quite helpful for debugging it, btw!)
> Clearly there's a little autoconf work ahead.  (Freddy, if you know how to
> make fakepoll be used only when there's no poll(2), I'd be grateful if
> you'd show me.  I didn't want to add the whole contents of fakepoll.h to
> replacements.h.)
>

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.

> Always having poll/fakepoll around will mean we can drop #if USE_POLL from
> the code, as well as all references to select(2).  Probably we should
> rename tds_select to tds_poll at the same time....
>

well... or find a better name :) Currently tds_select does tree things:
- call select or poll to wait
- handle polling calls
- handle replies/cancellation

bye
  freddy77


More information about the FreeTDS mailing list