Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754232AbXFACs5 (ORCPT ); Thu, 31 May 2007 22:48:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752114AbXFACsu (ORCPT ); Thu, 31 May 2007 22:48:50 -0400 Received: from shawidc-mo1.cg.shawcable.net ([24.71.223.10]:64476 "EHLO pd2mo2so.prod.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbXFACst (ORCPT ); Thu, 31 May 2007 22:48:49 -0400 Date: Thu, 31 May 2007 20:48:59 -0600 From: Robert Hancock Subject: Re: SELECT() returns 1 But FIONREAD says (Input/output error) In-reply-to: To: Uncle George Cc: davids@webmaster.com, linux-kernel@vger.kernel.org Message-id: <465F891B.1080103@shaw.ca> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1242 Lines: 30 Uncle George wrote: > David Schwartz wrote: > >> Nope. An errored connection is always ready for read/write -- there is >> nothing to wait for as far as the kernel is concerned. Your code keeps >> asking the kernel if something interesting has happened, the kernel keeps >> telling it yes, and it refuses to do anything about it. >> > The select() returns because i pulled the USB cable from hub. Seems > reasonable. > > The next select() found what? to be interesting in order to prematurely > terminate the select-wait? As far as I can tell, nothing interesting has > happened since the previous select(). In this case the select() is only > looking at read()'s. It's because you haven't done anything to handle the error which is still persisting. Likely the only thing sane you can do in this case is close the fd and try to reopen it later. -- Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from hancockr@nospamshaw.ca Home Page: http://www.roberthancock.com/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/