From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 1 13:33:49 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 71EFB16A41F for ; Mon, 1 Aug 2005 13:33:49 +0000 (GMT) (envelope-from victor.cruceru@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 147F843D5E for ; Mon, 1 Aug 2005 13:33:24 +0000 (GMT) (envelope-from victor.cruceru@gmail.com) Received: by wproxy.gmail.com with SMTP id i4so1001977wra for ; Mon, 01 Aug 2005 06:33:24 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=BuN9b+7QdJxaicSu/NhlE7Hs1yplTQMxIp6Mlp+IcsHA3EEnysBmQef3i+3nOLVuUQfXw5zm9wjAnUZtgDN1ABBGGV7RKRozgToeBlhCDiH6SkCkxfx7oUCExjoosk1D//iMvFM2CLw0I/WQdpEYMHt90iwU5sQmwtiaeKMszVs= Received: by 10.54.2.57 with SMTP id 57mr2860865wrb; Mon, 01 Aug 2005 06:33:23 -0700 (PDT) Received: by 10.54.91.20 with HTTP; Mon, 1 Aug 2005 06:33:23 -0700 (PDT) Message-ID: <494025505080106336a329bb@mail.gmail.com> Date: Mon, 1 Aug 2005 16:33:23 +0300 From: victor cruceru To: Marc Olzheim In-Reply-To: <20050801130502.GA39470@stack.nl> Mime-Version: 1.0 References: <494025505080104427c3f91f6@mail.gmail.com> <20050801130502.GA39470@stack.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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 Reply-To: soc-victor@freebsd.org 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:33:49 -0000 Hi Marc, Thanks for the info. Here it is one my situation. I have a CF reader (fully= =20 detected by the USB subsystem) with two slots (one with a media and one without any media). An open with O_NONBLOCK on th= e=20 empty slot (/dev/da1) is blocking me. Is this OK?=20 Thanks, Victor=20 On 8/1/05, Marc Olzheim wrote: >=20 > 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= . > > /dev/acd0 or /dev/da1 with a CF reader attached) to block till the medi= a=20 > is > > ready or a timeout occurs. >=20 > I'd say that depends completely on whether you supply O_NONBLOCK or not, > so yes. >=20 > Quoted from a sound driver discussion at: > http://sourceforge.net/mailarchive/message.php?msg_id=3D10011826 >=20 >=20 > On block devices, O_NONBLOCK also is a way to say "don't try to do any > device discovery", ie you can do a O_NONBLOCK open on a removable disk > that doesn"t even have any media in it. Again, this has _nothing_ to do > with whether the device is "busy" or not. >=20 > ... >=20 > Short summary: >=20 > - O_NONBLOCK should generally be seen as just setting the O_NONBLOCK flag > "early" (ie it"s conceptually equivalent to doing a "F_SETFL" fcntl > before the open. It _may_ affect the open itself, but when it does, it > is generally considered to mean that you can open something that isn't > even _reachable_. >=20 > - POSIX doesn't say anything much about its behaviour, except for named > pipes, where it says the total reverse of what ALSA does. But that > doesn't actually mean anything, because even that is very much defined > as a special case by POSIX. >=20 > Marc >=20 >=20 >