From owner-freebsd-scsi@FreeBSD.ORG Sun Aug 31 17:34:20 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 7D3C516A4BF for ; Sun, 31 Aug 2003 17:34:20 -0700 (PDT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by mx1.FreeBSD.org (Postfix) with ESMTP id C440D43F85 for ; Sun, 31 Aug 2003 17:34:19 -0700 (PDT) (envelope-from dan@langille.org) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id DFDDC3D28; Sun, 31 Aug 2003 20:34:18 -0400 (EDT) From: "Dan Langille" To: Dan Nelson Date: Sun, 31 Aug 2003 20:35:38 -0400 MIME-Version: 1.0 Message-ID: <3F525C1A.21504.35EB4B7E@localhost> Priority: normal In-reply-to: References: X-mailer: Pegasus Mail for Windows (v4.02a) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body cc: freebsd-scsi@freebsd.org 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: Mon, 01 Sep 2003 00:34:20 -0000 On 28 Aug 2003 at 13:11, Dan Nelson wrote: > 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? Should a PR be opened? -- Dan Langille : http://www.langille.org/