Peter Tribble <peter.trib...@gmail.com> wrote: > We've just stumbled across an interesting problem in one of our > applications that fails when run on a ZFS filesystem. > > I don't have the code, so I can't fix it at source, but it's relying > on the fact that if you do readdir() on a directory, the files come > back in the order they were added to the directory. This appears > to be true (within certain limitations) on UFS, but certainly isn't > true on ZFS.
It seems that you found a software that is not POSIX compliant as it expects a behavior that is not granted by POSIX. > Is there any way to force readdir() to return files in a specific order? > (On UFS, we have a scipt that creates symlinks in the correct order. > Ugly, but seems to have worked for many years.) You could write a readdir() replacement that calls struct dirent * (*readdir_real)() = dlsym(RTLD_NEXT, "readdir"); and enforce it via LDPRELOAD= ...but how would you retrieve the creation order? Also note that you would need to read in the whole directory into allocated storage first. BTW: If you like to fix the software, you should know that Linux has at least one filesystem that returns the entries for "." and ".." out of order. Jörg -- EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin j...@cs.tu-berlin.de (uni) joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss