man(1) Manual page archive


     DIR(5)                                                     DIR(5)

     NAME
          dir - format of directories

     SYNOPSIS
          #include <sys/types.h>
          #include <sys/dir.h>

     DESCRIPTION
          A directory behaves exactly like an ordinary file, save that
          no user may write into a directory.  The fact that a file is
          a directory is indicated by a bit in the flag word of its
          inode entry; see filsys(5). The structure of a directory
          entry as given in the include file is:

               #define DIRSIZ  14
               struct  direct
               {
                       ino_t   d_ino;
                       char    d_name[DIRSIZ];
               };

          By convention, the first two entries in each directory are
          `.'  for the directory itself and `..'  for the parent
          directory.  In the ultimate root directory `..'  is the same
          as `.'.

          It is inadvisable to read directories using this structure.
          The routines in directory(3) and dirread(2) are more effi-
          cient and portable.

     SEE ALSO
          filsys(5), directory(3), dirread(2)