Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!cernvax!chx400!bernina!zeller From: zeller@bernina.ethz.ch (Lukas Zeller) Newsgroups: comp.os.os9 Subject: Re: directory help Message-ID: <1990Dec20.222317.18730@bernina.ethz.ch> Date: 20 Dec 90 22:23:17 GMT References: <5AlNrD@ppcnet.ppc.sub.org> Reply-To: zeller@bernina.UUCP (Lukas Zeller) Organization: Swiss Federal Institute of Technology (ETH), Zuerich Lines: 33 In article <5AlNrD@ppcnet.ppc.sub.org> ralf@ppcnet.ppc.sub.org (Ralf Sauther) writes: >rh2y+@andrew.cmu.edu (Russell E. Hoffman, II) writes: > >> There's GOT to be a faster way to get the file descriptors for every file >>in a given directory than simply opening each file individually then doing >>a _gs_gfd() on the individual files. I have thought about reading all the >Certainly there is a way :-) I know about a program named 'dir1' (which is >avaliable as source), that is very fast in accessing the file-descriptors >(it does a few #asm statements for this). Maybe there's a way to release it >to the net (it's PD). The trick is simple and effective, but not very nice: There is a GetStat call named SS_FDInf that can be used to access the file descriptor by specifying its logical block number. This eliminates the need to open all the files to apply _gs_gfd() and is therefore much faster. There is, however, a slight drawback to this: Because SS_FDInf gives access not only to file descriptors, but in fact to ANY block of a disk, it would be a severe security hole - if it was available to any user. You guessed it: only the superuser can do it. So the "dir1" mentioned above needs to change its process UID to superuser, which is only possible if the program BELONGS (file and module) to the superuser. ========================== +---------------------------+ ***************** Lukas Zeller |\ E-Mail: /| * Never trust a * ETH Zurich, Switzerland | \_______________________/ | * computer * (SFIT, Swiss Federal | / zeller@ethz.UUCP \ | * bigger than * Institute of Technology) | / ..chx400!ethz!zeller \ | * you can lift * ========================== +---------------------------+ ***************** -- ========================== +---------------------------+ ***************** Lukas Zeller |\ E-Mail: /| * Never trust a * ETH Zurich, Switzerland | \_______________________/ | * computer * (SFIT, Swiss Federal | / zeller@ethz.UUCP \ | * bigger than *