dirent(4) dirent(4)
NAME
dirent - file system independent directory entry
SYNOPSIS
#include <dirent.h>
DESCRIPTION
Different file system types may have different directory entries. The
dirent structure defines a file system independent directory entry,
which contains information common to directory entries in different
file system types. A set of these structures is returned by the
getdents(2) system call.
The dirent structure is defined in this example:
struct dirent
{
inot dino; /* "inode number" of entry */
offt doff; /* offset of disk directory entry */
unsigned short dreclen; /* length of this record */
char dname[1]; /* name of file */
};
The dino is a number which is unique for each file in the file sys-
tem. The field doff is the offset of that directory entry in the
actual file system directory. The field dname is the beginning of the
character array giving the name of the directory entry. This name is
null terminated and may have at most MAXNAMLEN characters. This
results in file system independent directory entries being variable
length entities. The value of dreclen is the record length of this
entry. This length is defined to be the number of bytes between the
current entry and the next one, so that the next structure will be
suitably aligned.
The following are declared as functions and may also be defined as
macros:
int closedir(DIR *dirp);
DIR *opendir(const char *dirname);
struct dirent *readdir(DIR *dirp);
void rewinddir(DIR *dirp);
void seekdir(DIR *dirp, long int loc);
long int telldir(DIR *dirp);
The dirent64 structure is defined in the same way as the dirent struc-
ture with the exception of the following members:
ino64t dino; /* "inode number" of entry */
off64t doff; /* offset of disk directory entry */
Page 1 Reliant UNIX 5.44 Printed 11/98
dirent(4) dirent(4)
The following is declared as a function and may also be defined as a
macro:
struct dirent64 *readdir64(DIR *dirp);
SEE ALSO
getdents(2), directory(3C), lfs(5), types(5).
Page 2 Reliant UNIX 5.44 Printed 11/98