diff --git a/src/aiori-POSIX.c b/src/aiori-POSIX.c index 3cd9e31..68bcd15 100644 --- a/src/aiori-POSIX.c +++ b/src/aiori-POSIX.c @@ -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); } /* diff --git a/src/ior.c b/src/ior.c index dd2c9b4..68f99ea 100644 --- a/src/ior.c +++ b/src/ior.c @@ -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, diff --git a/src/iordef.h b/src/iordef.h index 6203bf6..a7b307d 100644 --- a/src/iordef.h +++ b/src/iordef.h @@ -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__); \