From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 29 04:43:25 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 C83F81065670 for ; Mon, 29 Nov 2010 04:43:25 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5ABEB8FC0C for ; Mon, 29 Nov 2010 04:43:24 +0000 (UTC) Received: by wyf19 with SMTP id 19so3941247wyf.13 for ; Sun, 28 Nov 2010 20:43:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=UyDqmAlBul4+ZtAmSS67Wml4nBUDcnPb6bdbdJjuyqc=; b=GI6anm4ig8UGjI7a4IvCR0W7d+u4XN/bXWWtK6HmF9LH2XCNQ2NjqoaxuVKrjjGzrX pMU0ThdYc/+MbeAZKdm4OebdoTgFhItzhld25jWu5hwVq99TCcQ/Onar+UO2xCuavfzh AvCTtFjlFLAX5UXmB97y3jw0sovU9M5ohQ6ns= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=n/spOVnGN07fX6Vxe+EbJciQmtJV4WlbNTmR8HmTxnWSUSlGELeRrDnYjVGxwBy7/Q gy5roij8UOfqlPyLN8MOIWgCMy+eJmM6hdTClbnRPpcKVdOvDoQQUV+5p0o3XV+X0vI0 6397v/7wr49JzBf26czaWvYgW5jgUgobaYmB0= MIME-Version: 1.0 Received: by 10.216.46.200 with SMTP id r50mr2947919web.45.1291005804203; Sun, 28 Nov 2010 20:43:24 -0800 (PST) Sender: yanegomi@gmail.com Received: by 10.216.198.27 with HTTP; Sun, 28 Nov 2010 20:43:24 -0800 (PST) In-Reply-To: <4CEEC3BD.3080204@delphij.net> References: <4CEEC3BD.3080204@delphij.net> Date: Sun, 28 Nov 2010 20:43:24 -0800 X-Google-Sender-Auth: 7FQou0POowx6UFNeGd5R9ubuRik Message-ID: From: Garrett Cooper To: d@delphij.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD-Hackers Subject: Re: Is it possible to have file removed upon process exit? 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, 29 Nov 2010 04:43:25 -0000 On Thu, Nov 25, 2010 at 12:14 PM, Xin LI wrote: > -----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. =A0This > 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. =A0Is there a clean way to do this? Does it have to be nameless and/or unique? Thanks, -Garrett