[lkml]   [1997]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: struct dirent in Linux 2.0

On Wed, 19 Feb 1997, Ulrich Windl wrote:

> > Well, my copy of POSIX.1 (1003.1 from 1988) says:
> >
> > "The readdir() function returns a pointer to an object of type struct
> > dirent that includes the member:
> > Member Type Member Name Description
> > ----------- ----------- -----------
> > char[] d_name Null-terminated filename
> > The character array d_name is of unspecified size, but the number of bytes
> > preceding the terminating null character shall not exceed {NAME_MAX}."
> >
> > So it explicitely states, that d_name is zero-terminated. It mentions no
> > other members of the dirent structure, so any other member is nonstandard
> > (but not explicitly forbidden, you may use it, but then your program does
> > not conform to POSIX.1, I think).
> >
> OK, convinced. Unfortunately the description I had did not
> distinguish what was POSIX, and what was an extension to POSIX.
One other question - is the address returned by readdir valid only
until the next readdir for the directory in question, or just the next
readdir. Basically, what I'm asking is if in the case of Linux/8086,
where data segement space is tight, can the library code get away with
allocating just one dirent structure, regardless of the number of
directories open? If so, it could be implemented rather easily. (Or, in
worst case, does *each* readdir have to have a different dirent?)

IMHO, the entire readdir() idea dosen't jive well with the core
UNIX syscalls, since the library returns a pointer, instead of having one
preinitialized... oh well. (It's impossible to do a pure in-kernel
implementation of readdir() under ELKS because of this...) Thanks...

- Chad

 \ /
  Last update: 2005-03-22 13:38    [W:0.028 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site