From owner-cvs-src@FreeBSD.ORG Sat Aug 9 10:33:46 2008 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 050E6106568B; Sat, 9 Aug 2008 10:33:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 5E2CC8FC35; Sat, 9 Aug 2008 10:33:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m79AXcPH077568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Aug 2008 13:33:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m79AXcQO067846; Sat, 9 Aug 2008 13:33:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m79AXcX5067843; Sat, 9 Aug 2008 13:33:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 9 Aug 2008 13:33:38 +0300 From: Kostik Belousov To: Robert Watson Message-ID: <20080809103338.GN97161@deviant.kiev.zoral.com.ua> References: <200808081343.m78DhwYE068477@repoman.freebsd.org> <200808081226.32089.jhb@freebsd.org> <20080809001256.GL64458@server.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="02C+GlUcNvfRYA2K" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: src-committers@freebsd.org, John Baldwin , Peter Jeremy , Ed Schouten , cvs-all@freebsd.org, cvs-src@freebsd.org Subject: Re: cvs commit: src/sys/dev/io iodev.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Aug 2008 10:33:46 -0000 --02C+GlUcNvfRYA2K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 09, 2008 at 11:27:58AM +0100, Robert Watson wrote: >=20 > On Sat, 9 Aug 2008, Peter Jeremy wrote: >=20 > >On 2008-Aug-08 12:26:31 -0400, John Baldwin wrote: > >>It should be setting D_TRACKCLOSE though so that close() reliably clear= s=20 > >>the flag even in single-threaded processes. You can still get odd=20 > >>behavior if you explicitly open it twice in an app and then close one o= f=20 > >>the two fd's. You will no longer have IO permission even though you sti= ll=20 > >>have one fd open. However, if you do that I think you deserve what you= =20 > >>asked for. :) > > > >That behaviour may be legitimate: Your code links with libraries foo an= d=20 > >bar that each independently open /dev/io so they can frob different thin= gs=20 > >in IO space. libfoo needs ongoing access to device foo and so keeps its= =20 > >descriptor open. libbar only needs once-off access to device bar and so= =20 > >closes /dev/io once it's finished its initialisation. Libraries foo and= =20 > >bar are completely independent and shouldn't need to know anything about= =20 > >each other and your app shouldn't need to know that libraries it's using= =20 > >frob around in IO space. >=20 > If that's the view, there should probably be a per-process counter,=20 > although this is all a bit tricky anyway since file descriptors and=20 > processes have a tenuous relationship. Another interesting issue is the close on exec, esp. for /dev/io. It seems that Linux recently grown full new API to handle FD_CLOEXEC races, see http://udrepper.livejournal.com/20407.html --02C+GlUcNvfRYA2K Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkidcoEACgkQC3+MBN1Mb4iHpwCgmHo9VoMHSNUazRS/18mmkgTs g3gAoIcIXqc8YmW5mqfW/j8aAY6A//Q3 =PpBH -----END PGP SIGNATURE----- --02C+GlUcNvfRYA2K--