Waiting for I/O operations with poll() and select()