Commit 846df9ec authored by Philip Carns's avatar Philip Carns

use fstat() in place of stat() when stat'ing files at open time


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@652 3b7491f3-a168-0410-bf4b-c445ed680a29
parent bc61e496
...@@ -285,9 +285,9 @@ static inline dev_t get_device(const char* path, struct stat64* statbuf) ...@@ -285,9 +285,9 @@ static inline dev_t get_device(const char* path, struct stat64* statbuf)
} }
#ifdef __CP_STAT_AT_OPEN #ifdef __CP_STAT_AT_OPEN
#define CP_STAT_FILE(_f, _p) do { \ #define CP_STAT_FILE(_f, _p, _r) do { \
if(!CP_VALUE(_f, CP_FILE_ALIGNMENT)){ \ if(!CP_VALUE(_f, CP_FILE_ALIGNMENT)){ \
if(stat64(_p, &cp_stat_buf) == 0) { \ if(fstat64(_r, &cp_stat_buf) == 0) { \
CP_SET(_f, CP_DEVICE, get_device(_p, &cp_stat_buf)); \ CP_SET(_f, CP_DEVICE, get_device(_p, &cp_stat_buf)); \
CP_SET(_f, CP_FILE_ALIGNMENT, cp_stat_buf.st_blksize); \ CP_SET(_f, CP_FILE_ALIGNMENT, cp_stat_buf.st_blksize); \
CP_SET(_f, CP_SIZE_AT_OPEN, cp_stat_buf.st_size); \ CP_SET(_f, CP_SIZE_AT_OPEN, cp_stat_buf.st_size); \
...@@ -295,7 +295,7 @@ static inline dev_t get_device(const char* path, struct stat64* statbuf) ...@@ -295,7 +295,7 @@ static inline dev_t get_device(const char* path, struct stat64* statbuf)
}\ }\
}while(0) }while(0)
#else #else
#define CP_STAT_FILE(_f, _p) do { }while(0) #define CP_STAT_FILE(_f, _p, _r) do { }while(0)
#endif #endif
#define CP_RECORD_OPEN(__ret, __path, __mode, __stream_flag, __tm1, __tm2) do { \ #define CP_RECORD_OPEN(__ret, __path, __mode, __stream_flag, __tm1, __tm2) do { \
...@@ -311,7 +311,7 @@ static inline dev_t get_device(const char* path, struct stat64* statbuf) ...@@ -311,7 +311,7 @@ static inline dev_t get_device(const char* path, struct stat64* statbuf)
if(exclude) break; \ if(exclude) break; \
file = darshan_file_by_name_setfd(__path, __ret); \ file = darshan_file_by_name_setfd(__path, __ret); \
if(!file) break; \ if(!file) break; \
CP_STAT_FILE(file, __path); \ CP_STAT_FILE(file, __path, __ret); \
file->log_file->rank = my_rank; \ file->log_file->rank = my_rank; \
if(__mode) \ if(__mode) \
CP_SET(file, CP_MODE, __mode); \ CP_SET(file, CP_MODE, __mode); \
......
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