From owner-freebsd-current Mon Mar 6 12:06:22 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id MAA17169 for current-outgoing; Mon, 6 Mar 1995 12:06:22 -0800 Received: from netcom15.netcom.com (bakul@netcom15.netcom.com [192.100.81.128]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id MAA17163 for ; Mon, 6 Mar 1995 12:06:19 -0800 Received: from localhost by netcom15.netcom.com (8.6.10/Netcom) id MAA13636; Mon, 6 Mar 1995 12:05:23 -0800 Message-Id: <199503062005.MAA13636@netcom15.netcom.com> To: davidg@Root.COM Cc: current@FreeBSD.org Subject: Re: "Text file busy" with program not running anymore? In-Reply-To: Your message of "Sun, 05 Mar 95 13:33:08 PST." <199503052133.NAA00248@corbin.Root.COM> Date: Mon, 06 Mar 95 12:05:21 -0800 From: Bakul Shah Sender: current-owner@FreeBSD.org Precedence: bulk > No. Executed mapped files are a special case. I actually think that the > "text file busy" thing is generally a hack that should just be removed. I can > see no valid justification for preventing writes to executing files. If you > really don't want your executing process(es) to die, then unlinking the file > first is this the thing to do. Uhh... forgive me for butting in but ETXTBSY prevents a dumb mistake from resulting in a disaster. Imagine doing a ``tar xvf ...'' that wipes out init or nfsd or something.... Yes, one should not do this but `expert friendly' should not imply `dumb user unfriendly'. ETXTBSY warns you that a disaster may ensue; removing ETXTBSY will make ia disaster happen silently. I can see why one would want to write to a running binary (debugging, generating code on the fly etc.) but for that sort of thing surely a TENEX[1] style solution is preferable? Namely, the process whose text needs to be writable gets a distinct image (shared with the original by copy-on-write) and only the scribbled-on pages are private to this process. This also allows two processes to happily hack in their own different way the `same' shared text (or shared lib). Bakul Shah PS: I believe a shared lib's readonly portion should also be treated exactly as text and its refcount be incremented. In any case, a VTEXT flag is not enough and a count does not complicate things much. Youse gotta to do what youse gotta do! [1] Or was it TWINEX or whatever was that niftier offshoot of TENEX called? It has been years! Anyway that is where I first came across it; undoubtedly there are other OSes that do the same thing.