Date: Thu, 24 May 2001 08:43:37 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Laurynas Biveinis cc: djgpp-workers AT delorie DOT com Subject: Re: Add d_type member to struct dirent In-Reply-To: <20010523214205.A986@lauras.lt> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 23 May 2001, Laurynas Biveinis wrote: > > ...but in 99.9% cases __internal_readlink() will call just filelength() > > to check for 510 bytes magic size. No open() at all in this case, and plain > > filelength() is cheaper that stat(), isn't it? Files of 510 bytes and not > > symlinks are rare indeed. Let's see - my whole djgpp subdirectory tree takes > > about several hundred megabytes and has ONE such file out of 20205. (Not > > counting symlink testsuite, of course). > > Oh sorry, just now I have noticed the check against 510 bytes in your patch. Yes, the size comes for free when we call findfirst/findnext, so I tested for that, and only marked files as DT_UNKNOWN when the size is 510. > So __internal_readlink would open the file, but it will happen once a month, or > less frequently - maybe it's OK? Perhaps. This should be tested, I think; but to test it, I will need a version of `ls' that uses this feature. I hope I can do that soon. > Another note - please include src/libc/compat/unistd/xsymlink.h and replace > magic number with _SYMLINK_FILE_LEN from here, just in case. Thanks for the tip. How about moving it to some header in include/libc, then? We normally avoid including private headers in other directories (it gets in the way when directory structure is changed).