dirent::d_offset question

Hey,

I’m trying to figure out the correct way of calculating the value of this
member. (Handling readdir() calls in my resmgr) The value that seems to
work is the index of the directory entry.

In other words…say my resmgr has a list of files and directory names and
the entry being put into the dirent struct is #4 in the list, 4 is placed in
the d_offset member.

Is this correct or does d_offset represent the number of bytes between the
first dirent struct of the directory to the current dirent struct?

TIA
Kevin

Ah…never mind…it doesn’t really matter what it is along as it’s use is
consistant with an lseek operation on a directory in my resource manager…

Don’t you just love these self-postings?

Kevin


“Kevin Stallard” <kevin@robots.flyingrobots.fly.> wrote in message
news:an4sah$4hn$1@inn.qnx.com

Hey,

I’m trying to figure out the correct way of calculating the value of this
member. (Handling readdir() calls in my resmgr) The value that seems to
work is the index of the directory entry.

In other words…say my resmgr has a list of files and directory names and
the entry being put into the dirent struct is #4 in the list, 4 is placed
in
the d_offset member.

Is this correct or does d_offset represent the number of bytes between the
first dirent struct of the directory to the current dirent struct?

TIA
Kevin

Kevin Stallard <kevin@robots.flyingrobots.fly.> wrote:

Ah…never mind…it doesn’t really matter what it is along as it’s use is
consistant with an lseek operation on a directory in my resource manager…

Don’t you just love these self-postings?

Ahhh… grasshopper; sometimes just asking the question leads you to the answer :slight_smile:

Cheers,
-RK

P.S. I always tend to use monotonically increasing directory entry numbers,
but that’s just me… There are good reasons for using increasing-by-multiple
directory entry numbers too… YMMV

Kevin



“Kevin Stallard” <> kevin@robots.flyingrobots.fly> .> wrote in message
news:an4sah$4hn$> 1@inn.qnx.com> …
Hey,

I’m trying to figure out the correct way of calculating the value of this
member. (Handling readdir() calls in my resmgr) The value that seems to
work is the index of the directory entry.

In other words…say my resmgr has a list of files and directory names and
the entry being put into the dirent struct is #4 in the list, 4 is placed
in
the d_offset member.

Is this correct or does d_offset represent the number of bytes between the
first dirent struct of the directory to the current dirent struct?

TIA
Kevin


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

Kevin Stallard <kevin@robots.flyingrobots.fly.> wrote:

I’m trying to figure out the correct way of calculating the value of this
member. (Handling readdir() calls in my resmgr)

To quote from the Solaris man page (“dirent (3)”, one of the few places
I found a description of this field, and it is how the QNX6 disk-based
filesystems populate this field) …

The d_off entry contains a value which is
interpretable only by the filesystem that generated it. It
may be supplied as an offset to lseek(2) to find the entry
following the current one in a directory.