From owner-freebsd-arch@FreeBSD.ORG Thu Jul 10 02:25:13 2008 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0551106566C; Thu, 10 Jul 2008 02:25:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 317638FC1D; Thu, 10 Jul 2008 02:25:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m6A2OvAu028341; Wed, 9 Jul 2008 22:25:04 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Sergey Babkin Date: Wed, 9 Jul 2008 20:54:48 -0400 User-Agent: KMail/1.9.7 References: <9484951.340521215467447990.JavaMail.root@vms126.mailsrvcs.net> <20080708161802.N89342@fledge.watson.org> <20080708164853.GA40704@zim.MIT.EDU> In-Reply-To: <20080708164853.GA40704@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807092054.48748.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Wed, 09 Jul 2008 22:25:05 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/7680/Wed Jul 9 19:31:16 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: David Schultz , Robert Watson , Poul-Henning Kamp , freebsd-arch@FreeBSD.org Subject: Re: Proposal: a revoke() system call X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2008 02:25:13 -0000 On Tuesday 08 July 2008 12:48:53 pm David Schultz wrote: > On Tue, Jul 08, 2008, Robert Watson wrote: > > These sorts of edge cases, btw, are one reason why I would *strongly* > > discourage application writers from doing things like calling close(2) on a > > file descriptor while still using it from another thread. :-) > > My reaction is that apps should use standard concurrency control > primitives, e.g., pthreads primitives or message queues, to > coordinate the activities of multiple threads. The are scads of > ways to introduce race conditions when updating various aspects of > the process state (the fd table, in this case). Once we start > adding special-purpose APIs to facilitate clever lock-free tricks > in very specific cases, when will it stop? Next we'll want a > special version of exit(), a special version of sigaction(), a > special version of free(), and so forth. I agree, this just sounds like an application bug. Plus, even if we add a new system call that rescues drowning file descriptors it won't really help with writing a portable application anyway unless you get other OS's to adopt a similar API. Just use the extra pipe for messages and/or real locking (in your original example you have an obvious race with the use of 'mystructure' and the solution is Don't Do That(tm)). -- John Baldwin