DIR(5) DOMAIN/IX Reference Manual (SYS5) DIR(5)
NAME
dir - format of directories
USAGE
#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. The structure of a directory entry as given in
the include file is:
#ifndef DEV_BSIZE
#define DEV_BSIZE 1024
#endif
#define DIRBLKSIZ DEV_BSIZE
#define MAXNAMLEN 32
struct direct {
unsigned longd_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)
Printed 5/10/85 DIR-1
DIR(5) DOMAIN/IX Reference Manual (SYS5) DIR(5)
extern void closedir();
By convention, the first two entries in each directory are
for . and ... The first is an entry for the directory
itself. The second is for the parent directory. The mean-
ing of .. is modified for the root directory of the master
file system; there is no parent, so .. has the same meaning
as ..
DIR-2 Printed 5/10/85