smbc_telldir and offsets ...

Richard Sharpe sharpe at
Tue Mar 27 06:48:11 GMT 2001


I have implemented the smbc_telldir function, which is meant to be similar
to the telldir function in UNIX.

You call it and it returns an offset into a directory that you can go back
to with an smbc_lseekdir ...

However, there are some problems that require the semantics to be somewhat
different to the normal UNIX telldir/lseekdir pair.

For example, the directory is some sort of opaque remote object, and the
implementation inside the cli_xxx routines mean that I have to return a
handle to a directory entry that can be found again by the smbc_lseekdir

You cannot simply pass and offset in and expect the routine to get it right. 

Also, when you are at the beginning of the directory, smbc_telldir does not
return 0, rather it returns a handle that allows us to find that entry again. 

When you are at the end of the directory, you get back 0 (or NULL).

So, does anyone think this is a big problem?

Richard Sharpe, sharpe at
Samba (Team member,, Ethereal (Team member,
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba

More information about the samba-technical mailing list