[comp.os.mach] seekdir and telldir in Mach 2.5

mrt@MRT.MACH.CS.CMU.EDU (Mary Thompson) (05/07/91)

I have a somewhat fuzzy idea of what happened here. Reading a directory up
to some offet, remembering the offset, closing the directory, re-opening
it and starting off at the remembed offset does not work for AFS directories.
It may also not work for NFS directories although I am not sure of that.
The system call that does work is is getdirentries, or you can read and
cache the entire directory just once. 

The CMU conditionals in libc force you to use getdirentires or readdir. It
may be that as long as you are dealing with only ufs directories, you can
undefine CMU for those routines and things will work. It may be that lseek
will refuse to work for a directory file though, so you might have to change
that as well.

CMU has modified versions of things like tar etc. but the original Mach 2.5
releases made no attempt to provide a complete set of sources. Such a complete
set is included with the Mt Xinu 2.6 MSD releases and has more recently 
been provided with the Mach 2.5 releases for the i386 machines from both
Mt Xinu and CMU.  (The CMU i386 release is only available via internet, we
cannot give it out on tape.)


Mary Thompson, CMU

mib@geech.gnu.ai.mit.edu (Michael I Bushnell) (05/07/91)

In article <1991May6.183122.6252@cs.cmu.edu> mrt@MRT.MACH.CS.CMU.EDU (Mary Thompson) writes:


   I have a somewhat fuzzy idea of what happened here. Reading a
   directory up to some offet, remembering the offset, closing the
   directory, re-opening it and starting off at the remembed offset
   does not work for AFS directories.  It may also not work for NFS
   directories although I am not sure of that.  The system call that
   does work is is getdirentries, or you can read and cache the entire
   directory just once.

It isn't guaranteed to work on U*x directories either.  Directory
blocks could be compressed, messing up the pointer.
	-mib