diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-06-25 14:31:30 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-06-29 10:42:07 -0700 |
commit | d6ce087395220ea0b6e4bff4d3e561de624447a3 (patch) | |
tree | 4d9f92ea82ecf2b0b6aabb7cf800f2aa1c3b1db0 /booster/src | |
parent | f5ec3b6a9597bb50fe4d8b6a4c9d92a3b46306dc (diff) |
booster: Another attempt to fix 32 and 64 bit interoperability
With this patch, we might have finally arrived at a solution
to the problem of function definition conflicts between
our functions and those of libc while over-riding the libc versions.
This commit defines functions which do not conflict with libc,
then it uses libc's own macro to redirect/rename these functions
to the actual sys call names in the binary.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r-- | booster/src/booster.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index 7a3da7da132..26cf6b6113f 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -457,20 +457,29 @@ out: return ret; } +/* This is done to over-write existing definitions of open and open64 inside + * libc with our own copies. __REDIRECT is provided by libc. + * + * XXX: This will not work anywhere other than libc based systems. + */ +int __REDIRECT (booster_false_open, (__const char *__file, int __oflag, ...), + open) __nonnull ((1)); +int __REDIRECT (booster_false_open64, (__const char *__file, int __oflag, ...), + open64) __nonnull ((1)); int -open (const char *pathname, int flags, ...) +booster_false_open (const char *pathname, int flags, ...) { - int ret = -1; - mode_t mode = 0; - va_list ap; + int ret; + mode_t mode = 0; + va_list ap; if (flags & GF_O_CREAT) { va_start (ap, flags); mode = va_arg (ap, mode_t); va_end (ap); - ret = booster_open (pathname, BOOSTER_DONT_USE_OPEN64, - flags, mode); + ret = booster_open (pathname, BOOSTER_DONT_USE_OPEN64, flags, + mode); } else ret = booster_open (pathname, BOOSTER_DONT_USE_OPEN64, flags); @@ -478,13 +487,12 @@ open (const char *pathname, int flags, ...) return ret; } -#if !defined (__USE_LARGEFILE64) && !defined (__USE_FILE_OFFSET64) int -open64 (const char *pathname, int flags, ...) +booster_false_open64 (const char *pathname, int flags, ...) { - int ret; - mode_t mode = 0; - va_list ap; + int ret; + mode_t mode = 0; + va_list ap; if (flags & GF_O_CREAT) { va_start (ap, flags); @@ -498,7 +506,6 @@ open64 (const char *pathname, int flags, ...) return ret; } -#endif int vmp_creat (const char *pathname, mode_t mode) @@ -1342,8 +1349,13 @@ out: return (DIR *)bh; } +int __REDIRECT (booster_false_readdir_r, (DIR *dir, struct dirent *entry, + struct dirent **result), readdir_r) __nonnull ((1)); +int __REDIRECT (booster_false_readdir64_r, (DIR *dir, struct dirent64 *entry, + struct dirent64 **result), readdir64_r) __nonnull ((1)); + int -readdir_r (DIR *dir, struct dirent *entry, struct dirent **result) +booster_false_readdir_r (DIR *dir, struct dirent *entry, struct dirent **result) { struct booster_dir_handle *bh = (struct booster_dir_handle *)dir; int ret = 0; @@ -1372,10 +1384,9 @@ out: return ret; } - -#if !defined (__USE_LARGEFILE64) && !defined (__USE_FILE_OFFSET64) int -readdir64_r (DIR *dir, struct dirent64 *entry, struct dirent64 **result) +booster_false_readdir64_r (DIR *dir, struct dirent64 *entry, + struct dirent64 **result) { struct booster_dir_handle *bh = (struct booster_dir_handle *)dir; int ret = 0; @@ -1403,7 +1414,6 @@ readdir64_r (DIR *dir, struct dirent64 *entry, struct dirent64 **result) out: return ret; } -#endif struct dirent * booster_readdir (DIR *dir) |