Coda File System

Re: getcwd

From: Miklos Szeredi <Miklos.Szeredi_at_eth.ericsson.se>
Date: Wed, 16 Jun 1999 18:09:48 +0200
> In there is another thing in this disucssion that doesn't make sense to me.
> A POSIX compliant implementation of getwd (getcwd) may NOT use the inode
> numbers in directories returned by readdir.  It MUST use those obtained from
> stat (see the POSIX spec).
> 
> The glibc getwd code will do readdir solely to obtain the names, not to
> obtain the inode numbers, which it gets by doing a stat call on each name in
> the directory.

Here is a code segment from the the current (2.1.1) glibc source:

glibc/sysdeps/posix/getcwd.c
[...]
      while ((d = __readdir (dirstream)) != NULL)
	{
	  if (d->d_name[0] == '.' &&
	      (d->d_name[1] == '\0' ||
	       (d->d_name[1] == '.' && d->d_name[2] == '\0')))
	    continue;
	  if (mount_point || (ino_t) d->d_ino == thisino)
	    {
[...]

Well, maybe the glibc developers should be told, that their
implementation is not POSIX compliant.

> For a while, Coda just put -1 as the inode number in the directory container
> files, and things worked fine.

Then I don't understand how it works for you. It doesn't work for me
under either glibc 2.0 or libc5. It works with glibc 2.1 because that
uses the getcwd system call instead of searching.

Miklos

Ps. I have a bit of a bad conscience about bothering the coda team
with my problems, which have nothing direct to do with the workings of
the coda system, as I only use the kernel interface.

If you think, that using this interface for non-coda thins is a bad
idea than please say it!

I think that this interface is general, and good enough to be used for
things other then connecting to venus, but in that case I will
probably ask you many more questions (and nag you with oopses I got
from coda).
Received on 1999-06-16 12:12:48