bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glibc is the culprit - Re: vfs.txt and i_ino


From: Guest section DW
Subject: Re: glibc is the culprit - Re: vfs.txt and i_ino
Date: Sun, 10 Feb 2002 14:23:00 +0100
User-agent: Mutt/1.3.25i

On Sun, Feb 10, 2002 at 11:58:48AM +0000, Anton Altaparmakov wrote:

> So glibc is for some reason hiding inode zero from us...

Well, we can read the source..
For example, sysdeps/unix/readdir.c:

/* Read a directory entry from DIRP.  */
DIRENT_TYPE *
__READDIR (DIR *dirp) {
        do {
                ...
                /* Skip deleted files.  */
        } while(dp->d_ino == 0);

        return dp;
}

Or, for example, sysdeps/generic/glob.c:

# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)

The glibc code assumes that a zero ino
means a file that is to be skipped.

Many filesystem types use a zero d_ino to denote a deleted file.
Of course user space should not worry about such things -
the readdir system call should only return non-deleted items -
but some systems leave this visible.
(Also in the Linux kernel source one finds places where either
ino is returned, or 0, in case no ino was found.)

It is probably best to avoid giving real files ino 0.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]