mirror of https://github.com/mkerrisk/man-pages
getdents.2, readdir.3: d_type is currently only supported on ext[234]
As at kernel 2.6.27, only ext[234] support d_type. On other file systems, d_type is always set to DT_UNKNOWN (0). Reported-by: Ricardo Catalinas Jimnez <jimenezrick@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
c42ad30f8c
commit
efb92ba155
|
@ -24,7 +24,7 @@
|
|||
.\" Modified 22 July 1995 by Michael Chastain <mec@duracef.shout.net>:
|
||||
.\" Derived from 'readdir.2'.
|
||||
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
|
||||
.TH GETDENTS 2 2008-06-22 "Linux" "Linux Programmer's Manual"
|
||||
.TH GETDENTS 2 2009-09-29 "Linux" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
getdents \- get directory entries
|
||||
.SH SYNOPSIS
|
||||
|
@ -117,6 +117,14 @@ This is a Unix domain socket.
|
|||
.TP
|
||||
.B DT_UNKNOWN
|
||||
The file type is unknown.
|
||||
.PP
|
||||
Curently,
|
||||
.\" kernel 2.6.27
|
||||
only ext2, ext3, and ext4 support returning the file type in
|
||||
.IR d_type .
|
||||
On other file systems,
|
||||
this field is always set to
|
||||
.BR DT_UNKNOWN .
|
||||
.SH "RETURN VALUE"
|
||||
On success, the number of bytes read is returned.
|
||||
On end of directory, 0 is returned.
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
.\" Rework discussion of non-standard structure fields.
|
||||
.\" 2008-09-11, mtk, Document readdir_r().
|
||||
.\"
|
||||
.TH READDIR 3 2008-09-10 "" "Linux Programmer's Manual"
|
||||
.TH READDIR 3 2008-09-29 "" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
readdir, readdir_r \- read a directory
|
||||
.SH SYNOPSIS
|
||||
|
@ -73,7 +73,8 @@ struct dirent {
|
|||
ino_t d_ino; /* inode number */
|
||||
off_t d_off; /* offset to the next dirent */
|
||||
unsigned short d_reclen; /* length of this record */
|
||||
unsigned char d_type; /* type of file */
|
||||
unsigned char d_type; /* type of file; not supported
|
||||
by all file system types */
|
||||
char d_name[256]; /* filename */
|
||||
};
|
||||
.fi
|
||||
|
@ -198,6 +199,14 @@ If the file type could not be determined, the value
|
|||
is returned in
|
||||
.IR d_type .
|
||||
|
||||
Curently,
|
||||
.\" kernel 2.6.27
|
||||
only ext2, ext3, and ext4 support returning the file type in
|
||||
.IR d_type .
|
||||
On other file systems,
|
||||
this field is always set to
|
||||
.BR DT_UNKNOWN .
|
||||
|
||||
Since POSIX.1 does not specify the size of the
|
||||
.I d_name
|
||||
field, and other non-standard fields may precede that field within the
|
||||
|
|
Loading…
Reference in New Issue