Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getdirentries.(2) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

link(2)

lseek(2)

open(2)

stat(2)

directory(3)




getdirentries(2) getdirentries(2)
NAME getdirentries - get directory entries SYNOPSIS #include <sys/types.h> #include <sys/dir.h> int getdirentries(d, buf, nbytes, basep) int d; char *buf; int nbytes; long *basep; DESCRIPTION getdirentries attempts to put directory entries from the directory referenced by the descriptor d into the buffer pointed to by buf, in a file system independent format. Up to nbytes of data will be transferred. nbytes must be greater than or equal to the block size associated with the file, see stat(2). Sizes less than this may cause errors on certain file systems. The data in the buffer is a series of direct structures. The direct structure is defined as struct direct { unsigned long d_fileno; unsigned short d_reclen; unsigned short d_namlen; char d_name[MAXNAMELEN + 1]; }; The d_fileno entry is a number which is unique for each dis- tinct file in the file system. Files that are linked by hard links (see link(2)) have the same d_fileno. The d_reclen entry is the length, in bytes, of the directory record. The d_name and d_namelen entries specify the actual file name and its length. Upon return, the actual number of bytes transferred is re- turned. The current position pointer associated with d is set to point to the next block of entries. The pointer is not necessarily incremented by the number of bytes returned by getdirentries. If the value returned is zero, the end of the directory has been reached. The current position pointer may be set and retrieved by lseek(2). The basep en- try is a pointer to a location into which the current posi- tion of the buffer just transferred is placed. It is not safe to set the current position pointer to any value other than a value previously returned by lseek(2) or a value pre- viously returned in basep or zero. April, 1990 1



getdirentries(2) getdirentries(2)
RETURN VALUE If successful, the number of bytes actually transferred is returned. Otherwise, a -1 is returned and the global vari- able errno is set to indicate the error. SEE ALSO link(2), lseek(2), open(2), stat(2), directory(3). 2 April, 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026