Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > D


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


dir — format of directories on short-name HFS file systems


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


This entry describes the System V-compatible directory format for the HFS file system. It is provided strictly for backward compatibility and compatibility with applications expecting a System V file system environment. It is not compatible with the similar but more general HFS directory format in <dirent.h>, which describes a format identical to that used in an HFS file system supporting long file names up to 255 bytes in length.

The dirent structure defined in <dirent.h> should be used in conjunction with the directory(3C) routines for portability to other industry UNIX implementations.


A directory behaves exactly like an ordinary file, except that no user can write into a directory. The structure of a directory entry as given in the <sys/dir.h> header file is:

#define DIRSIZ 14 #define DIRSIZ_CONSTANT 14 #define DIR_PADSIZE 10 #define MAXNAMLEN 255 struct direct { u_long d_ino; /* inode number of entry */ u_short d_reclen; /* length of this record */ u_short d_namlen; /* length of string in d_name */ char d_name[DIRSIZ_CONSTANT]; char d_pad[DIR_PADSIZE]; }; /* * DIRSTRCTSIZ is the number of bytes in the structure * representing a System V-compatible (14-character * maximum file name length) HFS directory entry. */ #define DIRSTRCTSIZ 32 /* sizeof(struct direct) */

By convention, the first two entries in each directory are for . and .. (``dot'' and ``dot dot''). The first is an entry for the directory itself. The second is for the parent directory. The meaning of .. is modified for the root directory of the master file system; there is no parent, so .. and . have the same meaning.


dir was developed by AT&T and HP.



Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.