opendir / struct DIR questions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
finarfin
Member
Member
Posts: 106
Joined: Fri Feb 23, 2007 1:41 am
Location: Italy & Ireland
Contact:

opendir / struct DIR questions

Post by finarfin »

hi all,

i'm writing functions for directory handling, but there are some things that i don't understand:
  • First: Which fields struct DIR must contain?
  • Second: opendir/readdir/closedir function need a descriptor table like files? Or is not needed?
For the second question i think no, because if openDir returns a pointer to a DIR structure, there isn't need to have a list of open dirs (i think...).

Thaks to all,
finarfin :)
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: opendir / struct DIR questions

Post by skyking »

DIR (just like FILE) are not mandated to contain any particular field. There may be an association between file descriptor and DIR - you can use fdopendir to open using a open filedescriptor or get the descriptor from a DIR* with dirfd.

This information was gathered by googling for "opendir" (ending up at opengroup).
Post Reply