From mboxrd@z Thu Jan 1 00:00:00 1970 From: ron minnich To: 9fans@cse.psu.edu Subject: Re: [9fans] dirread In-Reply-To: <200403182331.i2INVbsA096235@adat.davidashen.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Thu, 18 Mar 2004 16:49:16 -0700 Topicbox-Message-UUID: 3761f438-eacd-11e9-9e20-41e7f4b1d025 On Fri, 19 Mar 2004, David Tolpin wrote: > > man 2 dirread > > :... > :The data returned by a read(2) on a directory is a set of complete directory > :entries in a machine-independent format, exactly equivalent to the result of > :a stat(2) on each file or subdirectory in the directory. > > But it is not so. stat(2) on each file in the directory, when > there are multiple files with identical names, will return > data for the first entry only. Let's see how much more I can get wrong. Pretend you have a union of /tmp and /tmp2 all bound onto /tmp. /tmp and /tmp2 have a file a in them. You read the dir and you get the union. So that sort of makes sense. You'll see all the /tmp/a twice. You stat the entry, and the pathname resolutions rules apply, so even if there are multiple /tmp/a files, the stat of /tmp/a always resolves to "the one on top", thus you only get that stat info. ron