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

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Wed Jul 26 05:48:33 PDT 2006


Joerg Sonnenberger wrote:
On Wed, Jul 26, 2006 at 02:55:00PM +0530, Karthik Subramanian wrote:
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:
Yeah, you shouldn't :-)

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.
Yeah, this is outdated. I'm seriously thinking about just eliminiating
this. Hm. We even have a partly outdated comment on sys/dirent.h...
could you please update these documents to reflect reality?  i guess it's just removing d_reclen (and maybe adding the macro to calculate the length), but i'm not exactly sure.

thanks
 simon
--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
Attachment:
signature.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00011.pgp
Type: application/octet-stream
Size: 252 bytes
Desc: "Description: OpenPGP digital signature"
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20060726/a05cddc3/attachment-0017.obj>


More information about the Users mailing list