summaryrefslogtreecommitdiffstats
path: root/perform
diff options
context:
space:
mode:
Diffstat (limited to 'perform')
-rw-r--r--perform/CMakeLists.txt14
-rw-r--r--perform/pio_engine.c98
-rw-r--r--perform/zip_perf.c2
3 files changed, 60 insertions, 54 deletions
diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt
index 66a0794..95ffd30 100644
--- a/perform/CMakeLists.txt
+++ b/perform/CMakeLists.txt
@@ -110,12 +110,14 @@ IF (H5_HAVE_PARALLEL)
TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
#-- Adding test for mpi-perf
- SET (mpi-perf_SRCS
- ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c
- )
- ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS})
- TARGET_NAMING (mpi-perf ${LIB_TYPE})
- TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ IF (NOT WIN32)
+ SET (mpi-perf_SRCS
+ ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c
+ )
+ ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS})
+ TARGET_NAMING (mpi-perf ${LIB_TYPE})
+ TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ ENDIF (NOT WIN32)
ENDIF (H5_HAVE_PARALLEL)
diff --git a/perform/pio_engine.c b/perform/pio_engine.c
index 129addf..abb72fa 100644
--- a/perform/pio_engine.c
+++ b/perform/pio_engine.c
@@ -418,9 +418,9 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
size_t i, j;
if (!base_name || !fullname || size < 1)
- return NULL;
+ return NULL;
- memset(fullname, 0, size);
+ HDmemset(fullname, 0, size);
switch (iot) {
case POSIXIO:
@@ -435,77 +435,81 @@ pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t si
}
/* First use the environment variable and then try the constant */
- prefix = getenv("HDF5_PARAPREFIX");
+ prefix = HDgetenv("HDF5_PARAPREFIX");
#ifdef HDF5_PARAPREFIX
if (!prefix)
- prefix = HDF5_PARAPREFIX;
+ prefix = HDF5_PARAPREFIX;
#endif /* HDF5_PARAPREFIX */
/* Prepend the prefix value to the base name */
if (prefix && *prefix) {
- /* If the prefix specifies the HDF5_PARAPREFIX directory, then
- * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
- * directory instead. */
- register char *user, *login, *subdir;
-
- user = getenv("USER");
- login = getenv("LOGIN");
- subdir = (user ? user : login);
+ /* If the prefix specifies the HDF5_PARAPREFIX directory, then
+ * default to using the "/tmp/$USER" or "/tmp/$LOGIN"
+ * directory instead. */
+ register char *user, *login, *subdir;
- if (subdir) {
- for (i = 0; i < size && prefix[i]; i++)
- fullname[i] = prefix[i];
+ user = HDgetenv("USER");
+ login = HDgetenv("LOGIN");
+ subdir = (user ? user : login);
- fullname[i++] = '/';
+ if (subdir) {
+ for (i = 0; i < size && prefix[i]; i++)
+ fullname[i] = prefix[i];
- for (j = 0; i < size && subdir[j]; i++, j++)
- fullname[i] = subdir[j];
- } else {
- /* We didn't append the prefix yet */
- strncpy(fullname, prefix, MIN(strlen(prefix), size));
- }
+ fullname[i++] = '/';
- if ((strlen(fullname) + strlen(base_name) + 1) < size) {
- /* Append the base_name with a slash first. Multiple slashes are
- * handled below. */
- h5_stat_t buf;
-
- if (HDstat(fullname, &buf) < 0)
- /* The directory doesn't exist just yet */
- if (mkdir(fullname, (mode_t)0755) < 0 && errno != EEXIST) {
- /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
- * Default to PREFIX's original prefix value. */
- strcpy(fullname, prefix);
+ for (j = 0; i < size && subdir[j]; i++, j++)
+ fullname[i] = subdir[j];
+ }
+ else {
+ /* We didn't append the prefix yet */
+ HDstrncpy(fullname, prefix, MIN(HDstrlen(prefix), size));
}
- strcat(fullname, "/");
- strcat(fullname, base_name);
- } else {
+ if ((HDstrlen(fullname) + HDstrlen(base_name) + 1) < size) {
+ /* Append the base_name with a slash first. Multiple slashes are
+ * handled below. */
+ h5_stat_t buf;
+
+ if (HDstat(fullname, &buf) < 0)
+ /* The directory doesn't exist just yet */
+ if (HDmkdir(fullname, (mode_t) 0755) < 0 && errno != EEXIST) {
+ /* We couldn't make the "/tmp/${USER,LOGIN}" subdirectory.
+ * Default to PREFIX's original prefix value. */
+ HDstrcpy(fullname, prefix);
+ }
+
+ HDstrcat(fullname, "/");
+ HDstrcat(fullname, base_name);
+ }
+ else {
+ /* Buffer is too small */
+ return NULL;
+ }
+ }
+ else if (HDstrlen(base_name) >= size) {
/* Buffer is too small */
return NULL;
}
- } else if (strlen(base_name) >= size) {
- /* Buffer is too small */
- return NULL;
- } else {
- strcpy(fullname, base_name);
+ else {
+ HDstrcpy(fullname, base_name);
}
/* Append a suffix */
if (suffix) {
- if (strlen(fullname) + strlen(suffix) >= size)
- return NULL;
+ if (HDstrlen(fullname) + HDstrlen(suffix) >= size)
+ return NULL;
- strcat(fullname, suffix);
+ HDstrcat(fullname, suffix);
}
/* Remove any double slashes in the filename */
for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
- if (*ptr != '/' || last != '/')
- fullname[j++] = *ptr;
+ if (*ptr != '/' || last != '/')
+ fullname[j++] = *ptr;
- last = *ptr;
+ last = *ptr;
}
return fullname;
diff --git a/perform/zip_perf.c b/perform/zip_perf.c
index fdd824b..897fc7e 100644
--- a/perform/zip_perf.c
+++ b/perform/zip_perf.c
@@ -413,7 +413,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
register unsigned u;
h5_stat_t stat_buf;
- if (stat("/dev/urandom", &stat_buf) == 0) {
+ if (HDstat("/dev/urandom", &stat_buf) == 0) {
uLongf len = src_len;
Bytef *buf = src;
int fd = HDopen("/dev/urandom", O_RDONLY, 0);