Subject: Re: EISDIR on directory read(2)
To: Giles Lean <giles@nemeton.com.au>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-kern
Date: 10/10/1999 12:03:27
Giles Lean <giles@nemeton.com.au> writes:
> For read(2) not to work on directories would require that it do the
> equivalent of fstat(2) on the file descriptor on each call.  Not a
> good idea for performance. :-)

uh, not at all.

the only thing that'd have to change is that vn_read() (in
vfs_vnops.c) would have to check the type of the vnode being read
from.  i.e.:

	if (vp->v_type == VDIR)
		return (EISDIR);

or something very similar, or it should be changed in the underlying
file system routines.

now, whether even that penalty is worthwhile is another question.



cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.