dirent(4)


dirent -- file system independent directory entry

Synopsis

   #include <sys/types.h>
   #include <sys/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. (Also see directory(3C) for descriptions of other routines that use the dirent structure.)

The dirent structure is defined below.

   struct  dirent {
           ino_t            d_ino;
           off_t            d_off;
           unsigned short   d_reclen;
           char             d_name[1];
   };

The d_ino is a number which is unique for each file in the file system. The field d_off is the offset of the subsequent directory entry in the actual file system directory. The field d_name 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 d_reclen 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 dirent64 structure defines a file system independent directory entry, which contains information common to directory entries in different file system types and supports large files. dirent64 is otherwise identical to dirent.

The dirent64 structure is defined below:

   struct  dirent {
           ino64_t          d_ino;
           off_t            d_off;
           unsigned short   d_reclen;
           char             d_name[1];
   };

References

directory(3C), getdents(2)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004