diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-08-17 19:55:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 19:55:18 (GMT) |
commit | c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6 (patch) | |
tree | fb2bdf05e276e3614b3b5c343447cd82f4e6718b /src | |
parent | 2bca2ca6f1ef1b60bb8541413c5f2e68ff5549d3 (diff) | |
download | hdf5-c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6.zip hdf5-c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6.tar.gz hdf5-c0ef1fd6de3ff20cc8fc49c05ca71254c784bea6.tar.bz2 |
Reverts PR 906 and 907 due to binary compatibility issues (#918)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 220 | ||||
-rw-r--r-- | src/H5Dpublic.h | 12 | ||||
-rw-r--r-- | src/H5E.c | 36 | ||||
-rw-r--r-- | src/H5ESpublic.h | 12 | ||||
-rw-r--r-- | src/H5Epublic.h | 2 | ||||
-rw-r--r-- | src/H5FDmpio.c | 24 | ||||
-rw-r--r-- | src/H5Fpublic.h | 4 | ||||
-rw-r--r-- | src/H5Gint.c | 1 | ||||
-rw-r--r-- | src/H5Gpkg.h | 1 | ||||
-rw-r--r-- | src/H5HFpkg.h | 1 | ||||
-rw-r--r-- | src/H5Lpublic.h | 4 | ||||
-rw-r--r-- | src/H5Ppublic.h | 2 | ||||
-rw-r--r-- | src/H5Spublic.h | 2 | ||||
-rw-r--r-- | src/H5Tpublic.h | 4 | ||||
-rw-r--r-- | src/H5detect.c | 15 | ||||
-rw-r--r-- | src/H5mpi.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 128 | ||||
-rw-r--r-- | src/H5public.h | 49 | ||||
-rw-r--r-- | src/H5system.c | 212 | ||||
-rw-r--r-- | src/H5win32defs.h | 1 |
20 files changed, 237 insertions, 495 deletions
@@ -63,10 +63,6 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Library Private Variables */ /*****************************/ -/* Library incompatible release versions */ -const unsigned VERS_RELEASE_EXCEPTIONS[] = {0}; -const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 0; - /* statically initialize block for pthread_once call used in initializing */ /* the first global mutex */ #ifdef H5_HAVE_THREADSAFE @@ -268,13 +264,13 @@ done: } /* end H5_init_library() */ /*------------------------------------------------------------------------- - * Function: H5_term_library + * Function: H5_term_library * - * Purpose: Terminate interfaces in a well-defined order due to - * dependencies among the interfaces, then terminate - * library-specific data. + * Purpose: Terminate interfaces in a well-defined order due to + * dependencies among the interfaces, then terminate + * library-specific data. * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -460,22 +456,22 @@ done: } /* end H5_term_library() */ /*------------------------------------------------------------------------- - * Function: H5dont_atexit + * Function: H5dont_atexit * - * Purpose: Indicates that the library is not to clean up after itself - * when the application exits by calling exit() or returning - * from main(). This function must be called before any other - * HDF5 function or constant is used or it will have no effect. + * Purpose: Indicates that the library is not to clean up after itself + * when the application exits by calling exit() or returning + * from main(). This function must be called before any other + * HDF5 function or constant is used or it will have no effect. * - * If this function is used then certain memory buffers will not - * be de-allocated nor will open files be flushed automatically. - * The application may still call H5close() explicitly to - * accomplish these things. + * If this function is used then certain memory buffers will not + * be de-allocated nor will open files be flushed automatically. + * The application may still call H5close() explicitly to + * accomplish these things. * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative if this function is called more than - * once or if it is called too late. + * Failure: negative if this function is called more than + * once or if it is called too late. * *------------------------------------------------------------------------- */ @@ -496,19 +492,19 @@ H5dont_atexit(void) } /* end H5dont_atexit() */ /*------------------------------------------------------------------------- - * Function: H5garbage_collect + * Function: H5garbage_collect * - * Purpose: Walks through all the garbage collection routines for the - * library, which are supposed to free any unused memory they have - * allocated. + * Purpose: Walks through all the garbage collection routines for the + * library, which are supposed to free any unused memory they have + * allocated. * * These should probably be registered dynamically in a linked list of * functions to call, but there aren't that many right now, so we * hard-wire them... * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * *------------------------------------------------------------------------- */ @@ -529,9 +525,9 @@ done: } /* end H5garbage_collect() */ /*------------------------------------------------------------------------- - * Function: H5set_free_list_limits + * Function: H5set_free_list_limits * - * Purpose: Sets limits on the different kinds of free lists. Setting a value + * Purpose: Sets limits on the different kinds of free lists. Setting a value * of -1 for a limit means no limit of that type. These limits are global * for the entire library. Each "global" limit only applies to free lists * of that type, so if an application sets a limit of 1 MB on each of the @@ -549,9 +545,9 @@ done: * int blk_global_lim; IN: The limit on all "block" free list memory used * int blk_list_lim; IN: The limit on memory used in each "block" free list * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * *------------------------------------------------------------------------- */ @@ -575,11 +571,11 @@ done: } /* end H5set_free_list_limits() */ /*------------------------------------------------------------------------- - * Function: H5get_free_list_sizes + * Function: H5get_free_list_sizes * - * Purpose: Gets the current size of the different kinds of free lists that - * the library uses to manage memory. The free list sizes can be set with - * H5set_free_list_limits and garbage collected with H5garbage_collect. + * Purpose: Gets the current size of the different kinds of free lists that + * the library uses to manage memory. The free list sizes can be set with + * H5set_free_list_limits and garbage collected with H5garbage_collect. * These lists are global for the entire library. * * Parameters: @@ -588,8 +584,8 @@ done: * size_t *blk_size; OUT: The current size of all "block" free list memory used * size_t *fac_size; OUT: The current size of all "factory" free list memory used * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol * Friday, March 6, 2020 @@ -613,23 +609,23 @@ done: } /* end H5get_free_list_sizes() */ /*------------------------------------------------------------------------- - * Function: H5get_alloc_stats + * Function: H5get_alloc_stats * - * Purpose: Gets the memory allocation statistics for the library, if the - * --enable-memory-alloc-sanity-check option was given when building the + * Purpose: Gets the memory allocation statistics for the library, if the + * --enable-memory-alloc-sanity-check option was given when building the * library. Applications can check whether this option was enabled by - * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This - * option is enabled by default for debug builds of the library and - * disabled by default for non-debug builds. If the option is not enabled, - * all the values returned with be 0. These statistics are global for the - * entire library, but don't include allocations from chunked dataset I/O - * filters or non-native VOL connectors. + * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This + * option is enabled by default for debug builds of the library and + * disabled by default for non-debug builds. If the option is not enabled, + * all the values returned with be 0. These statistics are global for the + * entire library, but don't include allocations from chunked dataset I/O + * filters or non-native VOL connectors. * * Parameters: * H5_alloc_stats_t *stats; OUT: Memory allocation statistics * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol * Saturday, March 7, 2020 @@ -762,12 +758,12 @@ H5__debug_mask(const char *s) #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- - * Function: H5__mpi_delete_cb + * Function: H5__mpi_delete_cb * - * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5 + * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5 * library when the communicator is destroyed, i.e. on MPI_Finalize. * - * Return: MPI_SUCCESS + * Return: MPI_SUCCESS * *------------------------------------------------------------------------- */ @@ -781,18 +777,18 @@ H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void #endif /*H5_HAVE_PARALLEL*/ /*------------------------------------------------------------------------- - * Function: H5get_libversion + * Function: H5get_libversion * - * Purpose: Returns the library version numbers through arguments. MAJNUM - * will be the major revision number of the library, MINNUM the - * minor revision number, and RELNUM the release revision number. + * Purpose: Returns the library version numbers through arguments. MAJNUM + * will be the major revision number of the library, MINNUM the + * minor revision number, and RELNUM the release revision number. * - * Note: When printing an HDF5 version number it should be printed as + * Note: When printing an HDF5 version number it should be printed as * - * printf("%u.%u.%u", maj, min, rel) or - * printf("version %u.%u release %u", maj, min, rel) + * printf("%u.%u.%u", maj, min, rel) or + * printf("version %u.%u release %u", maj, min, rel) * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -817,20 +813,17 @@ done: } /* end H5get_libversion() */ /*------------------------------------------------------------------------- - * Function: H5check_version + * Function: H5check_version * - * Purpose: Verifies that the arguments match the version numbers - * compiled into the library. This function is intended to be - * called from user to verify that the versions of header files - * compiled into the application match the version of the hdf5 - * library. - * Within major.minor.release version, the expectation - * is that all release versions are compatible, exceptions to - * this rule must be added to the VERS_RELEASE_EXCEPTIONS list. + * Purpose: Verifies that the arguments match the version numbers + * compiled into the library. This function is intended to be + * called from user to verify that the versions of header files + * compiled into the application match the version of the hdf5 + * library. * - * Return: Success: SUCCEED + * Return: Success: SUCCEED * - * Failure: abort() + * Failure: abort() * *------------------------------------------------------------------------- */ @@ -843,15 +836,6 @@ done: "linked with a different version of static or shared HDF5 library.\n" \ "You should recompile the application or check your shared library related\n" \ "settings such as 'LD_LIBRARY_PATH'.\n" -#define RELEASE_MISMATCH_WARNING \ - "Warning! ***HDF5 library release mismatched error***\n" \ - "The HDF5 header files used to compile this application are not compatible with\n" \ - "the version used by the HDF5 library to which this application is linked.\n" \ - "Data corruption or segmentation faults may occur if the application continues.\n" \ - "This can happen when an application was compiled by one version of HDF5 but\n" \ - "linked with an incompatible version of static or shared HDF5 library.\n" \ - "You should recompile the application or check your shared library related\n" \ - "settings such as 'LD_LIBRARY_PATH'.\n" herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) @@ -880,11 +864,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) disable_version_check = (unsigned int)HDstrtol(s, NULL, 0); } - /* H5_VERS_MAJOR and H5_VERS_MINOR must match */ - /* Cast relnum to int to avoid warning for unsigned < 0 comparison - * in first release versions */ - if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > (int)relnum) { - + if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE != relnum) { switch (disable_version_check) { case 0: HDfprintf(stderr, "%s%s", version_mismatch_warning, @@ -919,51 +899,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) break; } /* end switch */ - } /* end if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > relnum) */ - - /* H5_VERS_RELEASE should be compatible, we will only add checks for exceptions */ - if (H5_VERS_RELEASE != relnum) { - for (unsigned i = 0; i < VERS_RELEASE_EXCEPTIONS_SIZE; i++) { - /* Check for incompatible headers or incompatible library */ - if (VERS_RELEASE_EXCEPTIONS[i] == relnum || VERS_RELEASE_EXCEPTIONS[i] == H5_VERS_RELEASE) { - switch (disable_version_check) { - case 0: - HDfprintf( - stderr, "%s%s", version_mismatch_warning, - "You can, at your own risk, disable this warning by setting the environment\n" - "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" - "Setting it to 2 or higher will suppress the warning messages totally.\n"); - /* Mention the versions we are referring to */ - HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, - relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, - (unsigned)H5_VERS_RELEASE); - - /* Bail out now. */ - HDfputs("Bye...\n", stderr); - HDabort(); - case 1: - /* continue with a warning */ - /* Note that the warning message is embedded in the format string.*/ - HDfprintf(stderr, - "%s'HDF5_DISABLE_VERSION_CHECK' " - "environment variable is set to %d, application will\n" - "continue at your own risk.\n", - version_mismatch_warning, disable_version_check); - /* Mention the versions we are referring to */ - HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, - relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, - (unsigned)H5_VERS_RELEASE); - break; - default: - /* 2 or higher: continue silently */ - break; - } /* end switch */ - - } /* end if */ - - } /* end for */ - - } /* end if (H5_VERS_RELEASE != relnum) */ + } /* end if */ /* Indicate that the version check has been performed */ checked = 1; @@ -1008,7 +944,7 @@ done: * is failing inexplicably, then try calling this function * first. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1029,9 +965,9 @@ done: /*------------------------------------------------------------------------- * Function: H5close * - * Purpose: Terminate the library and release all resources. + * Purpose: Terminate the library and release all resources. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ @@ -1052,9 +988,9 @@ H5close(void) } /* end H5close() */ /*------------------------------------------------------------------------- - * Function: H5allocate_memory + * Function: H5allocate_memory * - * Purpose: Allocate a memory buffer with the semantics of malloc(). + * Purpose: Allocate a memory buffer with the semantics of malloc(). * * NOTE: This function is intended for use with filter * plugins so that all allocation and free operations @@ -1092,9 +1028,9 @@ H5allocate_memory(size_t size, hbool_t clear) } /* end H5allocate_memory() */ /*------------------------------------------------------------------------- - * Function: H5resize_memory + * Function: H5resize_memory * - * Purpose: Resize a memory buffer with the semantics of realloc(). + * Purpose: Resize a memory buffer with the semantics of realloc(). * * NOTE: This function is intended for use with filter * plugins so that all allocation and free operations @@ -1129,14 +1065,14 @@ H5resize_memory(void *mem, size_t size) } /* end H5resize_memory() */ /*------------------------------------------------------------------------- - * Function: H5free_memory + * Function: H5free_memory * - * Purpose: Frees memory allocated by the library that it is the user's + * Purpose: Frees memory allocated by the library that it is the user's * responsibility to free. Ensures that the same library * that was used to allocate the memory frees it. Passing * NULL pointers is allowed. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ @@ -1153,12 +1089,12 @@ H5free_memory(void *mem) } /* end H5free_memory() */ /*------------------------------------------------------------------------- - * Function: H5is_library_threadsafe + * Function: H5is_library_threadsafe * - * Purpose: Checks to see if the library was built with thread-safety + * Purpose: Checks to see if the library was built with thread-safety * enabled. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index f2044d6..b73e62d 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -30,7 +30,7 @@ /* Macros used to "unset" chunk cache configuration parameters */ #define H5D_CHUNK_CACHE_NSLOTS_DEFAULT ((size_t)-1) #define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t)-1) -#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0) +#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f) /* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */ #define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u) @@ -46,11 +46,11 @@ typedef enum H5D_layout_t { H5D_LAYOUT_ERROR = -1, - H5D_COMPACT = 0, /**< raw data is very small */ - H5D_CONTIGUOUS = 1, /**< the default */ - H5D_CHUNKED = 2, /**< slow and fancy */ - H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */ - H5D_NLAYOUTS = 4 /**< this one must be last! */ + H5D_COMPACT = 0, /**< raw data is very small */ + H5D_CONTIGUOUS = 1, /**< the default */ + H5D_CHUNKED = 2, /**< slow and fancy */ + H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */ + H5D_NLAYOUTS = 4 /**< this one must be last! */ } H5D_layout_t; //! <!-- [H5D_layout_t_snip] --> @@ -85,8 +85,6 @@ static H5E_t * H5E__get_current_stack(void); static herr_t H5E__set_current_stack(H5E_t *estack); static herr_t H5E__close_stack(H5E_t *err_stack); static ssize_t H5E__get_num(const H5E_t *err_stack); -static herr_t H5E__print2(hid_t err_stack, FILE *stream); -static herr_t H5E__append_stack(H5E_t *dst_estack, const H5E_t *src_stack); /*********************/ /* Package Variables */ @@ -327,10 +325,10 @@ H5E__set_default_auto(H5E_t *stk) #endif /* H5_USE_16_API_DEFAULT */ stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; - stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5E__print2; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; stk->auto_op.is_default = TRUE; #else /* H5_NO_DEPRECATED_SYMBOLS */ - stk->auto_op.func2 = (H5E_auto2_t)H5E__print2; + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; #endif /* H5_NO_DEPRECATED_SYMBOLS */ stk->auto_data = NULL; @@ -1448,37 +1446,13 @@ done: herr_t H5Eprint2(hid_t err_stack, FILE *stream) { + H5E_t *estack; /* Error stack to operate on */ herr_t ret_value = SUCCEED; /* Return value */ /* Don't clear the error stack! :-) */ FUNC_ENTER_API_NOCLEAR(FAIL) /*NO TRACE*/ - /* Print error stack */ - if ((ret_value = H5E__print2(err_stack, stream)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Eprint2() */ - -/*------------------------------------------------------------------------- - * Function: H5E__print2 - * - * Purpose: Internal helper routine for H5Eprint2. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5E__print2(hid_t err_stack, FILE *stream) -{ - H5E_t *estack; /* Error stack to operate on */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - /* Need to check for errors */ if (err_stack == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in @@ -1498,8 +1472,8 @@ H5E__print2(hid_t err_stack, FILE *stream) HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E__print2() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Eprint2() */ /*------------------------------------------------------------------------- * Function: H5Ewalk2 diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index fb156ac..28b41fa 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -24,18 +24,6 @@ /* Public Macros */ /*****************/ -/* Default value for "no event set" / synchronous execution */ -#define H5ES_NONE 0 /* (hid_t) */ - -/* Special "wait" timeout values */ -#define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */ -#define H5ES_WAIT_NONE \ - (0) /* Don't wait for operations to complete, \ - * just check their status. \ - * (this allows H5ESwait to behave \ - * like a 'test' operation) \ - */ - /*******************/ /* Public Typedefs */ /*******************/ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 1c7055a..2f529b3 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -24,7 +24,7 @@ #include "H5Ipublic.h" /* Value for the default error stack */ -#define H5E_DEFAULT 0 /* (hid_t) */ +#define H5E_DEFAULT (hid_t)0 /** * Different kinds of error information diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 16912cf..c0b14ce 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1193,6 +1193,12 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if ((hsize_t)size_i != size) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, + size_i); +#endif + /* Only look for MPI views for raw data transfers */ if (type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ @@ -1337,12 +1343,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (bytes_read < 0 || bytes_read > io_size) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") -#ifdef H5FDmpio_DEBUG - if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", FUNC, file->mpi_rank, (long)mpi_off, - bytes_read); -#endif - /* * This gives us zeroes beyond end of physical MPI file. */ @@ -1430,6 +1430,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") size_i = (int)size; +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off, + size_i); +#endif + /* Get the transfer mode from the API context */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") @@ -1554,12 +1560,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (bytes_written != io_size || bytes_written < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") -#ifdef H5FDmpio_DEBUG - if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", FUNC, file->mpi_rank, - (long)mpi_off, bytes_written); -#endif - /* Each process will keep track of its perceived EOF value locally, and * ultimately we will reduce this value to the maximum amongst all * processes, but until then keep the actual eof at HADDR_UNDEF just in diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index f25f8f9..89238b6 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -84,7 +84,7 @@ (0x0020u) /**< Restrict search to objects opened through current file ID \ (as opposed to objects opened through any file ID accessing this file) */ -#define H5F_FAMILY_DEFAULT 0 /* (hsize_t) */ +#define H5F_FAMILY_DEFAULT (hsize_t)0 #ifdef H5_HAVE_PARALLEL /** @@ -108,7 +108,7 @@ typedef enum H5F_scope_t { /** * Unlimited file size for H5Pset_external() */ -#define H5F_UNLIMITED HSIZE_UNDEF +#define H5F_UNLIMITED ((hsize_t)(-1L)) /** * How does file close behave? diff --git a/src/H5Gint.c b/src/H5Gint.c index 75b206e..7488357 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -38,7 +38,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ -#include "H5SLprivate.h" /* Skip lists */ /****************/ /* Local Macros */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 521f94f..b0adf30 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -35,6 +35,7 @@ #include "H5HFprivate.h" /* Fractal heaps */ #include "H5HLprivate.h" /* Local Heaps */ #include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 8d189e8..893a65d 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -34,6 +34,7 @@ #include "H5B2private.h" /* v2 B-trees */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FSprivate.h" /* Free space manager */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index a4f1102..bf1de86 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -39,12 +39,12 @@ * * The maximum length of a link's name is encoded in a 32-bit unsigned integer. */ -#define H5L_MAX_LINK_NAME_LEN UINT32_MAX +#define H5L_MAX_LINK_NAME_LEN ((uint32_t)(-1)) /* (4GB - 1) */ /** * \brief Macro to indicate operation occurs on same location */ -#define H5L_SAME_LOC 0 /* (hid_t) */ +#define H5L_SAME_LOC (hid_t)0 /** * \brief Current version of the H5L_class_t struct diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 3d6968e..5adb05e 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -100,7 +100,7 @@ #define H5P_CRT_ORDER_INDEXED 0x0002 /* Default value for all property list classes */ -#define H5P_DEFAULT 0 /* (hid_t) */ +#define H5P_DEFAULT (hid_t)0 #ifdef __cplusplus extern "C" { diff --git a/src/H5Spublic.h b/src/H5Spublic.h index cf5abe8..331e5ee 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -22,7 +22,7 @@ #include "H5Ipublic.h" /* Define atomic datatypes */ -#define H5S_ALL 0 /* (hid_t) */ +#define H5S_ALL (hid_t)0 #define H5S_UNLIMITED HSIZE_UNDEF /* Define user-level maximum number of dimensions */ diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 0791345..b708506 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -245,7 +245,7 @@ typedef struct { * Indicate that a string is variable length (null-terminated in C, instead of * fixed length) */ -#define H5T_VARIABLE ((size_t)-1) +#define H5T_VARIABLE ((size_t)(-1)) /* Opaque information */ /** @@ -3027,4 +3027,4 @@ H5_DLL int H5Tget_array_dims1(hid_t type_id, hsize_t dims[], int perm[]); #ifdef __cplusplus } #endif -#endif /* H5Tpublic_H */
\ No newline at end of file +#endif /* H5Tpublic_H */ diff --git a/src/H5detect.c b/src/H5detect.c index fd5e980..e4fe453 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1655,6 +1655,21 @@ main(int argc, char *argv[]) if (!rawoutstream) rawoutstream = stdout; +#if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) +#if defined(UAC_NOPRINT) && defined(UAC_SIGBUS) + /* + * Make sure unaligned access generates SIGBUS and doesn't print warning + * messages so that we can detect alignment constraints on the DEC Alpha. + */ + int nvpairs[2]; + nvpairs[0] = SSIN_UACPROC; + nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; + if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0) < 0) { + fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); + } +#endif +#endif + #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { diff --git a/src/H5mpi.c b/src/H5mpi.c index 4a8aa44..9749721 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -523,7 +523,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent); } - /* Set up the arguments for MPI_Type_create_struct() */ + /* Set up the arguments for MPI_Type_struct constructor */ type[0] = outer_type; type[1] = leftover_type; block_len[0] = 1; diff --git a/src/H5private.h b/src/H5private.h index 1fd95dc..07705e4 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -26,36 +26,64 @@ #include "H5public.h" /* Include Public Definitions */ +/* include the pthread header */ +#ifdef H5_HAVE_THREADSAFE +#ifdef H5_HAVE_WIN32_API +#ifndef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_PTHREAD_H +#include <pthread.h> +#endif /* H5_HAVE_PTHREAD_H */ +#endif /* H5_HAVE_WIN_THREADS */ +#else /* H5_HAVE_WIN32_API */ +#ifdef H5_HAVE_PTHREAD_H +#include <pthread.h> +#endif /* H5_HAVE_PTHREAD_H */ +#endif /* H5_HAVE_WIN32_API */ +#endif /* H5_HAVE_THREADSAFE */ + +/* + * Include ANSI-C header files. + */ +#ifdef H5_STDC_HEADERS #include <assert.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <float.h> +#include <limits.h> #include <math.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> - -/* POSIX headers */ -#ifdef H5_HAVE_SYS_TIME_H -#include <sys/time.h> #endif + +/* + * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1 + * compliant. Otherwise all bets are off. + */ #ifdef H5_HAVE_UNISTD_H -#include <pwd.h> +#include <sys/types.h> #include <unistd.h> +#endif +#ifdef _POSIX_VERSION #include <sys/wait.h> +#include <pwd.h> #endif -/* Include the Pthreads header, if necessary */ -#if defined(H5_HAVE_THREADSAFE) && defined(H5_HAVE_PTHREAD_H) -#include <pthread.h> +/* + * C9x integer types + */ +#ifndef __cplusplus +#ifdef H5_HAVE_STDINT_H +#include <stdint.h> +#endif #endif /* - * The `struct stat' data type for stat() and fstat(). This is a POSIX file - * but often apears on non-POSIX systems also. The `struct stat' is required - * for HDF5 to compile, although only a few fields are actually used. + * The `struct stat' data type for stat() and fstat(). This is a Posix file + * but often apears on non-Posix systems also. The `struct stat' is required + * for hdf5 to compile, although only a few fields are actually used. */ #ifdef H5_HAVE_SYS_STAT_H #include <sys/stat.h> @@ -111,6 +139,21 @@ #endif /* + * System information. These are needed on the DEC Alpha to turn off fixing + * of unaligned accesses by the operating system during detection of + * alignment constraints in H5detect.c:main(). + */ +#ifdef H5_HAVE_SYS_SYSINFO_H +#include <sys/sysinfo.h> +#endif +#ifdef H5_HAVE_SYS_PROC_H +#include <sys/proc.h> +#endif +#ifdef H5_HAVE_IO_H +#include <io.h> +#endif + +/* * Dynamic library handling. These are needed for dynamically loading I/O * filters and VFDs. */ @@ -130,21 +173,21 @@ #define H5_DEFAULT_VOL H5VL_NATIVE #ifdef H5_HAVE_WIN32_API - /* The following two defines must be before any windows headers are included */ #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ #define NOGDI /* Exclude Graphic Display Interface macros */ -#include <windows.h> - -#include <direct.h> /* For _getcwd() */ -#include <io.h> /* POSIX I/O */ -#include <winsock2.h> /* For GetUserName() */ +#ifdef H5_HAVE_WINSOCK2_H +#include <winsock2.h> +#endif #ifdef H5_HAVE_THREADSAFE #include <process.h> /* For _beginthread() */ #endif +#include <windows.h> +#include <direct.h> /* For _getcwd() */ + #endif /*H5_HAVE_WIN32_API*/ #ifndef F_OK @@ -2523,57 +2566,6 @@ H5_DLL double H5_get_time(void); H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/); H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/); -/* getopt(3) equivalent that papers over the lack of long options on BSD - * and lack of Windows support. - */ -H5_DLLVAR int H5_opterr; /* get_option prints errors if this is on */ -H5_DLLVAR int H5_optind; /* token pointer */ -H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ - -enum h5_arg_level { - no_arg = 0, /* doesn't take an argument */ - require_arg, /* requires an argument */ - optional_arg /* argument is optional */ -}; - -/* - * get_option determines which options are specified on the command line and - * returns a pointer to any arguments possibly associated with the option in - * the ``H5_optarg'' variable. get_option returns the shortname equivalent of - * the option. The long options are specified in the following way: - * - * struct h5_long_options foo[] = { - * { "filename", require_arg, 'f' }, - * { "append", no_arg, 'a' }, - * { "width", require_arg, 'w' }, - * { NULL, 0, 0 } - * }; - * - * Long named options can have arguments specified as either: - * - * ``--param=arg'' or ``--param arg'' - * - * Short named options can have arguments specified as either: - * - * ``-w80'' or ``-w 80'' - * - * and can have more than one short named option specified at one time: - * - * -aw80 - * - * in which case those options which expect an argument need to come at the - * end. - */ -struct h5_long_options { - const char * name; /* Name of the long option */ - enum h5_arg_level has_arg; /* Whether we should look for an arg */ - char shortval; /* The shortname equivalent of long arg - * this gets returned from get_option - */ -}; - -H5_DLL int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); - #ifdef H5_HAVE_PARALLEL /* Generic MPI functions */ H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count); diff --git a/src/H5public.h b/src/H5public.h index 495af6f..09a2278 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -34,26 +34,28 @@ #ifdef H5_HAVE_FEATURES_H #include <features.h> /* For setting POSIX, BSD, etc. compatibility */ #endif - -/* C library header files for things that appear in HDF5 public headers */ -#ifdef __cplusplus -#define __STDC_FORMAT_MACROS -#endif -#include <inttypes.h> -#include <limits.h> -#include <stdarg.h> -#include <stdbool.h> -#include <stddef.h> -#include <stdint.h> - -/* Unlike most sys/ headers, which are POSIX-only, sys/types.h is avaible - * on Windows, though it doesn't necessarily contain all the POSIX types - * we need for HDF5 (e.g. ssize_t). - */ #ifdef H5_HAVE_SYS_TYPES_H #include <sys/types.h> #endif - +#ifdef H5_STDC_HEADERS +#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ +#include <stdarg.h> /* For variadic functions in H5VLpublic.h */ +#endif +#ifndef __cplusplus +#ifdef H5_HAVE_STDINT_H +#include <stdint.h> /* For C9x types */ +#endif +#else +#ifdef H5_HAVE_STDINT_H_CXX +#include <stdint.h> /* For C9x types (when included from C++) */ +#endif +#endif +#ifdef H5_HAVE_INTTYPES_H +#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */ +#endif +#ifdef H5_HAVE_STDDEF_H +#include <stddef.h> +#endif #ifdef H5_HAVE_PARALLEL /* Don't link against MPI C++ bindings */ #define MPICH_SKIP_MPICXX 1 @@ -215,6 +217,19 @@ typedef int herr_t; * } * \endcode */ +#ifdef H5_HAVE_STDBOOL_H +#include <stdbool.h> +#else /* H5_HAVE_STDBOOL_H */ +#ifndef __cplusplus +#if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0) +#define bool _Bool +#else +#define bool unsigned int +#endif +#define true 1 +#define false 0 +#endif /* __cplusplus */ +#endif /* H5_HAVE_STDBOOL_H */ typedef bool hbool_t; typedef int htri_t; diff --git a/src/H5system.c b/src/H5system.c index 56110ea..144e0bc 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -487,7 +487,7 @@ Wsetenv(const char *name, const char *value, int overwrite) return (int)_putenv_s(name, value); } /* end Wsetenv() */ -#ifdef H5_HAVE_WIN32_API +#ifdef H5_HAVE_WINSOCK2_H #pragma comment(lib, "advapi32.lib") #endif @@ -572,12 +572,12 @@ char * Wgetlogin(void) { -#ifdef H5_HAVE_WIN32_API +#ifdef H5_HAVE_WINSOCK2_H DWORD bufferCount = WloginBuffer_count; if (GetUserName(Wlogin_buffer, &bufferCount) != 0) return (Wlogin_buffer); else -#endif +#endif /* H5_HAVE_WINSOCK2_H */ return NULL; } @@ -964,7 +964,10 @@ done: * Note that commodity hardware is probably going to have a * resolution of milliseconds, not nanoseconds. * - * Return: void + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * October 01, 2016 *-------------------------------------------------------------------------- */ void @@ -973,40 +976,21 @@ H5_nanosleep(uint64_t nanosec) FUNC_ENTER_NOAPI_NOINIT_NOERR #ifdef H5_HAVE_WIN32_API - DWORD dwMilliseconds = (DWORD)HDceil(nanosec / 1.0e6); - DWORD ignore; - /* Windows can't sleep at a ns resolution. Best we can do is ~1 ms. We - * don't care about the return value since the second parameter - * (bAlertable) is FALSE, so it will always be zero. + /* On Windows, Sleep() is in milliseconds. Passing 0 to Sleep() + * causes the thread to relinquish the rest of its time slice. */ - ignore = SleepEx(dwMilliseconds, FALSE); + Sleep(nanosec / (1000 * 1000)); #else + { + struct timespec sleeptime; /* Struct to hold time to sleep */ - const uint64_t nanosec_per_sec = 1000 * 1000 * 1000; - struct timespec sleeptime; /* Struct to hold time to sleep */ - - /* Set up time to sleep - * - * Assuming ILP32 or LP64 or wider architecture, (long)operand - * satisfies 0 <= operand < nanosec_per_sec < LONG_MAX. - * - * It's harder to be sure that we don't overflow time_t. - */ - sleeptime.tv_sec = (time_t)(nanosec / nanosec_per_sec); - sleeptime.tv_nsec = (long)(nanosec % nanosec_per_sec); + /* Set up time to sleep */ + sleeptime.tv_sec = 0; + sleeptime.tv_nsec = (long)nanosec; - /* Sleep for up to `sleeptime` and, in the event of an interruption, - * save the unslept time back to `sleeptime`. - */ - while (HDnanosleep(&sleeptime, &sleeptime) == -1) { - /* If we were just interrupted, sleep for the remaining time. - * Otherwise, the error was essentially impossible, so just stop - * sleeping. - */ - if (errno != EINTR) - break; + HDnanosleep(&sleeptime, NULL); } #endif @@ -1058,167 +1042,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5_expand_windows_env_vars() */ #endif /* H5_HAVE_WIN32_API */ - -/* Global variables */ -int H5_opterr = 1; /* Get_option prints errors if this is on */ -int H5_optind = 1; /* Token pointer */ -const char *H5_optarg; /* Flag argument (or value) */ - -/*------------------------------------------------------------------------- - * Function: H5_get_option - * - * Purpose: Determine the command-line options a user specified. We can - * accept both short and long type command-lines. - * - * Return: Success: The short valued "name" of the command line - * parameter or EOF if there are no more - * parameters to process. - * - * Failure: A question mark. - *------------------------------------------------------------------------- - */ -int -H5_get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) -{ - static int sp = 1; /* character index in current token */ - int optopt = '?'; /* option character passed back to user */ - - if (sp == 1) { - /* check for more flag-like tokens */ - if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { - return EOF; - } - else if (HDstrcmp(argv[H5_optind], "--") == 0) { - H5_optind++; - return EOF; - } - } - - if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { - /* long command line option */ - int i; - const char ch = '='; - char * arg = HDstrdup(&argv[H5_optind][2]); - size_t arg_len = 0; - - H5_optarg = strchr(&argv[H5_optind][2], ch); - arg_len = HDstrlen(&argv[H5_optind][2]); - if (H5_optarg) { - arg_len -= HDstrlen(H5_optarg); - H5_optarg++; /* skip the equal sign */ - } - arg[arg_len] = 0; - - for (i = 0; l_opts && l_opts[i].name; i++) { - if (HDstrcmp(arg, l_opts[i].name) == 0) { - /* we've found a matching long command line flag */ - optopt = l_opts[i].shortval; - - if (l_opts[i].has_arg != no_arg) { - if (H5_optarg == NULL) { - if (l_opts[i].has_arg != optional_arg) { - if (H5_optind < (argc - 1)) - if (argv[H5_optind + 1][0] != '-') - H5_optarg = argv[++H5_optind]; - } - else if (l_opts[i].has_arg == require_arg) { - if (H5_opterr) - HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); - - optopt = '?'; - } - } - } - else { - if (H5_optarg) { - if (H5_opterr) - HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); - - optopt = '?'; - } - } - break; - } - } - - if (l_opts[i].name == NULL) { - /* exhausted all of the l_opts we have and still didn't match */ - if (H5_opterr) - HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); - - optopt = '?'; - } - - H5_optind++; - sp = 1; - - HDfree(arg); - } - else { - register char *cp; /* pointer into current token */ - - /* short command line option */ - optopt = argv[H5_optind][sp]; - - if (optopt == ':' || (cp = HDstrchr(opts, optopt)) == 0) { - if (H5_opterr) - HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optopt); - - /* if no chars left in this token, move to next token */ - if (argv[H5_optind][++sp] == '\0') { - H5_optind++; - sp = 1; - } - return '?'; - } - - if (*++cp == ':') { - /* if a value is expected, get it */ - if (argv[H5_optind][sp + 1] != '\0') { - /* flag value is rest of current token */ - H5_optarg = &argv[H5_optind++][sp + 1]; - } - else if (++H5_optind >= argc) { - if (H5_opterr) - HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optopt); - - optopt = '?'; - } - else { - /* flag value is next token */ - H5_optarg = argv[H5_optind++]; - } - - sp = 1; - } - /* wildcard argument */ - else if (*cp == '*') { - /* check the next argument */ - H5_optind++; - /* we do have an extra argument, check if not last */ - if ((H5_optind + 1) < argc) { - if (argv[H5_optind][0] != '-') { - H5_optarg = argv[H5_optind++]; - } - else { - H5_optarg = NULL; - } - } - else { - H5_optarg = NULL; - } - } - else { - /* set up to look at next char in token, next time */ - if (argv[H5_optind][++sp] == '\0') { - /* no more in current token, so setup next token */ - H5_optind++; - sp = 1; - } - H5_optarg = NULL; - } - } - - /* return the current flag character found */ - return optopt; -} diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 0617643..88911b0 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -45,6 +45,7 @@ typedef __int64 h5_stat_size_t; #define HDlseek(F, O, W) _lseeki64(F, O, W) #define HDlstat(S, B) _lstati64(S, B) #define HDmkdir(S, M) _mkdir(S) +#define HDnanosleep(N, O) Wnanosleep(N, O) #define HDoff_t __int64 /* Note that the variadic HDopen macro is using a VC++ extension |