Subject: Re: a.out dynamic libraries
To: Krister Walfridsson <cato@df.lth.se>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-toolchain
Date: 05/24/1998 10:30:08
On Sun, 24 May 1998 14:53:32 +0200 (MET DST) 
 Krister Walfridsson <cato@df.lth.se> wrote:

 > My impression was that when a program was running, I could do anything 
 > to the dynamic libraries, without disturbing the running program.
 > I was obviuosly wrong...

no, I think you may have just misunderstood the semantics :-)

Basically, I think what you want, here, is to unlink the target file first,
otherwise what can happen is you write over the data associated with the
vnode that is in use.  If you unlink (rm) first, a new vnode is allocated
when you create the target file again, and the old vnode persists as long
as there are references to it.

install(1) does this for you.

If you had done this to a running program, you would have gotten ETXTBSY
when you tried to write, but since the shared library is mapped by user
code and not the kernel exec code, the vnode doesn't have the VTEXT flag
set (which would cause the error to be returned).

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 428 6939