> I'm trying to watch some (log)files for changes. For this purpose,
> non-blocking I/O and the select function look promising, unfortunately,
> I don't get them to work.
> Here's a snippet of my effort

Do not use Non-blocking I/O. This is not a concept that is useful here.
NBIO is to be used on pure streams, like pipes, sockets, ... many OS don't
support NBIO on regular files (e.g. afaik Linux). Anyway this would only
allow
you to send several requests to the kernel at the same time.

Repeatedly reading on EOF is what you need and is unrelated to NBIO, so
you can remove this:

>     testfile.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)

then, do not use select():

>       readAvail = select([testfile])[0]

readAvail = [testfile]

>         else
>           puts "-> Sleeping"
>           sleep(5)
>         end

Sleep outside of the loop. This will be friendlier for usage of many log
files.

> In the first iteration through the while-loop, the test file is read up
> to EOF; when I then append more lines to it, select wakes up, but
> apparently read doesn't read the new lines. What's happening?

I don't know whether select() works at all on regular files.

matju