Commit fcd42722 authored by Philip Carns's avatar Philip Carns

fix 64 bit handling for aio functions


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@767 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 5daf20f9
...@@ -4057,6 +4057,37 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ...@@ -4057,6 +4057,37 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct aiocb64" >&5
$as_echo_n "checking for struct aiocb64... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <aio.h>
int
main ()
{
struct aiocb64 aiocb;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_AIOCB64 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$old_cflags"
old_cflags="$CFLAGS" old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE" CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5
......
...@@ -135,6 +135,22 @@ dnl Check byte ordering ...@@ -135,6 +135,22 @@ dnl Check byte ordering
AC_C_BIGENDIAN AC_C_BIGENDIAN
dnl temporarily set large file flags just for this test; we don't want
dnl it to propagate to the makefile because of zlib bugs
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
AC_MSG_CHECKING(for struct aiocb64)
AC_TRY_COMPILE(
[
#include <aio.h>
],
[ struct aiocb64 aiocb; ],
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AIOCB64, 1, Define if struct aiocb64 type is defined),
AC_MSG_RESULT(no)
)
CFLAGS="$old_cflags"
dnl temporarily set large file flags just for this test; we don't want dnl temporarily set large file flags just for this test; we don't want
dnl it to propagate to the makefile because of zlib bugs dnl it to propagate to the makefile because of zlib bugs
old_cflags="$CFLAGS" old_cflags="$CFLAGS"
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
/* Define if cuserid() should be disabled */ /* Define if cuserid() should be disabled */
#undef DARSHAN_DISABLE_CUSERID #undef DARSHAN_DISABLE_CUSERID
/* Define if struct aiocb64 type is defined */
#undef HAVE_AIOCB64
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#ifndef HAVE_OFF64_T #ifndef HAVE_OFF64_T
typedef int64_t off64_t; typedef int64_t off64_t;
#endif #endif
#ifndef HAVE_AIOCB64
#define aiocb64 aiocb
#endif
extern char* __progname_full; extern char* __progname_full;
...@@ -103,13 +106,13 @@ DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence)); ...@@ -103,13 +106,13 @@ DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
DARSHAN_FORWARD_DECL(fsync, int, (int fd)); DARSHAN_FORWARD_DECL(fsync, int, (int fd));
DARSHAN_FORWARD_DECL(fdatasync, int, (int fd)); DARSHAN_FORWARD_DECL(fdatasync, int, (int fd));
DARSHAN_FORWARD_DECL(aio_read, int, (struct aiocb *aiocbp)); DARSHAN_FORWARD_DECL(aio_read, int, (struct aiocb *aiocbp));
DARSHAN_FORWARD_DECL(aio_read64, int, (struct aiocb *aiocbp)); DARSHAN_FORWARD_DECL(aio_read64, int, (struct aiocb64 *aiocbp));
DARSHAN_FORWARD_DECL(aio_write, int, (struct aiocb *aiocbp)); DARSHAN_FORWARD_DECL(aio_write, int, (struct aiocb *aiocbp));
DARSHAN_FORWARD_DECL(aio_write64, int, (struct aiocb *aiocbp)); DARSHAN_FORWARD_DECL(aio_write64, int, (struct aiocb64 *aiocbp));
DARSHAN_FORWARD_DECL(lio_listio, int, (int mode, struct aiocb *const aiocb_list[], int nitems, struct sigevent *sevp)); DARSHAN_FORWARD_DECL(lio_listio, int, (int mode, struct aiocb *const aiocb_list[], int nitems, struct sigevent *sevp));
DARSHAN_FORWARD_DECL(lio_listio64, int, (int mode, struct aiocb *const aiocb_list[], int nitems, struct sigevent *sevp)); DARSHAN_FORWARD_DECL(lio_listio64, int, (int mode, struct aiocb64 *const aiocb_list[], int nitems, struct sigevent *sevp));
DARSHAN_FORWARD_DECL(aio_return, ssize_t, (struct aiocb *aiocbp)); DARSHAN_FORWARD_DECL(aio_return, ssize_t, (struct aiocb *aiocbp));
DARSHAN_FORWARD_DECL(aio_return64, ssize_t, (struct aiocb *aiocbp)); DARSHAN_FORWARD_DECL(aio_return64, ssize_t, (struct aiocb64 *aiocbp));
pthread_mutex_t cp_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; pthread_mutex_t cp_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
struct darshan_job_runtime* darshan_global_job = NULL; struct darshan_job_runtime* darshan_global_job = NULL;
...@@ -121,7 +124,7 @@ static int darshan_mem_alignment = 1; ...@@ -121,7 +124,7 @@ static int darshan_mem_alignment = 1;
struct darshan_aio_tracker struct darshan_aio_tracker
{ {
double tm1; double tm1;
struct aiocb *aiocbp; void *aiocbp;
struct darshan_aio_tracker* next; struct darshan_aio_tracker* next;
}; };
...@@ -153,8 +156,8 @@ static struct darshan_file_runtime* darshan_file_by_fd(int fd); ...@@ -153,8 +156,8 @@ static struct darshan_file_runtime* darshan_file_by_fd(int fd);
static void darshan_file_close_fd(int fd); static void darshan_file_close_fd(int fd);
static struct darshan_file_runtime* darshan_file_by_name_setfd(const char* name, int fd); static struct darshan_file_runtime* darshan_file_by_name_setfd(const char* name, int fd);
static char* clean_path(const char* path); static char* clean_path(const char* path);
static void darshan_aio_tracker_add(struct aiocb *aiocbp); static void darshan_aio_tracker_add(int fd, void *aiocbp);
static struct darshan_aio_tracker* darshan_aio_tracker_del(struct aiocb *aiocbp); static struct darshan_aio_tracker* darshan_aio_tracker_del(int fd, void *aiocbp);
#define CP_RECORD_WRITE(__ret, __fd, __count, __pwrite_flag, __pwrite_offset, __aligned, __stream_flag, __tm1, __tm2) do{ \ #define CP_RECORD_WRITE(__ret, __fd, __count, __pwrite_flag, __pwrite_offset, __aligned, __stream_flag, __tm1, __tm2) do{ \
size_t stride; \ size_t stride; \
...@@ -1038,7 +1041,7 @@ off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence) ...@@ -1038,7 +1041,7 @@ off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence)
return(ret); return(ret);
} }
ssize_t DARSHAN_DECL(aio_return64)(struct aiocb *aiocbp) ssize_t DARSHAN_DECL(aio_return64)(struct aiocb64 *aiocbp)
{ {
int ret; int ret;
double tm2; double tm2;
...@@ -1049,7 +1052,7 @@ ssize_t DARSHAN_DECL(aio_return64)(struct aiocb *aiocbp) ...@@ -1049,7 +1052,7 @@ ssize_t DARSHAN_DECL(aio_return64)(struct aiocb *aiocbp)
ret = __real_aio_return64(aiocbp); ret = __real_aio_return64(aiocbp);
tm2 = darshan_wtime(); tm2 = darshan_wtime();
tmp = darshan_aio_tracker_del(aiocbp); tmp = darshan_aio_tracker_del(aiocbp->aio_fildes, aiocbp);
if(tmp) if(tmp)
{ {
...@@ -1084,7 +1087,7 @@ ssize_t DARSHAN_DECL(aio_return)(struct aiocb *aiocbp) ...@@ -1084,7 +1087,7 @@ ssize_t DARSHAN_DECL(aio_return)(struct aiocb *aiocbp)
ret = __real_aio_return(aiocbp); ret = __real_aio_return(aiocbp);
tm2 = darshan_wtime(); tm2 = darshan_wtime();
tmp = darshan_aio_tracker_del(aiocbp); tmp = darshan_aio_tracker_del(aiocbp->aio_fildes, aiocbp);
if(tmp) if(tmp)
{ {
...@@ -1113,14 +1116,14 @@ int DARSHAN_DECL(lio_listio)(int mode, struct aiocb *const aiocb_list[], ...@@ -1113,14 +1116,14 @@ int DARSHAN_DECL(lio_listio)(int mode, struct aiocb *const aiocb_list[],
{ {
for(i=0; i<nitems; i++) for(i=0; i<nitems; i++)
{ {
darshan_aio_tracker_add(aiocb_list[i]); darshan_aio_tracker_add(aiocb_list[i]->aio_fildes, aiocb_list[i]);
} }
} }
return(ret); return(ret);
} }
int DARSHAN_DECL(lio_listio64)(int mode, struct aiocb *const aiocb_list[], int DARSHAN_DECL(lio_listio64)(int mode, struct aiocb64 *const aiocb_list[],
int nitems, struct sigevent *sevp) int nitems, struct sigevent *sevp)
{ {
int ret; int ret;
...@@ -1128,19 +1131,19 @@ int DARSHAN_DECL(lio_listio64)(int mode, struct aiocb *const aiocb_list[], ...@@ -1128,19 +1131,19 @@ int DARSHAN_DECL(lio_listio64)(int mode, struct aiocb *const aiocb_list[],
MAP_OR_FAIL(lio_listio); MAP_OR_FAIL(lio_listio);
ret = __real_lio_listio(mode, aiocb_list, nitems, sevp); ret = __real_lio_listio64(mode, aiocb_list, nitems, sevp);
if(ret == 0) if(ret == 0)
{ {
for(i=0; i<nitems; i++) for(i=0; i<nitems; i++)
{ {
darshan_aio_tracker_add(aiocb_list[i]); darshan_aio_tracker_add(aiocb_list[i]->aio_fildes, aiocb_list[i]);
} }
} }
return(ret); return(ret);
} }
int DARSHAN_DECL(aio_write64)(struct aiocb *aiocbp) int DARSHAN_DECL(aio_write64)(struct aiocb64 *aiocbp)
{ {
int ret; int ret;
...@@ -1148,7 +1151,7 @@ int DARSHAN_DECL(aio_write64)(struct aiocb *aiocbp) ...@@ -1148,7 +1151,7 @@ int DARSHAN_DECL(aio_write64)(struct aiocb *aiocbp)
ret = __real_aio_write64(aiocbp); ret = __real_aio_write64(aiocbp);
if(ret == 0) if(ret == 0)
darshan_aio_tracker_add(aiocbp); darshan_aio_tracker_add(aiocbp->aio_fildes, aiocbp);
return(ret); return(ret);
} }
...@@ -1161,12 +1164,12 @@ int DARSHAN_DECL(aio_write)(struct aiocb *aiocbp) ...@@ -1161,12 +1164,12 @@ int DARSHAN_DECL(aio_write)(struct aiocb *aiocbp)
ret = __real_aio_write(aiocbp); ret = __real_aio_write(aiocbp);
if(ret == 0) if(ret == 0)
darshan_aio_tracker_add(aiocbp); darshan_aio_tracker_add(aiocbp->aio_fildes, aiocbp);
return(ret); return(ret);
} }
int DARSHAN_DECL(aio_read64)(struct aiocb *aiocbp) int DARSHAN_DECL(aio_read64)(struct aiocb64 *aiocbp)
{ {
int ret; int ret;
...@@ -1174,7 +1177,7 @@ int DARSHAN_DECL(aio_read64)(struct aiocb *aiocbp) ...@@ -1174,7 +1177,7 @@ int DARSHAN_DECL(aio_read64)(struct aiocb *aiocbp)
ret = __real_aio_read64(aiocbp); ret = __real_aio_read64(aiocbp);
if(ret == 0) if(ret == 0)
darshan_aio_tracker_add(aiocbp); darshan_aio_tracker_add(aiocbp->aio_fildes, aiocbp);
return(ret); return(ret);
} }
...@@ -1187,7 +1190,7 @@ int DARSHAN_DECL(aio_read)(struct aiocb *aiocbp) ...@@ -1187,7 +1190,7 @@ int DARSHAN_DECL(aio_read)(struct aiocb *aiocbp)
ret = __real_aio_read(aiocbp); ret = __real_aio_read(aiocbp);
if(ret == 0) if(ret == 0)
darshan_aio_tracker_add(aiocbp); darshan_aio_tracker_add(aiocbp->aio_fildes, aiocbp);
return(ret); return(ret);
} }
...@@ -2123,13 +2126,13 @@ static char* clean_path(const char* path) ...@@ -2123,13 +2126,13 @@ static char* clean_path(const char* path)
} }
/* adds a tracker for the given aio operation */ /* adds a tracker for the given aio operation */
static void darshan_aio_tracker_add(struct aiocb *aiocbp) static void darshan_aio_tracker_add(int fd, void *aiocbp)
{ {
struct darshan_aio_tracker* tracker; struct darshan_aio_tracker* tracker;
struct darshan_file_runtime* file; struct darshan_file_runtime* file;
CP_LOCK(); CP_LOCK();
file = darshan_file_by_fd(aiocbp->aio_fildes); file = darshan_file_by_fd(fd);
if(file) if(file)
{ {
tracker = malloc(sizeof(*tracker)); tracker = malloc(sizeof(*tracker));
...@@ -2159,13 +2162,13 @@ static void darshan_aio_tracker_add(struct aiocb *aiocbp) ...@@ -2159,13 +2162,13 @@ static void darshan_aio_tracker_add(struct aiocb *aiocbp)
* *
* returns NULL if aio operation not found * returns NULL if aio operation not found
*/ */
static struct darshan_aio_tracker* darshan_aio_tracker_del(struct aiocb *aiocbp) static struct darshan_aio_tracker* darshan_aio_tracker_del(int fd, void *aiocbp)
{ {
struct darshan_aio_tracker *tmp, *prev; struct darshan_aio_tracker *tmp, *prev;
struct darshan_file_runtime* file; struct darshan_file_runtime* file;
CP_LOCK(); CP_LOCK();
file = darshan_file_by_fd(aiocbp->aio_fildes); file = darshan_file_by_fd(fd);
if(file) if(file)
{ {
/* is there a tracker struct for this operation? */ /* is there a tracker struct for this operation? */
......
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