DIR(5)
NAME
dir − format of directories
USAGE
#include <sys/dir.h>
DESCRIPTION
A directory behaves exactly like an ordinary file, except 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 The structure of a directory entry as given in the include file is: #ifndef DEV_BSIZE #define DEV_BSIZE 1024 #endif
#define DIRBLKSIZDEV_BSIZE #define MAXNAMLEN 32
structdirect { unsigned long d_ino; short d_reclen; short d_namlen; char d_name[MAXNAMLEN + 1]; };
/*
* The DIRSIZ macro gives the minimum record length which will hold
* the directory entry. This requires the amount of space in struct direct
* without the d_name field, plus enough space for the name with a terminating
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*/ #undef DIRSIZ #define DIRSIZ(dp) \ ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
/*
* Definitions for library routines operating on directories.
*/ typedef struct _dirdesc { int dd_fd; long dd_loc; long dd_size; char dd_buf[DIRBLKSIZ]; } DIR; #ifndef NULL #define NULL 0 #endif extern DIR *opendir(); extern struct direct *readdir(); extern long telldir(); extern void seekdir(); #define rewinddir(dirp) seekdir((dirp), (long)0) extern void closedir();
NOTES
On many UNIX systems, the first two entries in each directory are for . (dot) and .. (dotdot). The first is an entry for the directory itself. The second is for the parent directory. The meaning of dotdot is modified for the root directory of the master file system; there is no parent, so dotdot has the same meaning as dot.
While the dot and dotdot directory entries do not exist in the bsd4.2 version of DOMAIN/IX, the naming server recognizes . as “this directory” and .. as “the parent directory of this directory.” When dot is // (the network root), dot and dotdot are the same.