*BSD News Article 13941


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!decwrl!usenet.coe.montana.edu!news.u.washington.edu!ns1.nodak.edu!plains.NoDak.edu!tinguely
From: tinguely@plains.NoDak.edu (Mark Tinguely)
Subject: Re: File Truncation Philosophy
Sender: usenet@ns1.nodak.edu (Usenet login)
Message-ID: <C4vqBI.CoK@ns1.nodak.edu>
Date: Fri, 2 Apr 1993 23:23:42 GMT
References: <C4tJ6C.C17@ns1.nodak.edu>
Nntp-Posting-Host: plains.nodak.edu
Organization: North Dakota State University
Lines: 35

In article <C4tJ6C.C17@ns1.nodak.edu> tinguely@plains.NoDak.edu (Mark Tinguely) writes:
>		******** Request for Comments ********
>
> As most of you know that with 386bsd installing a new copy of a running
> program causes the running program to crash and core. ...

 The best idea from the netnews is to mark the executable text file busy. It
 was also pointed out to me that this feature already exists in the Net-2 code,
 but was not enabled in 386bsd.

 Sure enough there is a vnode flag VTEXT that is checked in the vn_writechk()
 and if set when writing then ETXTBSY is returned.

 There is two logical places that this flag could be set in vm/vnode_pager.c
 when a vnode pager is allocated and kern/execve.c when executing. The flag
 is deleted when the vnode_pager is deallocated. Against my better judgment,
 I put it in kern_execve.c because I assume since it is not in the vnode pager
 allocation routine, the original authors wanted it to go into kern_execve.c.

 thanks for the help.
--mark.
		----- yet another kern_execve.c patch -----
*** kern_execve.c.before	Fri Apr  2 16:01:35 1993
--- kern_execve.c	Fri Apr  2 16:05:18 1993
***************
*** 481,486 ****
--- 481,488 ----
  	p->p_regs[SP] = (unsigned) (argbuf - 1);
  	setregs(p, exdata.ex_hdr.a_entry);
  
+  	ndp->ni_vp->v_flag |= VTEXT;		/* mark vnode pure text */
+ 
  	vput(ndp->ni_vp); 
  	FREE(ndp->ni_pnbuf, M_NAMEI);