United States-English |
|
|
HP-UX Reference > Ggetdirentries(2)TO BE OBSOLETEDHP-UX 11i Version 3: February 2007 |
|
NAMEgetdirentries() — get entries from a directory in a file-system-independent format SYNOPSIS#include <ndir.h> For versions prior to 10.30 #include <dir.h> For 10.30 and later versions int getdirentries( int fildes, struct direct *buf, size_t nbytes, off_t *basep ); DESCRIPTIONThe getdirentries() system call and the <ndir.h> header file have been obsoleted starting from HP-UX 10.30 by the functions described in directory(3C). getdirentries() will not be supported for 64-bit applications. The getdirentries() system call places directory entries from the directory referenced by the file descriptor fildes into the buffer pointed to by buf, in a file-system-independent format. Up to nbytes of data are transferred. nbytes must be greater than or equal to the block size associated with the file; see st_blksize in stat(2). (Smaller block sizes can cause errors on certain file systems.) nbytes must be less than or equal to 65536 (64K). The data in the buffer consists of a series of direct structures, each containing the following entries: ino32_t d_ino; unsigned short d_reclen; unsigned short d_namlen; char d_name[MAXNAMLEN + 1]; The d_ino entry is a number unique for each distinct file in the file system. Files linked by hard links (see link(2)) have the same d_ino. The d_reclen entry identifies the length, in bytes, of the directory record. The d_name entry contains a null-terminated file name. The d_namlen entry specifies the length of the file name. Thus the actual size of d_name can vary from 2 to MAXNAMLEN + 1. Note that the direct structures in the buffer are not necessarily tightly packed. The d_reclen entry must be used as an offset from the beginning of a direct structure to the next structure, if any. The return value of the system call is the actual number of bytes transferred. The current position pointer associated with fildes 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 is set and retrieved by lseek(); see lseek(2). getdirentries() writes the position of the block read into the location pointed to by basep. The current position pointer can be set safely only to a value previously returned by lseek(), to a value previously returned in the location pointed to by basep, or to zero. Any other manipulation of the position pointer causes undefined results. RETURN VALUEgetdirentries() returns the following values:
ERRORSIf getdirentries() fails, errno is set to one of the following values:
|
Printable version | ||
|