Commit 991aaa2f authored by Shane Snyder's avatar Shane Snyder
Browse files

refactor file desciptor in logutils

parent 200e9d71
...@@ -22,20 +22,57 @@ ...@@ -22,20 +22,57 @@
/* default input buffer size for decompression algorithm */ /* default input buffer size for decompression algorithm */
#define DARSHAN_DEF_COMP_BUF_SZ (1024*1024) /* 1 MiB */ #define DARSHAN_DEF_COMP_BUF_SZ (1024*1024) /* 1 MiB */
/* special identifers for referring to header, job, and /* special identifers for referring to header, job, and
* record map regions of the darshan log file * record map regions of the darshan log file
*/ */
#define DARSHAN_HEADER_REGION_ID (-3) #define DARSHAN_HEADER_REGION_ID (-3)
#define DARSHAN_JOB_REGION_ID (-2) #define DARSHAN_JOB_REGION_ID (-2)
#define DARSHAN_REC_MAP_REGION_ID (-1) #define DARSHAN_REC_MAP_REGION_ID (-1)
struct darshan_dz_state
{
/* (libz/bzip2) stream data structure for managing
* compression and decompression state */
void *strm;
/* buffer for staging compressed data to/from log file */
unsigned char *buf;
/* size of staging buffer */
int size;
/* for reading logs, flag indicating end of log file region */
int eor;
/* the region we last tried reading/writing */
int prev_reg_id;
};
/* internal fd data structure */
struct darshan_fd_int_state
{
/* posix file descriptor for the log file */
int fildes;
/* file pointer position */
int64_t pos;
/* flag indicating whether log file was created (and written) */
int creat_flag;
/* compression type used on log file (libz or bzip2) */
enum darshan_comp_type comp_type;
/* log file path name */
char logfile_path[PATH_MAX];
/* pointer to exe & mount data in darshan job data structure */
char *exe_mnt_data;
/* whether previous file operations have failed */
int err;
/* compression/decompression state */
struct darshan_dz_state dz;
};
static int darshan_log_getheader(darshan_fd fd); static int darshan_log_getheader(darshan_fd fd);
static int darshan_log_putheader(darshan_fd fd); static int darshan_log_putheader(darshan_fd fd);
static int darshan_log_seek(darshan_fd fd, off_t offset); static int darshan_log_seek(darshan_fd fd, off_t offset);
static int darshan_log_read(darshan_fd fd, void *buf, int len); static int darshan_log_read(darshan_fd fd, void *buf, int len);
static int darshan_log_write(darshan_fd fd, void *buf, int len); static int darshan_log_write(darshan_fd fd, void *buf, int len);
static int darshan_log_dzinit(darshan_fd fd); static int darshan_log_dzinit(struct darshan_fd_int_state *state);
static void darshan_log_dzdestroy(darshan_fd fd); static void darshan_log_dzdestroy(struct darshan_fd_int_state *state);
static int darshan_log_dzread(darshan_fd fd, int region_id, void *buf, int len); static int darshan_log_dzread(darshan_fd fd, int region_id, void *buf, int len);
static int darshan_log_dzwrite(darshan_fd fd, int region_id, void *buf, int len); static int darshan_log_dzwrite(darshan_fd fd, int region_id, void *buf, int len);
static int darshan_log_libz_read(darshan_fd fd, int region_id, void *buf, int len); static int darshan_log_libz_read(darshan_fd fd, int region_id, void *buf, int len);
...@@ -82,40 +119,49 @@ struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS] = ...@@ -82,40 +119,49 @@ struct darshan_mod_logutil_funcs *mod_logutils[DARSHAN_MAX_MODS] =
darshan_fd darshan_log_open(const char *name) darshan_fd darshan_log_open(const char *name)
{ {
darshan_fd tmp_fd; darshan_fd tmp_fd;
int o_flags = O_RDONLY;
int ret; int ret;
/* allocate a darshan file descriptor */
tmp_fd = malloc(sizeof(*tmp_fd)); tmp_fd = malloc(sizeof(*tmp_fd));
if(!tmp_fd) if(!tmp_fd)
return(NULL); return(NULL);
memset(tmp_fd, 0, sizeof(*tmp_fd)); memset(tmp_fd, 0, sizeof(*tmp_fd));
tmp_fd->state = malloc(sizeof(struct darshan_fd_int_state));
if(!tmp_fd->state)
{
free(tmp_fd->state);
return(NULL);
}
memset(tmp_fd->state, 0, sizeof(struct darshan_fd_int_state));
/* open the log file in read mode */ /* open the log file in read mode */
tmp_fd->fildes = open(name, o_flags); tmp_fd->state->fildes = open(name, O_RDONLY);
if(tmp_fd->fildes < 0) if(tmp_fd->state->fildes < 0)
{ {
fprintf(stderr, "Error: failed to open darshan log file %s.\n", name); fprintf(stderr, "Error: failed to open darshan log file %s.\n", name);
free(tmp_fd->state);
free(tmp_fd); free(tmp_fd);
return(NULL); return(NULL);
} }
tmp_fd->o_flags = o_flags; strncpy(tmp_fd->state->logfile_path, name, PATH_MAX);
strncpy(tmp_fd->logfile_path, name, PATH_MAX);
/* read the header from the log file to init fd data structures */ /* read the header from the log file to init fd data structures */
ret = darshan_log_getheader(tmp_fd); ret = darshan_log_getheader(tmp_fd);
if(ret < 0) if(ret < 0)
{ {
close(tmp_fd->fildes); close(tmp_fd->state->fildes);
free(tmp_fd->state);
free(tmp_fd); free(tmp_fd);
return(NULL); return(NULL);
} }
/* initialize compression data structures */ /* initialize compression data structures */
ret = darshan_log_dzinit(tmp_fd); ret = darshan_log_dzinit(tmp_fd->state);
if(ret < 0) if(ret < 0)
{ {
fprintf(stderr, "Error: failed to initialize decompression data structures.\n"); fprintf(stderr, "Error: failed to initialize decompression data structures.\n");
close(tmp_fd->fildes); close(tmp_fd->state->fildes);
free(tmp_fd->state);
free(tmp_fd); free(tmp_fd);
return(NULL); return(NULL);
} }
...@@ -132,26 +178,33 @@ darshan_fd darshan_log_open(const char *name) ...@@ -132,26 +178,33 @@ darshan_fd darshan_log_open(const char *name)
darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type) darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type)
{ {
darshan_fd tmp_fd; darshan_fd tmp_fd;
int o_flags = O_WRONLY | O_CREAT | O_EXCL;
int ret; int ret;
/* allocate a darshan file descriptor */
tmp_fd = malloc(sizeof(*tmp_fd)); tmp_fd = malloc(sizeof(*tmp_fd));
if(!tmp_fd) if(!tmp_fd)
return(NULL); return(NULL);
memset(tmp_fd, 0, sizeof(*tmp_fd)); memset(tmp_fd, 0, sizeof(*tmp_fd));
tmp_fd->state = malloc(sizeof(struct darshan_fd_int_state));
if(!tmp_fd->state)
{
free(tmp_fd);
return(NULL);
}
memset(tmp_fd->state, 0, sizeof(struct darshan_fd_int_state));
/* open the log for writing, making sure to not overwrite existing log */ /* create the log for writing, making sure to not overwrite existing log */
/* TODO: permissions when creating? umask */ tmp_fd->state->fildes = creat(name, 0400);
tmp_fd->fildes = open(name, o_flags, 0400); if(tmp_fd->state->fildes < 0)
if(tmp_fd->fildes < 0)
{ {
fprintf(stderr, "Error: failed to open darshan log file %s.\n", name); fprintf(stderr, "Error: failed to open darshan log file %s.\n", name);
free(tmp_fd->state);
free(tmp_fd); free(tmp_fd);
return(NULL); return(NULL);
} }
tmp_fd->o_flags = o_flags; tmp_fd->state->creat_flag = 1;
tmp_fd->comp_type = comp_type; tmp_fd->state->comp_type = comp_type;
strncpy(tmp_fd->logfile_path, name, PATH_MAX); strncpy(tmp_fd->state->logfile_path, name, PATH_MAX);
/* position file pointer to prealloc space for the log file header /* position file pointer to prealloc space for the log file header
* NOTE: the header is written at close time, after all internal data * NOTE: the header is written at close time, after all internal data
...@@ -161,18 +214,20 @@ darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type ...@@ -161,18 +214,20 @@ darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type
if(ret < 0) if(ret < 0)
{ {
fprintf(stderr, "Error: unable to seek in darshan log file.\n"); fprintf(stderr, "Error: unable to seek in darshan log file.\n");
close(tmp_fd->fildes); close(tmp_fd->state->fildes);
free(tmp_fd->state);
free(tmp_fd); free(tmp_fd);
unlink(name); unlink(name);
return(NULL); return(NULL);
} }
/* initialize compression data structures */ /* initialize compression data structures */
ret = darshan_log_dzinit(tmp_fd); ret = darshan_log_dzinit(tmp_fd->state);
if(ret < 0) if(ret < 0)
{ {
fprintf(stderr, "Error: failed to initialize compression data structures.\n"); fprintf(stderr, "Error: failed to initialize compression data structures.\n");
close(tmp_fd->fildes); close(tmp_fd->state->fildes);
free(tmp_fd->state);
free(tmp_fd); free(tmp_fd);
unlink(name); unlink(name);
return(NULL); return(NULL);
...@@ -189,10 +244,12 @@ darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type ...@@ -189,10 +244,12 @@ darshan_fd darshan_log_create(const char *name, enum darshan_comp_type comp_type
*/ */
int darshan_log_getjob(darshan_fd fd, struct darshan_job *job) int darshan_log_getjob(darshan_fd fd, struct darshan_job *job)
{ {
struct darshan_fd_int_state *state = fd->state;
char job_buf[DARSHAN_JOB_RECORD_SIZE] = {0}; char job_buf[DARSHAN_JOB_RECORD_SIZE] = {0};
int job_buf_sz = DARSHAN_JOB_RECORD_SIZE; int job_buf_sz = DARSHAN_JOB_RECORD_SIZE;
int ret; int ret;
assert(state);
assert(fd->job_map.len > 0 && fd->job_map.off > 0); assert(fd->job_map.len > 0 && fd->job_map.off > 0);
/* read the compressed job data from the log file */ /* read the compressed job data from the log file */
...@@ -216,11 +273,11 @@ int darshan_log_getjob(darshan_fd fd, struct darshan_job *job) ...@@ -216,11 +273,11 @@ int darshan_log_getjob(darshan_fd fd, struct darshan_job *job)
} }
/* save trailing exe & mount information, so it can be retrieved later */ /* save trailing exe & mount information, so it can be retrieved later */
if(!fd->exe_mnt_data) if(!(state->exe_mnt_data))
fd->exe_mnt_data = malloc(DARSHAN_EXE_LEN+1); state->exe_mnt_data = malloc(DARSHAN_EXE_LEN+1);
if(!fd->exe_mnt_data) if(!(state->exe_mnt_data))
return(-1); return(-1);
memcpy(fd->exe_mnt_data, &job_buf[sizeof(*job)], DARSHAN_EXE_LEN+1); memcpy(state->exe_mnt_data, &job_buf[sizeof(*job)], DARSHAN_EXE_LEN+1);
return(0); return(0);
} }
...@@ -233,10 +290,13 @@ int darshan_log_getjob(darshan_fd fd, struct darshan_job *job) ...@@ -233,10 +290,13 @@ int darshan_log_getjob(darshan_fd fd, struct darshan_job *job)
*/ */
int darshan_log_putjob(darshan_fd fd, struct darshan_job *job) int darshan_log_putjob(darshan_fd fd, struct darshan_job *job)
{ {
struct darshan_fd_int_state *state = fd->state;
struct darshan_job job_copy; struct darshan_job job_copy;
int len; int len;
int ret; int ret;
assert(state);
memset(&job_copy, 0, sizeof(*job)); memset(&job_copy, 0, sizeof(*job));
memcpy(&job_copy, job, sizeof(*job)); memcpy(&job_copy, job, sizeof(*job));
...@@ -255,7 +315,7 @@ int darshan_log_putjob(darshan_fd fd, struct darshan_job *job) ...@@ -255,7 +315,7 @@ int darshan_log_putjob(darshan_fd fd, struct darshan_job *job)
ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, &job_copy, sizeof(*job)); ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, &job_copy, sizeof(*job));
if(ret != sizeof(*job)) if(ret != sizeof(*job))
{ {
fd->err = -1; state->err = -1;
fprintf(stderr, "Error: failed to write darshan log file job data.\n"); fprintf(stderr, "Error: failed to write darshan log file job data.\n");
return(-1); return(-1);
} }
...@@ -271,25 +331,28 @@ int darshan_log_putjob(darshan_fd fd, struct darshan_job *job) ...@@ -271,25 +331,28 @@ int darshan_log_putjob(darshan_fd fd, struct darshan_job *job)
*/ */
int darshan_log_getexe(darshan_fd fd, char *buf) int darshan_log_getexe(darshan_fd fd, char *buf)
{ {
struct darshan_fd_int_state *state = fd->state;
char *newline; char *newline;
int ret; int ret;
assert(state);
/* if the exe/mount data has not been saved yet, read in the job info */ /* if the exe/mount data has not been saved yet, read in the job info */
if(!fd->exe_mnt_data) if(!(state->exe_mnt_data))
{ {
struct darshan_job job; struct darshan_job job;
ret = darshan_log_getjob(fd, &job); ret = darshan_log_getjob(fd, &job);
if(ret < 0 || !fd->exe_mnt_data) if(ret < 0 || !(state->exe_mnt_data))
return(-1); return(-1);
} }
/* exe string is located before the first line break */ /* exe string is located before the first line break */
newline = strchr(fd->exe_mnt_data, '\n'); newline = strchr(state->exe_mnt_data, '\n');
/* copy over the exe string */ /* copy over the exe string */
if(newline) if(newline)
memcpy(buf, fd->exe_mnt_data, (newline - fd->exe_mnt_data)); memcpy(buf, state->exe_mnt_data, (newline - state->exe_mnt_data));
return (0); return (0);
} }
...@@ -305,15 +368,16 @@ int darshan_log_getexe(darshan_fd fd, char *buf) ...@@ -305,15 +368,16 @@ int darshan_log_getexe(darshan_fd fd, char *buf)
*/ */
int darshan_log_putexe(darshan_fd fd, char *buf) int darshan_log_putexe(darshan_fd fd, char *buf)
{ {
int len; struct darshan_fd_int_state *state = fd->state;
int len = strlen(buf);
int ret; int ret;
len = strlen(buf); assert(fd->state);
ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, buf, len); ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, buf, len);
if(ret != len) if(ret != len)
{ {
fd->err = -1; state->err = -1;
fprintf(stderr, "Error: failed to write exe string to darshan log file.\n"); fprintf(stderr, "Error: failed to write exe string to darshan log file.\n");
return(-1); return(-1);
} }
...@@ -332,23 +396,26 @@ int darshan_log_putexe(darshan_fd fd, char *buf) ...@@ -332,23 +396,26 @@ int darshan_log_putexe(darshan_fd fd, char *buf)
int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts, int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
char*** fs_types, int* count) char*** fs_types, int* count)
{ {
struct darshan_fd_int_state *state = fd->state;
char *pos; char *pos;
int array_index = 0; int array_index = 0;
int ret; int ret;
assert(state);
/* if the exe/mount data has not been saved yet, read in the job info */ /* if the exe/mount data has not been saved yet, read in the job info */
if(!fd->exe_mnt_data) if(!(state->exe_mnt_data))
{ {
struct darshan_job job; struct darshan_job job;
ret = darshan_log_getjob(fd, &job); ret = darshan_log_getjob(fd, &job);
if(ret < 0 || !fd->exe_mnt_data) if(ret < 0 || !(state->exe_mnt_data))
return(-1); return(-1);
} }
/* count entries */ /* count entries */
*count = 0; *count = 0;
pos = fd->exe_mnt_data; pos = state->exe_mnt_data;
while((pos = strchr(pos, '\n')) != NULL) while((pos = strchr(pos, '\n')) != NULL)
{ {
pos++; pos++;
...@@ -370,7 +437,7 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts, ...@@ -370,7 +437,7 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
/* work backwards through the table and parse each line (except for /* work backwards through the table and parse each line (except for
* first, which holds command line information) * first, which holds command line information)
*/ */
while((pos = strrchr(fd->exe_mnt_data, '\n')) != NULL) while((pos = strrchr(state->exe_mnt_data, '\n')) != NULL)
{ {
/* overestimate string lengths */ /* overestimate string lengths */
(*mnt_pts)[array_index] = malloc(DARSHAN_EXE_LEN); (*mnt_pts)[array_index] = malloc(DARSHAN_EXE_LEN);
...@@ -404,6 +471,7 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts, ...@@ -404,6 +471,7 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
*/ */
int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int count) int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int count)
{ {
struct darshan_fd_int_state *state = fd->state;
int i; int i;
char line[1024]; char line[1024];
char mnt_dat[DARSHAN_EXE_LEN] = {0}; char mnt_dat[DARSHAN_EXE_LEN] = {0};
...@@ -411,6 +479,8 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co ...@@ -411,6 +479,8 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co
char *tmp; char *tmp;
int ret; int ret;
assert(state);
/* write each mount entry to file */ /* write each mount entry to file */
tmp = mnt_dat; tmp = mnt_dat;
for(i=count-1; i>=0; i--) for(i=count-1; i>=0; i--)
...@@ -425,7 +495,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co ...@@ -425,7 +495,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co
ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, mnt_dat, mnt_dat_sz); ret = darshan_log_dzwrite(fd, DARSHAN_JOB_REGION_ID, mnt_dat, mnt_dat_sz);
if (ret != mnt_dat_sz) if (ret != mnt_dat_sz)
{ {
fd->err = -1; state->err = -1;
fprintf(stderr, "Error: failed to write darshan log mount data.\n"); fprintf(stderr, "Error: failed to write darshan log mount data.\n");
return(-1); return(-1);
} }
...@@ -441,6 +511,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co ...@@ -441,6 +511,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co
*/ */
int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash) int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
{ {
struct darshan_fd_int_state *state = fd->state;
char *hash_buf; char *hash_buf;
int hash_buf_sz; int hash_buf_sz;
char *buf_ptr; char *buf_ptr;
...@@ -452,6 +523,8 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash) ...@@ -452,6 +523,8 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
int read_req_sz; int read_req_sz;
int buf_remaining = 0; int buf_remaining = 0;
assert(state);
/* just return if there is no record mapping data */ /* just return if there is no record mapping data */
if(fd->rec_map.len == 0) if(fd->rec_map.len == 0)
{ {
...@@ -572,6 +645,7 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash) ...@@ -572,6 +645,7 @@ int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash)
*/ */
int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash) int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
{ {
struct darshan_fd_int_state *state = fd->state;
char *hash_buf; char *hash_buf;
int hash_buf_sz; int hash_buf_sz;
struct darshan_record_ref *ref, *tmp; struct darshan_record_ref *ref, *tmp;
...@@ -579,6 +653,8 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash) ...@@ -579,6 +653,8 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
int path_len; int path_len;
int wrote; int wrote;
assert(state);
/* allocate memory for largest possible hash record */ /* allocate memory for largest possible hash record */
hash_buf_sz = sizeof(darshan_record_id) + sizeof(uint32_t) + PATH_MAX; hash_buf_sz = sizeof(darshan_record_id) + sizeof(uint32_t) + PATH_MAX;
hash_buf = malloc(hash_buf_sz); hash_buf = malloc(hash_buf_sz);
...@@ -608,7 +684,7 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash) ...@@ -608,7 +684,7 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
hash_buf, (buf_ptr - hash_buf)); hash_buf, (buf_ptr - hash_buf));
if(wrote != (buf_ptr - hash_buf)) if(wrote != (buf_ptr - hash_buf))
{ {
fd->err = -1; state->err = -1;
fprintf(stderr, "Error: failed to write record hash to darshan log file.\n"); fprintf(stderr, "Error: failed to write record hash to darshan log file.\n");
free(hash_buf); free(hash_buf);
return(-1); return(-1);
...@@ -628,8 +704,11 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash) ...@@ -628,8 +704,11 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id, int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
void *buf, int len) void *buf, int len)
{ {
struct darshan_fd_int_state *state = fd->state;
int ret; int ret;
assert(state);
if(mod_id < 0 || mod_id >= DARSHAN_MAX_MODS) if(mod_id < 0 || mod_id >= DARSHAN_MAX_MODS)
{ {
fprintf(stderr, "Error: invalid Darshan module id.\n"); fprintf(stderr, "Error: invalid Darshan module id.\n");
...@@ -667,11 +746,14 @@ int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id, ...@@ -667,11 +746,14 @@ int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id, int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
void *mod_buf, int mod_buf_sz) void *mod_buf, int mod_buf_sz)
{ {
struct darshan_fd_int_state *state = fd->state;
int ret; int ret;
assert(state);
if(mod_id < 0 || mod_id >= DARSHAN_MAX_MODS) if(mod_id < 0 || mod_id >= DARSHAN_MAX_MODS)
{ {
fd->err = -1; state->err = -1;
fprintf(stderr, "Error: invalid Darshan module id.\n"); fprintf(stderr, "Error: invalid Darshan module id.\n");
return(-1); return(-1);
} }
...@@ -680,7 +762,7 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id, ...@@ -680,7 +762,7 @@ int darshan_log_putmod(darshan_fd fd, darshan_module_id mod_id,
ret = darshan_log_dzwrite(fd, mod_id, mod_buf, mod_buf_sz); ret = darshan_log_dzwrite(fd, mod_id, mod_buf, mod_buf_sz);
if(ret != mod_buf_sz) if(ret != mod_buf_sz)
{ {
fd->err = -1; state->err = -1;
fprintf(stderr, fprintf(stderr,
"Error: failed to write module %s data to darshan log file.\n", "Error: failed to write module %s data to darshan log file.\n",
darshan_module_names[mod_id]);