From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 1 13:05:04 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 68E1016A41F; Mon, 1 Aug 2005 13:05:04 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id F060343D45; Mon, 1 Aug 2005 13:05:03 +0000 (GMT) (envelope-from marcolz@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id 7D03DA3D79; Mon, 1 Aug 2005 15:05:02 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 333) id 5D7EA63A4; Mon, 1 Aug 2005 15:05:02 +0200 (CEST) Date: Mon, 1 Aug 2005 15:05:02 +0200 From: Marc Olzheim To: soc-victor@freebsd.org Message-ID: <20050801130502.GA39470@stack.nl> References: <494025505080104427c3f91f6@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline In-Reply-To: <494025505080104427c3f91f6@mail.gmail.com> X-Operating-System: FreeBSD hammer.stack.nl 5.4-STABLE FreeBSD 5.4-STABLE X-URL: http://www.stack.nl/~marcolz/ User-Agent: Mutt/1.5.9i Cc: freebsd-hackers@freebsd.org Subject: Re: O_NONBLOCK for devices with removable media X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2005 13:05:04 -0000 --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 01, 2005 at 02:42:21PM +0300, victor cruceru wrote: > Hi all, > I'm just wondering if it's OK for an open syscall on such a device (i.e.= =20 > /dev/acd0 or /dev/da1 with a CF reader attached) to block till the media = is=20 > ready or a timeout occurs. I'd say that depends completely on whether you supply O_NONBLOCK or not, so yes. Quoted from a sound driver discussion at:=20 http://sourceforge.net/mailarchive/message.php?msg_id=3D10011826 On block devices, O_NONBLOCK also is a way to say "don't try to do any=20 device discovery", ie you can do a O_NONBLOCK open on a removable disk=20 that doesn"t even have any media in it. Again, this has _nothing_ to do=20 with whether the device is "busy" or not. =2E.. Short summary: =20 - O_NONBLOCK should generally be seen as just setting the O_NONBLOCK flag= =20 "early" (ie it"s conceptually equivalent to doing a "F_SETFL" fcntl=20 before the open. It _may_ affect the open itself, but when it does, it= =20 is generally considered to mean that you can open something that isn't= =20 even _reachable_. =20 - POSIX doesn't say anything much about its behaviour, except for named= =20 pipes, where it says the total reverse of what ALSA does. But that=20 doesn't actually mean anything, because even that is very much defined= =20 as a special case by POSIX. Marc --y0ulUmNC+osPPQO6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFC7h3+ezjnobFOgrERAtlKAJwOytkg9PPLqeIXJ6TmSFDwrZRiEwCgynB8 JTtEaJ3En4jNvgYdnKYCN1Q= =Rrpr -----END PGP SIGNATURE----- --y0ulUmNC+osPPQO6--