Date: Sat, 27 Nov 2010 23:08:15 +0200 From: Peter Pentchev <roam@ringlet.net> To: Dirk-Willem van Gulik <dirkx@webweaving.org> Cc: "Carlos A. M. dos Santos" <unixmania@gmail.com>, FreeBSD-Hackers <freebsd-hackers@freebsd.org>, Dimitry Andric <dim@freebsd.org>, d@delphij.net Subject: Re: Is it possible to have file removed upon process exit? Message-ID: <20101127210815.GC3810@straylight.ringlet.net> In-Reply-To: <2096C74B-62C5-4841-B05D-A3C55E759291@webweaving.org> References: <4CEEC3BD.3080204@delphij.net> <4CF13D7A.4060904@FreeBSD.org> <AANLkTikH_uD1-yUe6KTufBvs9zRdQ%2BiMVQWcavBYRXU9@mail.gmail.com> <2096C74B-62C5-4841-B05D-A3C55E759291@webweaving.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 27, 2010 at 08:16:54PM +0100, Dirk-Willem van Gulik wrote: >=20 > Op 27 nov 2010, om 20:07 heeft Carlos A. M. dos Santos het volgende gesch= reven: >=20 > > On Sat, Nov 27, 2010 at 3:18 PM, Dimitry Andric <dim@freebsd.org> wrote: > >> On 2010-11-25 21:14, Xin LI wrote: > >>>=20 > >>> 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? > >>=20 > >> Maybe your process could be the child of a parent which cleans up > >> afterwards? (This is an analogy from real life. ;) >=20 > Another option, depending on the situation is to fopen()/open() the file = - and as soon as that is successfully done by all involved - have the creat= ing process delete it. Errr... didn't the original poster also write the following? :) (admittedly, in a part that the follow-uppers skipped) > >>> One pretty common way of having an i-node of a file removed when proc= ess > >>> 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. G'luck, Peter --=20 Peter Pentchev roam@space.bg roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 You have, of course, just begun reading the sentence that you have just fin= ished reading. --huq684BweRXVnRxX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJM8XMwAAoJEGUe77AlJ98TV80QAJTafcUMDkOZGQ8kp0vGD5QP YLWZUIkJA/k9/4a5/AxlFC6bdLYgYT85i/U4j1CxEybC9tJNJuoZOiyZO3uEarO/ 24RCDdm0nORQc1Yh1xJDe5RCVBhVmaAbTSikYPo7rYf1R8bkbRc5aYspJVyPmxy7 XZR4mbMu1bbzmmZpOcVaAhnqVhB/8HeCkWH+47BaQNBzToOkN9LxZO4uQ+CSxBOE aabkWIFXpYR+Re15Olsfy41VvOvI/igdAgsDFJfRMJSg3kbb9mdzgSVDfsVIcLTH HIRR0vaqZ8Irx8mxNzf53Ms6bC+KAqzKCj2tvnqBKkuAu1y9OJbS6haUbrTAqATO qUiHTw3vtbu4WIXCAp/jaJ1NnNDTlLBNB+CJcYX5EbUBBNWvKeYygeemmsbbdsZW Ir/xhZOVF4X+e7bRXdRiORAHY0SzsfLRjYo2iXiYgmH//cYeMsfh6Co3J653hNwS h80vpwgdJWkx8KKJdjBCQhCnRKZSZ0t39V4BnCCqGnBpp3SSl07eSgrS9YbdZtJ/ keP3r9JnNnH26OQQVohK138YmjZky8lfk4UmTA4I84rBezfrkQatdv9bm+ucGiTV wFkds6BWWz6ZG7vrPoIrRDjmIp99Et5kFzv9hsJRdT+nf+gEyulcSOcp2GrpmDKz raXGjeqrZm/qvt+rkFGe =uya7 -----END PGP SIGNATURE----- --huq684BweRXVnRxX--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101127210815.GC3810>