[sane-devel] Use poll() instead of select() in backends

Nils Philippsen nils at tiptoe.de
Thu Aug 28 15:58:52 UTC 2014

Hi there,

I recently got a bug report in Fedora[1] about a crash in the epson2
driver -- apparently, LibreOffice sometimes has more than 1024 open file
descriptors and a subsequently created socket (for accessing a network
scanner) gets a file descriptor > FD_SETSIZE.

IMO the best alternative would be to switch to using poll() but I'm not
sure how if that is supported by all platforms we support... Mind that
there are other drivers which use poll() exclusively without checking
for HAVE_POLL or similar (saned does its own cheap implementation of
poll() using select() if poll() isn't made available by the OS).

I think we should at least default to using poll() (so LO and possibly
OO don't crash if they use SANE and a networked scanner), but if we
don't support platforms that don't have it it's much less clutter to
ditch select() and replace it with poll() completely. Otherwise it's
something that should maybe be abstracted away in sanei.

What's your opinion?


[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1129771
Nils Philippsen / Wilhelmstraße 22 / D-71229 Leonberg 
nils at tiptoe.de / nils at redhat.com
PGP fingerprint:  C4A8 9474 5C4C ADE3 2B8F  656D 47D8 9B65 6951 3011
Ever noticed that common sense isn't really all that common?

More information about the sane-devel mailing list