xref: /original-bsd/sys/sys/dirent.h (revision 68d9582f)
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.2 (Berkeley) 05/31/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_char	d_type; 		/* file type, see below */
25 	u_char	d_namlen;		/* length of string in d_name */
26 #ifdef _POSIX_SOURCE
27 	char	d_name[255 + 1];	/* name must be no longer than this */
28 #else
29 #define	MAXNAMLEN	255
30 	char	d_name[MAXNAMLEN + 1];	/* name must be no longer than this */
31 #endif
32 };
33 
34 /*
35  * File types
36  */
37 #define		D_UNKNOWN	0
38 #define		D_REG		1
39 #define		D_DIR		2
40 #define		D_BLK		3
41 #define		D_CHR		4
42 #define		D_LNK		5
43 #define		D_SOCK		6
44 #define		D_FIFO		7
45