From owner-freebsd-scsi Mon Dec 20 22:40:50 1999 Delivered-To: freebsd-scsi@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id D263E153F8; Mon, 20 Dec 1999 22:40:45 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.3) with ESMTP id WAA10946; Mon, 20 Dec 1999 22:39:04 -0800 (PST) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id WAA41264; Mon, 20 Dec 1999 22:39:03 -0800 (PST) (envelope-from jdp@polstra.com) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Mon, 20 Dec 1999 22:39:03 -0800 (PST) Organization: Polstra & Co., Inc. From: John Polstra To: Matthew Jacob Subject: Re: filemarks? Cc: scsi@freebsd.org, phk@freebsd.org, Stephen McKay , Greg Lehey , Bob Bishop , Thomas David Rivers , "Rodney W. Grimes" , Joerg Wunsch , Hauke Fath Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Matthew Jacob wrote: > A user application detects EARLY WARNING during writing by > getting a return from the write(2) system call of zero (zero > bytes were written). If the device open is the non-rewinding > tape device, the application may close and reopen it and > continue writing until physical end of medium I'm sorry, but this is not the Unix elegance we all know and love. You're twisting yourself into knots trying to fit a square peg into a round hole. End of media is a classic "exceptional condition" and it needs to be handled as such. It can't just be contorted into the existing API, which simply has no room for it. That's why until now there has been no standard Unix way to deal with end of media -- because it doesn't fit into the constraints of the write(2) API. I say again that the most reasonable way in Unix to handle exceptional conditions is to raise a signal. That's what signals are for. I disagree with your earlier statement that signals are hard to program. All you have to do in the signal handler is set a flag. The mainline code, when it sees the flag, will do whatever it would have done if the write() call had returned a short count under your proposal. The use of a signal for this is no different in concept than many other uses of signals. Think about SIGPIPE, SIGXFSZ, SIGXCPU, and SIGURG, for example, and you'll see that they serve the same kind of purpose. > p.s.: and thanks for the positive discussion on this! Finally we may be > able to get somewhere .... I think this discussion needs to take place on -arch or -current if it is to carry any weight. There are people who care about this stuff and who have informed opinions who aren't being included. How about moving it to -arch? John To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message