Messages in this thread | | | Date | Sat, 28 Feb 2004 23:21:36 +0000 | From | Jamie Lokier <> | Subject | Re: [PATCH] Add getdents32t syscall |
| |
Ulrich Drepper wrote: > > In other words, why doesn't glibc ever just make a new major number and > > make its "struct dirent" be the 64-bit version? > > You can't be serious. Can you even imagine the pain this would cause?
Why wouldn't this work?
Change the 32-bit struct dirent to this:
struct direct { #if __BYTE_ORDER == __LITTLE_ENDIAN __ino_t d_ino; __u32 __padding1; __off_t d_off; __u32 __padding2; #elif __BYTE_ORDER == __BIG_ENDIAN __u32 __padding1; __ino_t d_ino; __u32 __padding2; __off_t d_off; #else #error Help! #endif unsigned short int d_reclen; unsigned char d_type; char d_name[256]; };
And also change getdirentries() and readdir() to call the kernel's getdents64.
Use symbol versioning, so that old binaries will link to the old (compatible and slower) functions, and newly compiled code, using the new definition of struct dirent, uses the fast new versions of those functions?
I presume that, if ELF symbol versioning doesn't allow you to do this, then the same trick you do with stat() can be used. From Glibc's <sys/stat.h>:
/* To allow the `struct stat' structure and the file type `mode_t' bits to vary without changing shared library major version number, the `stat' family of functions and `mknod' are in fact inline wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', which all take a leading version-number argument designating the data structure and bits used.
-- Jamie - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |