Subject: Re: access(2) error returns: ETXTBSY vs. read-only
To: None <tech-kern@netbsd.org>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-kern
Date: 06/28/1999 17:06:51
On Thu, Jun 17, 1999 at 05:55:11AM +1000, Giles Lean wrote:
> 
> On Wed, 16 Jun 1999 17:25:35 +0200  Ignatios Souvatzis wrote:
> 
> > the access(2) syscall always returns ETXTBSY if a file is executed, even
> > if it is read-only.
> 
> > 1543               if ((flags & VWRITE) == 0 ||
> > 1544		       (error = VOP_ACCESS(vp, flags, cred, p)) == 0)
> > 1545                       error = vn_writechk(vp);
> > 
> > would break anything?
> 
> Any idea what other Unix systems do?  (I've access to HP-UX, Linux,
> FreeBSD and possibly Solaris (have to install a compiler :-) if you
> want me to check any of them.  I'm dialled into the wrong network to
> check right now though.)

I just checked Solaris. Well, not the source code, just truss'ed rm:

/tmp/sleep executing and writable:

access("/tmp/sleep", 2)                         = 0
and no question by rm.

access("/tmp/sleep", 2)                         Err#13 EACCES
rm: /tmp/sleep: override protection 555 (yes/no)?
with /tmp/sleep executing or not, and /tmp/sleep write-protected.

I'll commit the necessary changes.

	-is