Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!watmath!clyde!akgua!mcnc!decvax!harpo!ihnp4!houxm!hogpc!houti!ariel!vax135!floyd!cmcl2!seismo!rlgvax!guy From: guy@rlgvax.UUCP Newsgroups: net.unix-wizards Subject: Re: how can I tell when my shared text file is in use? Message-ID: <1911@rlgvax.UUCP> Date: Sat, 12-May-84 01:51:12 EDT Article-I.D.: rlgvax.1911 Posted: Sat May 12 01:51:12 1984 Date-Received: Sun, 13-May-84 09:58:14 EDT References: <462@burl.UUCP> <107@pyuxt.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 42 > The method i have used (successfully) in the past tackles the problem in > another way. ... Then, when it comes to installing the program you use a > make line which effectively does this series of operations: > rm -f $(INSD)/n$(PRODUCT) > cp $(PRODUCT) $(INSD)/n$(PRODUCT) > cd $(INSD); mv $(PRODUCT) o$(PRODUCT); mv n$(PRODUCT) $(PRODUCT); \ > rm -f o$(PRODUCT) The standard USG UNIX "install" command (in "/etc/install") has a "-o" option which does exactly this. The "install" command copies something to an install directory; if the "-o" option is specified, the current copy is renamed OLDwhatever and the new one moved there. By the way, though, the prohibition against removing active shared text program is not a requirement; 4.1BSD removed it by #ifdefing the four lines of code in "sys4.c" out that enforce it (the lines are in the "unlink" routine and read if (ip->i_flag&ITEXT && ip->i_nlink == 1) { u.u_error = ETXTBSY; goto out; } There's no harm in doing so - the inode will not be freed until the last program using the shared text stops using it; the same is true of open files (the inode is not freed until the last program using it closes the file), which the system does let you unlink. A claim I heard was that the only reason that prohibition was there was because if the system crashed, and such files had been unlinked, they would show up as unreferenced inodes in an "fsck". Well, 1) so would any files which were open and had been unlinked, 2) a reasonable version of "fsck" will be able to fix such things automatically at boot time (Berkeley deserves much praise for "fsck -p", which USG did *their own version* of and didn't do it as well! While I'm on that subject, "/etc/fstab" is also very nice - are you listening, USG?), and 3) anybody who's worked with Files-11 (the RSX/IAS/VMS file system) has certainly heard of files "marked for deletion" - the same sort of thing (half-deleted files) appears in lots of other OSes too. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy