From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 25 20:15:11 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D20410656A3 for ; Thu, 25 Nov 2010 20:15:11 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [IPv6:2001:470:a803::1]) by mx1.freebsd.org (Postfix) with ESMTP id A08DD8FC14 for ; Thu, 25 Nov 2010 20:15:08 +0000 (UTC) Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id A0D09A67D7F; Fri, 26 Nov 2010 04:15:07 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with LMTP id kwMpeBTKRwNw; Fri, 26 Nov 2010 04:14:58 +0800 (CST) Received: from delta.delphij.net (c-76-102-26-215.hsd1.ca.comcast.net [76.102.26.215]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 8B0C9A67D70; Fri, 26 Nov 2010 04:14:57 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:subject:x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=mFPT6l0LTG+sGjGXTmMz5mJOC0rDLsnVrZBMEnNjq2Fg1GpKHCETD2VfIHyaWbodR 4ybh8TXpvv9Y7siVAXYyA== Message-ID: <4CEEC3BD.3080204@delphij.net> Date: Thu, 25 Nov 2010 12:14:53 -0800 From: Xin LI Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.15) Gecko/20101028 Thunderbird/3.0.10 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: FreeBSD-Hackers X-Enigmail-Version: 1.0.1 OpenPGP: id=3FCA37C1; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Is it possible to have file removed upon process exit? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 20:15:11 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, One pretty common way of having an i-node of a file removed when process exit is to unlink() it while holding a descriptor of the file. This approach, however, have a side effect that other processes would not be able to access the file via its name. For certain applications it is sometimes desirable to (e.g. for unix domain sockets) have file removed when the process quit, regardless whether the process is quit cleanly. Is there a clean way to do this? Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJM7sO9AAoJEATO+BI/yjfBlRQH/3zzmh6OtmMJs0CWNsH9eOQk mpSi5BJE9HHIbzPCMSGvujFn/HjQa5K752/A0J7Gulu/2wNYnY6013tuypnHZy0+ tPMVWWWpj3otqJuvcxBMeqNisA9RL+DS2ZMbUQs3t7vd9qHkJE1Honb97nFQ/o57 bUAYFUoFEjBgYiF0JrPQOXxHZacOhEtHrTj9qbtrZM+qcGZl01cTDfHTd7aP5yJ+ HnZVh/0CKMdcOH/9tI04pZ+beK9RwaPVLS0NxIfsVIx+1o1zP3rHIaEWczM21SsU gDDzQ6ypBE3dEJbQ7OH0UqezjLpX7JKUpSSjC4FRnL4VDZrUAH8Nh6wT+gcncc0= =1W2r -----END PGP SIGNATURE-----