From owner-freebsd-scsi@FreeBSD.ORG Thu Aug 28 11:19:36 2003 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDE0F16A4BF for ; Thu, 28 Aug 2003 11:19:36 -0700 (PDT) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38DA143FA3 for ; Thu, 28 Aug 2003 11:19:34 -0700 (PDT) (envelope-from freebsd-scsi@m.gmane.org) Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19sRNY-0004di-00 for ; Thu, 28 Aug 2003 20:20:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-scsi@freebsd.org Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19sRFg-0004XA-00 for ; Thu, 28 Aug 2003 20:12:08 +0200 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 19sREy-0006IX-00 for ; Thu, 28 Aug 2003 20:11:24 +0200 From: Dan Nelson Date: Thu, 28 Aug 2003 13:11:19 -0500 Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030824 X-Accept-Language: en-us, en In-Reply-To: Sender: news Subject: Re: (Fwd) Re: SCSI tape data loss X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2003 18:19:36 -0000 Daniel Eischen wrote: > Can I ask a question? When writing to a character/block special file > in non-blocking mode, are there any instances where 0 can be returned > from the write() other than when writing to a tape device? > > The only way I can see to fix this in libc_r is to fstat() the > descriptor when the threads library initializes it (uthread_fd.c) > and save st_mode for that fd. Then in write() check to see if > it is S_ISCHR() or S_ISBLK() and 0 was returned. It could > break out of write() if that was the case and return 0 to > the caller. But this doesn't work if you can get 0 back > from a write to other devices. I would be inclined to always pass a zero return from read or write back to the application; doesn't a read/write on a nonblocking device return EAGAIN if there's nothing to do? -- Dan Nelson dnelson@allantgroup.com