Subject: 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/16/1999 17:25:35
Hello,

the access(2) syscall always returns ETXTBSY if a file is executed, even
if it is read-only.

This prevents me from fixing PR 4134 (see there).

As far as I can tell, this is caused by these lines in
vfs_syscalls.c::sys_access()

1543               if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
1544                       error = VOP_ACCESS(vp, flags, cred, p);

Therefore, I'm wondering if reversing the tests like this:

1543               if ((flags & VWRITE) == 0 ||
1544		       (error = VOP_ACCESS(vp, flags, cred, p)) == 0)
1545                       error = vn_writechk(vp);

would break anything?

Regards,
	Ignatios
-- 
 * Progress (n.): The process through which Usenet has evolved from
   smart people in front of dumb terminals to dumb people in front of
   smart terminals.  -- obs@burnout.demon.co.uk (obscurity)