Subject: Getdirentries, cookies II
To: None <tech-kern@NetBSD.ORG>
From: Frank van der Linden <frank@wins.uva.nl>
List: tech-kern
Date: 08/02/1997 00:38:36
During further discussion about getdirentries() with Charles, the following
came up:
- telldir() and seekdir() use longs, not off_t
- some sort of translation is needed between off_t got from
the kernel for offsets and those values. This is currently
already done in libc
- getdirentries() has the purpose of implementing the directory(3)
functions on different filesystems.
- given that this is the only way getdirentries() is used,
and given the way in which you need to do the off_t -> long
translation in the DIR structure, getdirentries() needing
an extra call to lseek() after it is the least of your
problems when it comes to threadsafeness, you will need
locks anyway
- adding d_off to the dirent structure doesn't solve the problem,
as you can not use it in combination with telldir() and seekdir(),
as they take long values, not off_t
So, you don't need the last argument to getdirentries(), lseek() can be
used. I could do the following:
1) Create a new system call getdents(), which doesn't
have the 'basep' argument. As other systems have.
2) Provide a getdirentries() call in libcompat, which
has the old behavior.
- Frank