Commit c97d2f19 authored by Shane Snyder's avatar Shane Snyder

more posix wrappers: mkstemp family

parent 6b4f4109
......@@ -97,9 +97,6 @@ enum darshan_posix_indices
/* floating point statistics for POSIX file records */
enum darshan_posix_f_indices
{
/* NOTE: adjust cp_normalize_timestamps() function if any TIMESTAMPS are
* added or modified in this list
*/
POSIX_F_OPEN_TIMESTAMP = 0, /* timestamp of first open */
POSIX_F_READ_START_TIMESTAMP, /* timestamp of first read */
POSIX_F_WRITE_START_TIMESTAMP, /* timestamp of first write */
......
......@@ -4,6 +4,10 @@
--wrap=creat64
--wrap=fopen
--wrap=fopen64
--wrap=mkstemp
--wrap=mkostemp
--wrap=mkstemps
--wrap=mkostemps
--wrap=read
--wrap=write
--wrap=pread
......
......@@ -43,6 +43,10 @@ DARSHAN_FORWARD_DECL(creat, int, (const char* path, mode_t mode));
DARSHAN_FORWARD_DECL(creat64, int, (const char* path, mode_t mode));
DARSHAN_FORWARD_DECL(fopen, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(mkstemp, int, (char *template));
DARSHAN_FORWARD_DECL(mkostemp, int, (char *template, int flags));
DARSHAN_FORWARD_DECL(mkstemps, int, (char *template, int suffixlen));
DARSHAN_FORWARD_DECL(mkostemps, int, (char *template, int suffixlen, int flags));
DARSHAN_FORWARD_DECL(read, ssize_t, (int fd, void *buf, size_t count));
DARSHAN_FORWARD_DECL(write, ssize_t, (int fd, const void *buf, size_t count));
DARSHAN_FORWARD_DECL(pread, ssize_t, (int fd, void *buf, size_t count, off_t offset));
......@@ -68,7 +72,6 @@ DARSHAN_FORWARD_DECL(fsync, int, (int fd));
DARSHAN_FORWARD_DECL(fdatasync, int, (int fd));
DARSHAN_FORWARD_DECL(close, int, (int fd));
DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
/* TODO mkstemp */
/* TODO aio */
/* TODO listio */
......@@ -498,6 +501,82 @@ FILE* DARSHAN_DECL(fopen64)(const char *path, const char *mode)
return(ret);
}
int DARSHAN_DECL(mkstemp)(char* template)
{
int ret;
double tm1, tm2;
MAP_OR_FAIL(mkstemp);
tm1 = darshan_core_wtime();
ret = __real_mkstemp(template);
tm2 = darshan_core_wtime();
POSIX_LOCK();
posix_runtime_initialize();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_UNLOCK();
return(ret);
}
int DARSHAN_DECL(mkostemp)(char* template, int flags)
{
int ret;
double tm1, tm2;
MAP_OR_FAIL(mkostemp);
tm1 = darshan_core_wtime();
ret = __real_mkostemp(template, flags);
tm2 = darshan_core_wtime();
POSIX_LOCK();
posix_runtime_initialize();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_UNLOCK();
return(ret);
}
int DARSHAN_DECL(mkstemps)(char* template, int suffixlen)
{
int ret;
double tm1, tm2;
MAP_OR_FAIL(mkstemps);
tm1 = darshan_core_wtime();
ret = __real_mkstemps(template, suffixlen);
tm2 = darshan_core_wtime();
POSIX_LOCK();
posix_runtime_initialize();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_UNLOCK();
return(ret);
}
int DARSHAN_DECL(mkostemps)(char* template, int suffixlen, int flags)
{
int ret;
double tm1, tm2;
MAP_OR_FAIL(mkostemps);
tm1 = darshan_core_wtime();
ret = __real_mkostemps(template, suffixlen, flags);
tm2 = darshan_core_wtime();
POSIX_LOCK();
posix_runtime_initialize();
POSIX_RECORD_OPEN(ret, template, 0, 0, tm1, tm2);
POSIX_UNLOCK();
return(ret);
}
ssize_t DARSHAN_DECL(read)(int fd, void *buf, size_t count)
{
ssize_t ret;
......
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