[haiku-development] Re: Ticket #2617 seekdir and telldir not implemented

  • From: "Salvatore Benedetto" <emitrax@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 19 Aug 2008 07:48:37 +0000

Hi there,

2008/8/19 John Scipione <jscipione@xxxxxxxxx>:
> I don't know if either of these functions behave as they are intended.

As for the behavior, you can take a look at what the POSIX standard says
about it. In this case, check out the following links

http://www.opengroup.org/onlinepubs/009695399/functions/telldir.html
http://www.opengroup.org/onlinepubs/009695399/functions/seekdir.html

> In the telldir() function `dir->first_entry.d_reclen +
> dir->next_entry` is suppose to get the current position in the dir.
> This is a guess. Also, it seems that the current position in the dir
> should be stored in the struct itself so that it doesn't have to be
> calculated everytime. Perhaps readdir() could set a variable in the
> struct each time it increments the position.
>
> Any help would be much appreciated.

In doubts, you can always "get inspired" ;-) by others implementation,
like openbsd or opensolaris

http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libbc/libc/gen/common/telldir.c#36
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libbc/libc/gen/common/seekdir.c#37
http://www.koders.com/c/fid8932A4B7C9E86627A6E15FE6C255DDDE8AE24034.aspx?s=telldir.c#L1

>
> Thanks,
> John Scipione
>
>

Hope this helps.

Regards,
-- 
Salvatore Benedetto (a.k.a. emitrax)
Student of Computer Engineer
University of Pisa
www.haiku-os.it

Other related posts: