Commit c13c7485 authored by Philip Carns's avatar Philip Carns
Browse files

tentative fix for lseek bug in applications that are compiled without

large file support on 32 bit systems


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@190 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 4de8b230
...@@ -21,7 +21,7 @@ cp_zlib_include_flags = @__CP_ZLIB_INCLUDE_FLAGS@ ...@@ -21,7 +21,7 @@ cp_zlib_include_flags = @__CP_ZLIB_INCLUDE_FLAGS@
# potentially buggy libz 64 bit offset support # potentially buggy libz 64 bit offset support
CFLAGS = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -Wall CFLAGS = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -Wall
CFLAGS_MPI = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Wall CFLAGS_MPI = -I . -I $(srcdir) @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -Wall
CC=@MPICC@ CC=@MPICC@
LD=@MPICC@ LD=@MPICC@
......
This diff is collapsed.
...@@ -114,7 +114,7 @@ CFLAGS="$old_cflags" ...@@ -114,7 +114,7 @@ CFLAGS="$old_cflags"
# libc functions wrapped by darshan # libc functions wrapped by darshan
CP_WRAPPERS="-Wl,-u,MPI_Wtime,-wrap,write,-wrap,open,-wrap,creat,-wrap,creat64,-wrap,open64,-wrap,close,-wrap,read,-wrap,lseek,-wrap,lseek64,-wrap,pread,-wrap,pwrite,-wrap,readv,-wrap,writev,-wrap,__xstat,-wrap,__lxstat,-wrap,__fxstat,-wrap,__xstat64,-wrap,__lxstat64,-wrap,__fxstat64,-wrap,mmap,-wrap,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create,-wrap,ncmpi_open,-wrap,ncmpi_close,-wrap,H5Fcreate,-wrap,H5Fopen,-wrap,H5Fclose" CP_WRAPPERS="-Wl,-u,MPI_Wtime,-wrap,write,-wrap,open,-wrap,creat,-wrap,creat64,-wrap,open64,-wrap,close,-wrap,read,-wrap,lseek,-wrap,lseek64,-wrap,pread,-wrap,pwrite,-wrap,readv,-wrap,writev,-wrap,__xstat,-wrap,__lxstat,-wrap,__fxstat,-wrap,__xstat64,-wrap,__lxstat64,-wrap,__fxstat64,-wrap,mmap,-wrap,mmap64,-wrap,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create,-wrap,ncmpi_open,-wrap,ncmpi_close,-wrap,H5Fcreate,-wrap,H5Fopen,-wrap,H5Fclose"
# ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock # ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock
......
...@@ -45,13 +45,10 @@ ...@@ -45,13 +45,10 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* The size of `long int', as computed by sizeof. */ /* The size of a `long int', as computed by sizeof. */
#undef SIZEOF_LONG_INT #undef SIZEOF_LONG_INT
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
......
...@@ -38,19 +38,21 @@ extern ssize_t __real_read(int fd, void *buf, size_t count); ...@@ -38,19 +38,21 @@ extern ssize_t __real_read(int fd, void *buf, size_t count);
extern off_t __real_lseek(int fd, off_t offset, int whence); extern off_t __real_lseek(int fd, off_t offset, int whence);
extern off64_t __real_lseek64(int fd, off64_t offset, int whence); extern off64_t __real_lseek64(int fd, off64_t offset, int whence);
extern ssize_t __real_pread(int fd, void *buf, size_t count, off_t offset); extern ssize_t __real_pread(int fd, void *buf, size_t count, off_t offset);
extern ssize_t __real_pread64(int fd, void *buf, size_t count, off_t offset); extern ssize_t __real_pread64(int fd, void *buf, size_t count, off64_t offset);
extern ssize_t __real_pwrite(int fd, const void *buf, size_t count, off_t offset); extern ssize_t __real_pwrite(int fd, const void *buf, size_t count, off_t offset);
extern ssize_t __real_pwrite64(int fd, const void *buf, size_t count, off_t offset); extern ssize_t __real_pwrite64(int fd, const void *buf, size_t count, off64_t offset);
extern ssize_t __real_readv(int fd, const struct iovec *iov, int iovcnt); extern ssize_t __real_readv(int fd, const struct iovec *iov, int iovcnt);
extern ssize_t __real_writev(int fd, const struct iovec *iov, int iovcnt); extern ssize_t __real_writev(int fd, const struct iovec *iov, int iovcnt);
extern int __real___fxstat(int vers, int fd, struct stat *buf); extern int __real___fxstat(int vers, int fd, struct stat *buf);
extern int __real___lxstat(int vers, const char* path, struct stat *buf); extern int __real___lxstat(int vers, const char* path, struct stat *buf);
extern int __real___xstat(int vers, const char* path, struct stat *buf); extern int __real___xstat(int vers, const char* path, struct stat *buf);
extern int __real___fxstat64(int vers, int fd, struct stat *buf); extern int __real___fxstat64(int vers, int fd, struct stat64 *buf);
extern int __real___lxstat64(int vers, const char* path, struct stat *buf); extern int __real___lxstat64(int vers, const char* path, struct stat64 *buf);
extern int __real___xstat64(int vers, const char* path, struct stat *buf); extern int __real___xstat64(int vers, const char* path, struct stat64 *buf);
extern void* __real_mmap(void *addr, size_t length, int prot, int flags, extern void* __real_mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset); int fd, off_t offset);
extern void* __real_mmap64(void *addr, size_t length, int prot, int flags,
int fd, off64_t offset);
extern FILE* __real_fopen(const char *path, const char *mode); extern FILE* __real_fopen(const char *path, const char *mode);
extern FILE* __real_fopen64(const char *path, const char *mode); extern FILE* __real_fopen64(const char *path, const char *mode);
extern int __real_fclose(FILE *fp); extern int __real_fclose(FILE *fp);
...@@ -64,7 +66,7 @@ extern int __real_fdatasync(int fd); ...@@ -64,7 +66,7 @@ extern int __real_fdatasync(int fd);
pthread_mutex_t cp_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t cp_mutex = PTHREAD_MUTEX_INITIALIZER;
struct darshan_job_runtime* darshan_global_job = NULL; struct darshan_job_runtime* darshan_global_job = NULL;
static int my_rank = -1; static int my_rank = -1;
static struct stat cp_stat_buf; static struct stat64 cp_stat_buf;
/* these are paths that we will not trace */ /* these are paths that we will not trace */
static char* exclusions[] = { static char* exclusions[] = {
...@@ -207,7 +209,7 @@ static void cp_access_counter(struct darshan_file_runtime* file, ssize_t size, ...@@ -207,7 +209,7 @@ static void cp_access_counter(struct darshan_file_runtime* file, ssize_t size,
if(file->fd != -1) break; /* TODO: handle multiple concurrent opens */ \ if(file->fd != -1) break; /* TODO: handle multiple concurrent opens */ \
file->fd = __ret; \ file->fd = __ret; \
if(!CP_VALUE(file, CP_FILE_ALIGNMENT)){ \ if(!CP_VALUE(file, CP_FILE_ALIGNMENT)){ \
if(fstat(file->fd, &cp_stat_buf) == 0) {\ if(fstat64(file->fd, &cp_stat_buf) == 0) {\
CP_SET(file, CP_DEVICE, cp_stat_buf.st_dev); \ CP_SET(file, CP_DEVICE, cp_stat_buf.st_dev); \
CP_SET(file, CP_FILE_ALIGNMENT, cp_stat_buf.st_blksize); \ CP_SET(file, CP_FILE_ALIGNMENT, cp_stat_buf.st_blksize); \
CP_SET(file, CP_SIZE_AT_OPEN, cp_stat_buf.st_size); \ CP_SET(file, CP_SIZE_AT_OPEN, cp_stat_buf.st_size); \
...@@ -375,6 +377,28 @@ int __wrap_fdatasync(int fd) ...@@ -375,6 +377,28 @@ int __wrap_fdatasync(int fd)
} }
void* __wrap_mmap64(void *addr, size_t length, int prot, int flags,
int fd, off64_t offset)
{
void* ret;
struct darshan_file_runtime* file;
ret = __real_mmap64(addr, length, prot, flags, fd, offset);
if(ret == MAP_FAILED)
return(ret);
CP_LOCK();
file = darshan_file_by_fd(fd);
if(file)
{
CP_INC(file, CP_POSIX_MMAPS, 1);
}
CP_UNLOCK();
return(ret);
}
void* __wrap_mmap(void *addr, size_t length, int prot, int flags, void* __wrap_mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset) int fd, off_t offset)
{ {
...@@ -532,7 +556,7 @@ FILE* __wrap_fopen(const char *path, const char *mode) ...@@ -532,7 +556,7 @@ FILE* __wrap_fopen(const char *path, const char *mode)
return(ret); return(ret);
} }
int __wrap___xstat64(int vers, const char *path, struct stat *buf) int __wrap___xstat64(int vers, const char *path, struct stat64 *buf)
{ {
int ret; int ret;
struct darshan_file_runtime* file; struct darshan_file_runtime* file;
...@@ -555,7 +579,7 @@ int __wrap___xstat64(int vers, const char *path, struct stat *buf) ...@@ -555,7 +579,7 @@ int __wrap___xstat64(int vers, const char *path, struct stat *buf)
return(ret); return(ret);
} }
int __wrap___lxstat64(int vers, const char *path, struct stat *buf) int __wrap___lxstat64(int vers, const char *path, struct stat64 *buf)
{ {
int ret; int ret;
struct darshan_file_runtime* file; struct darshan_file_runtime* file;
...@@ -578,7 +602,7 @@ int __wrap___lxstat64(int vers, const char *path, struct stat *buf) ...@@ -578,7 +602,7 @@ int __wrap___lxstat64(int vers, const char *path, struct stat *buf)
return(ret); return(ret);
} }
int __wrap___fxstat64(int vers, int fd, struct stat *buf) int __wrap___fxstat64(int vers, int fd, struct stat64 *buf)
{ {
int ret; int ret;
struct darshan_file_runtime* file; struct darshan_file_runtime* file;
...@@ -665,7 +689,7 @@ int __wrap___fxstat(int vers, int fd, struct stat *buf) ...@@ -665,7 +689,7 @@ int __wrap___fxstat(int vers, int fd, struct stat *buf)
return(ret); return(ret);
/* skip logging if this was triggered internally */ /* skip logging if this was triggered internally */
if(buf == &cp_stat_buf) if((void*)buf == (void*)&cp_stat_buf)
return(ret); return(ret);
CP_LOCK(); CP_LOCK();
...@@ -679,7 +703,7 @@ int __wrap___fxstat(int vers, int fd, struct stat *buf) ...@@ -679,7 +703,7 @@ int __wrap___fxstat(int vers, int fd, struct stat *buf)
return(ret); return(ret);
} }
ssize_t __wrap_pread64(int fd, void *buf, size_t count, off_t offset) ssize_t __wrap_pread64(int fd, void *buf, size_t count, off64_t offset)
{ {
ssize_t ret; ssize_t ret;
int aligned_flag = 0; int aligned_flag = 0;
...@@ -734,7 +758,7 @@ ssize_t __wrap_pwrite(int fd, const void *buf, size_t count, off_t offset) ...@@ -734,7 +758,7 @@ ssize_t __wrap_pwrite(int fd, const void *buf, size_t count, off_t offset)
return(ret); return(ret);
} }
ssize_t __wrap_pwrite64(int fd, const void *buf, size_t count, off_t offset) ssize_t __wrap_pwrite64(int fd, const void *buf, size_t count, off64_t offset)
{ {
ssize_t ret; ssize_t ret;
int aligned_flag = 0; int aligned_flag = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment