lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 18/10/12 02:05, William Ahern wrote:
You can't poll on _regular_ files. It's actually a POSIX requirement that
regular files always signal immediate readiness for reading and writing.
Historically, block I/O devices were considered sufficiently fast in the
grand scheme of things that it was useless to poll on them. And it's also
really hard to implement in kernels--few (I can't think of any) do it
without relying on threads.

Character devices, named fifos, unix domain sockets... these things are not
regular files.

Perfectly clear and reasonable.

Then it comes another question: what happens when i open a, say, character device file with Lua's io.open()? What happens to it's fd? I suppose it's still not pollable (i remember getting busy waits when opening files with the wrong sync mode flag in nixio).

If so the problem to use luasocket to select on a serial device would be opening the file in the first place.

Jorge