Update to sort of match reality by literally including <sys/dirent.h>

instead of a pre-BSD4.4 version of <dirent.h>.  The old version had
library goop which is still in <dirent.h>.  See reality if you want
real details.
This commit is contained in:
Bruce Evans 1998-02-24 02:39:00 +00:00
parent aea7fcd2ca
commit 5825b07428
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33780

View file

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)dir.5 8.3 (Berkeley) 4/19/94
.\" $Id: dir.5,v 1.7 1997/02/22 13:25:58 peter Exp $
.\" $Id: dir.5,v 1.8 1997/03/19 03:48:12 bde Exp $
.\"
.Dd April 19, 1994
.Dt DIR 5
@ -81,81 +81,69 @@ and
.Xr mount 8 . )
.Pp
The directory entry format is defined in the file
.Aq dirent.h :
.Aq sys/dirent.h
(which should not be included directly by applications):
.Bd -literal
#ifndef _DIRENT_H_
#define _DIRENT_H_
#ifndef _SYS_DIRENT_H_
#define _SYS_DIRENT_H_
/*
* A directory entry has a struct dirent at the front of it, containing its
* inode number, the length of the entry, and the length of the name
* contained in the entry. These are followed by the name padded to a 4
* byte boundary with null bytes. All names are guaranteed null terminated.
* The maximum length of a name in a directory is MAXNAMLEN.
*/
* The dirent structure defines the format of directory entries returned by
* the getdirentries(2) system call.
*
* A directory entry has a struct dirent at the front of it, containing its
* inode number, the length of the entry, and the length of the name
* contained in the entry. These are followed by the name padded to a 4
* byte boundary with null bytes. All names are guaranteed null terminated.
* The maximum length of a name in a directory is MAXNAMLEN.
*/
struct dirent {
u_long d_fileno; /* file number of entry */
u_short d_reclen; /* length of this record */
u_char d_type; /* file type, see below */
u_char d_namlen; /* length of string in d_name */
u_int32_t d_fileno; /* file number of entry */
u_int16_t d_reclen; /* length of this record */
u_int8_t d_type; /* file type, see below */
u_int8_t d_namlen; /* length of string in d_name */
#ifdef _POSIX_SOURCE
char d_name[255 + 1]; /* maximum name length */
char d_name[255 + 1]; /* name must be no longer than this */
#else
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* maximum name length */
#define MAXNAMLEN 255
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
#endif
};
/*
* File types
*/
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LKN 10
#define DT_SOCK 12
#define DT_WHT 14
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14
#ifdef _POSIX_SOURCE
typedef void * DIR;
#else
/*
* Convert between stat structure types and directory types.
*/
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#define DTTOIF(dirtype) ((dirtype) << 12)
#define d_ino d_fileno /* backward compatibility */
/*
* The _GENERIC_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.
*/
#define _GENERIC_DIRSIZ(dp) \
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
/* structure describing an open directory. */
typedef struct _dirdesc {
int dd_fd; /* file descriptor associated with directory */
long dd_loc; /* offset in current buffer */
long dd_size; /* amount of data returned by getdirentries */
char *dd_buf; /* data buffer */
int dd_len; /* size of data buffer */
long dd_seek; /* magic cookie returned by getdirentries */
long dd_rewind;/* magic cookie for rewinding */
} DIR;
#define dirfd(dirp) ((dirp)->dd_fd)
#ifndef NULL
#define NULL 0
#ifdef KERNEL
#define GENERIC_DIRSIZ(dp) _GENERIC_DIRSIZ(dp)
#endif
#endif /* _POSIX_SOURCE */
#ifndef KERNEL
#include <sys/cdefs.h>
#endif /* !KERNEL */
#endif /* !_DIRENT_H_ */
#endif /* !_SYS_DIRENT_H_ */
.Ed
.Sh SEE ALSO
.Xr fs 5 ,