Add EWARN macro

master
Christopher J. Morrone 2011-12-14 13:40:25 -08:00
parent 1b63aee6c8
commit 51348f34ca
3 changed files with 16 additions and 15 deletions

View File

@ -274,7 +274,7 @@ static IOR_offset_t POSIX_Xfer(int access, void *file, IOR_size_t * buffer,
static void POSIX_Fsync(void *fd, IOR_param_t * param)
{
if (fsync(*(int *)fd) != 0)
WARN("fsync() failed");
EWARN("fsync() failed");
}
/*
@ -296,7 +296,7 @@ static void POSIX_Delete(char *testFileName, IOR_param_t * param)
sprintf(errmsg, "[RANK %03d]: unlink() of file \"%s\" failed\n",
rank, testFileName);
if (unlink(testFileName) != 0)
WARN(errmsg);
EWARN(errmsg);
}
/*

View File

@ -872,7 +872,7 @@ void GetPlatformName(char *platformName)
struct utsname name;
if (uname(&name) != 0) {
WARN("cannot get platform name");
EWARN("cannot get platform name");
sprintf(sysName, "%s", "Unknown");
sprintf(nodeName, "%s", "Unknown");
} else {
@ -1423,7 +1423,7 @@ static void PrintHeader(int argc, char **argv)
}
fprintf(stdout, "\n");
if (uname(&unamebuf) != 0) {
WARN("uname failed");
EWARN("uname failed");
fprintf(stdout, "Machine: Unknown");
} else {
fprintf(stdout, "Machine: %s %s", unamebuf.sysname,

View File

@ -136,12 +136,6 @@ typedef long long int IOR_size_t;
} while (0)
/******************************************************************************/
/*
* WARN will display a custom error message as well as an error string from
* sys_errlist, but will not exit the program
*/
#define WARN(MSG) do { \
if (verbose > VERBOSE_2) { \
fprintf(stdout, "ior WARNING: %s, (%s:%d).\n", \
@ -152,13 +146,20 @@ typedef long long int IOR_size_t;
fflush(stdout); \
} while (0)
/* warning with errno printed */
#define EWARN(MSG) do { \
if (verbose > VERBOSE_2) { \
fprintf(stdout, "ior WARNING: %s, errno %d, %s (%s:%d).\n", \
MSG, errno, strerror(errno), __FILE__, __LINE__); \
} else { \
fprintf(stdout, "ior WARNING: %s, errno %d, %s \n", \
MSG, errno, strerror(errno)); \
} \
fflush(stdout); \
} while (0)
/******************************************************************************/
/*
* ERR will display a custom error message as well as an error string from
* sys_errlist and then exit the program
*/
/* display error message and terminate execution */
#define ERR(MSG) do { \
fprintf(stdout, "ior ERROR: %s, errno %d, %s (%s:%d)\n", \
MSG, errno, strerror(errno), __FILE__, __LINE__); \