diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-07-04 22:07:46 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-07-04 22:07:46 +0000 |
commit | 3e8744d582779e88bffb657365a7fc5c0ef7795b (patch) | |
tree | 060e472eb91df369ffa20202933da01e826ecc35 /lib | |
parent | be81401ff513900c8bdea16188c306804761e78c (diff) |
Fix the types in struct dirent and document d_type (description
taken from NetBSD).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/sys/getdirentries.2 | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index f664c8e9349..1a62886d008 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getdirentries.2,v 1.13 2003/06/02 20:18:39 millert Exp $ +.\" $OpenBSD: getdirentries.2,v 1.14 2003/07/04 22:07:45 millert Exp $ .\" $NetBSD: getdirentries.2,v 1.7 1995/10/12 15:40:50 jtc Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -63,9 +63,10 @@ The data in the buffer is a series of .Em dirent structures each containing the following entries: .Bd -literal -offset indent -unsigned long d_fileno; -unsigned short d_reclen; -unsigned short d_namlen; +u_int32_t d_fileno; +u_int16_t d_reclen; +u_int8_t d_type; +u_int8_t d_namlen; char d_name[MAXNAMELEN + 1]; /* see below */ .Ed .Pp @@ -79,18 +80,34 @@ have the same The .Fa d_reclen entry is the length, in bytes, of the directory record. +.Pp The -.Fa d_name -entry contains a null-terminated file name. +.Fa d_type +is the type of file, where the following are possible types: +.Dv DT_UNKNOWN , +.Dv DT_FIFO , +.Dv DT_CHR , +.Dv DT_DIR , +.Dv DT_BLK , +.Dv DT_REG , +.Dv DT_LNK , +.Dv DT_SOCK , +and +.Dv DT_WHT . +.Pp The .Fa d_namlen -entry specifies the length of the file name excluding the null byte. +entry specifies the length of the file name excluding the NUL byte. Thus the actual size of .Fa d_name may vary from 1 to .Dv MAXNAMELEN \&+ 1. .Pp +The +.Fa d_name +entry contains a NUL-terminated file name. +.Pp Entries may be separated by extra space. The .Fa d_reclen @@ -153,7 +170,8 @@ error occurred while reading from or writing to the file system. .El .Sh SEE ALSO .Xr lseek 2 , -.Xr open 2 +.Xr open 2 , +.Xr dirent 5 .Sh HISTORY The .Fn getdirentries |