To determine the completion of an asynchronous I/O event synchronously
rather than depend on a SIGIO interrupt, use poll(2). You can also poll to determine
the origin of a SIGIO interrupt.
slow when used on very large numbers of files. This problem is resolved by poll(7d).