xref: /original-bsd/sys/sys/dirent.h (revision fe22c88e)
1 /*-
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)dirent.h	7.1 (Berkeley) 02/06/92
8  */
9 
10 /*
11  * The dirent structure defines the format of directory entries returned by
12  * the getdirentries(2) system call.
13  *
14  * A directory entry has a struct dirent at the front of it, containing its
15  * inode number, the length of the entry, and the length of the name
16  * contained in the entry.  These are followed by the name padded to a 4
17  * byte boundary with null bytes.  All names are guaranteed null terminated.
18  * The maximum length of a name in a directory is MAXNAMLEN.
19  */
20 
21 struct dirent {
22 	u_long	d_fileno;		/* file number of entry */
23 	u_short	d_reclen;		/* length of this record */
24 	u_short	d_namlen;		/* length of string in d_name */
25 #ifdef _POSIX_SOURCE
26 	char	d_name[255 + 1];	/* name must be no longer than this */
27 #else
28 #define	MAXNAMLEN	255
29 	char	d_name[MAXNAMLEN + 1];	/* name must be no longer than this */
30 #endif
31 };
32