DragonFly BSD
DragonFly users List (threaded) for 2006-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

struct dirent - difference between getdents(2) manpage and definition in /usr/src/sys/dirent.h

From: "Karthik Subramanian" <karthik301176@xxxxxxxxx>
Date: Wed, 26 Jul 2006 14:55:00 +0530

Hi Folks,

I was fooling around a little with getdents (yes, I know that I
shouldn't be using getdents!) and found that the getdents manpage
happened to say this about struct dirent:

-- snip --

The data in the buffer is a series of dirent structures each containing
    the following entries:

          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 */

    The d_fileno entry is a number which is unique for each distinct file in
    the filesystem.  Files that are linked by hard links (see link(2)) have
    the same d_fileno.  The d_reclen entry is the length, in bytes, of the
    directory record.

-- snip --

When I look at the definition of struct dirent in
/usr/include/sys/dirent.h, I see this:

-- snip --

struct dirent {
#if defined(_KERNEL) || !defined(__BSD_VISIBLE)
	ino_t		d_ino;		     /* file number of entry */
	ino_t		d_fileno;	     /* file number of entry */
	uint16_t	d_namlen;	/* strlen(d_name) */
	uint8_t		d_type;		    /* file type, see blow */
	uint8_t		d_unused1;	/* padding, reserved */
	uint32_t	d_unused2;	/* reserved */
	char		d_name[255 + 1];
					         /* name, NUL-terminated */

-- snip --

It looks like this def is missing d_reclen, whereas the getdents
manpage mentions it - or am I missing something here?

Thanks in Advance,

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]