From 101fa7af8ebe26ad015b64d3b881df8a9124ccc2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 19 Feb 2017 18:28:52 -0800 Subject: Cleanups and normalizations against incoming page_buffering changes. --- src/H5FDmulti.c | 14 +++-- src/H5Fint.c | 15 +++-- src/H5MFaggr.c | 9 +-- test/cache.c | 17 +++--- test/cache_tagging.c | 7 ++- test/links.c | 3 +- test/tfile.c | 123 +++++++++++++++++++------------------- test/unlink.c | 4 +- test/use.h | 7 ++- test/use_append_chunk.c | 26 ++++---- test/use_common.c | 12 ++-- tools/lib/h5tools_dump.c | 134 +++++++++++++++++++++--------------------- tools/src/h5dump/h5dump_xml.c | 2 +- 13 files changed, 190 insertions(+), 183 deletions(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index befcaca..7e12869 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1151,14 +1151,18 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) ALL_MEMBERS(mt) { out_mt = mt; - if (f1->memb[mt] && f2->memb[mt]) break; - if (!cmp) { - if (f1->memb[mt]) cmp = -1; - else if (f2->memb[mt]) cmp = 1; + if(f1->memb[mt] && f2->memb[mt]) + break; + if(!cmp) { + if(f1->memb[mt]) + cmp = -1; + else if(f2->memb[mt]) + cmp = 1; } } END_MEMBERS; assert(cmp || out_mt=H5FD_MEM_NTYPES) return cmp; + if(out_mt>=H5FD_MEM_NTYPES) + return cmp; return H5FDcmp(f1->memb[out_mt], f2->memb[out_mt]); } diff --git a/src/H5Fint.c b/src/H5Fint.c index 4783a36..ada0e96 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -869,7 +869,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) } /* end if */ /* With the shutdown modifications, the contents of the metadata cache - * should be clean at this point, with the possible exception of the + * should be clean at this point, with the possible exception of the * the superblock and superblock extension. * * Verify this. @@ -892,18 +892,21 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) * (assuming they are persistent). In this case, closing the * free space managers should have no effect on EOA. * - * -- JRM + * -- JRM */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { if(H5MF_close(f, dxpl_id) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") - /* at this point, only the superblock and superblock + /* at this point, only the superblock and superblock * extension should be dirty. */ HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + /* Flush the file again (if requested), as shutting down the + * free space manager may dirty some data structures again. + */ if(flush) { /* Clear status_flags */ f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_WRITE_ACCESS); @@ -918,7 +921,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) * so that the eoa value corresponds to the end of the * space written to in the file. * - * At most, this should change the superblock or the + * At most, this should change the superblock or the * superblock extension messages. */ if(H5MF_free_aggrs(f, dxpl_id) < 0) @@ -930,7 +933,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") - /* at this point, only the superblock and superblock + /* at this point, only the superblock and superblock * extension should be dirty. */ HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); @@ -952,7 +955,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush) f->shared->sblock = NULL; } /* end if */ - /* with the possible exception of the superblock and superblock + /* with the possible exception of the superblock and superblock * extension, the metadata cache should be clean at this point. * * Verify this. diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 9cdebc8..1510645 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -232,9 +232,9 @@ haddr_t H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size) { - haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ - hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ - haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ + haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ + hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ + haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -543,7 +543,8 @@ H5MF_aggr_try_extend(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, } /* end else-if */ } /* end else */ } /* end if */ - else { /* The aggreator is not at end of file */ + else { + /* The aggreator is not at end of file */ /* Check if aggregator has enough internal space to satisfy the extension. */ if(aggr->size >= extra_requested) { /* Extend block into aggregator */ diff --git a/test/cache.c b/test/cache.c index a2bfa91..d09a122 100644 --- a/test/cache.c +++ b/test/cache.c @@ -15898,7 +15898,6 @@ check_destroy_pinned_err(void) * should fail. Unpin the entry and flush destroy again -- should * succeed. */ - if(pass) { reset_entries(); @@ -15909,7 +15908,7 @@ check_destroy_pinned_err(void) protect_entry(file_ptr, 0, 0); unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); - if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; } /* end if */ @@ -15925,9 +15924,8 @@ check_destroy_pinned_err(void) pass = FALSE; failure_mssg = "destroy failed after unpin.\n"; } /* end if */ - else { + else file_ptr->shared->cache = NULL; - } /* end else */ } /* end else */ if(saved_cache != NULL) { @@ -15989,16 +15987,16 @@ check_destroy_protected_err(void) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); - /* Note: normally this call would go just before the series of - * flushes prior to file close -- in particular, all entries + /* Note: normally this call would go just before the series of + * flushes prior to file close -- in particular, all entries * should be unprotected when this call is made. * * Thus H5C_prep_for_file_close() contains an assert to verify - * this. Since this assert would be triggered by the condition + * this. Since this assert would be triggered by the condition * we are trying to test, put the call to H5C_prep_for_file_close() * prior to the final protect call. */ - if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; } /* end if */ @@ -28154,8 +28152,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion) } if(show_progress) /* 0 */ - HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", - FUNC, checkpoint++, pass); + HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass); if(pass) { diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 74321d3..02ce19b 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -953,9 +953,9 @@ check_dense_attribute_tags(void) int verbose = FALSE; /* verbose file outout */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access property list */ - haddr_t d_tag = 0; /* Dataset tag value */ - haddr_t root_tag = 0; /* Root group tag value */ - char attrname[500]; /* Name of attribute */ + haddr_t d_tag = 0; /* Dataset tag value */ + haddr_t root_tag = 0; /* Root group tag value */ + char attrname[500]; /* Name of attribute */ /* Testing Macro */ TESTING("tag application during dense attribute manipulation"); @@ -1533,6 +1533,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Close and Reopen the file and group */ if ( H5Gclose(gid) < 0 ) TEST_ERROR; if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; diff --git a/test/links.c b/test/links.c index 182eb6c..d5a3b83 100644 --- a/test/links.c +++ b/test/links.c @@ -820,7 +820,7 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE]; @@ -2623,7 +2623,6 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); return 0; diff --git a/test/tfile.c b/test/tfile.c index 19a2df4..6987493 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -103,14 +103,14 @@ #define USERBLOCK_SIZE ((hsize_t) 512) /* Declarations for test_filespace_*() */ -#define FILENAME_LEN 1024 /* length of file name */ +#define FILENAME_LEN 1024 /* length of file name */ #define CORE_INCREMENT 1024 /* core file */ #define FAMILY_SIZE 1024 /* family file */ -#define DSETNAME "dset" /* Name of dataset */ -#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */ -#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */ -#define FILE5 "tfile5.h5" /* Test file */ -#define TEST_THRESHOLD10 10 /* Free space section threshold */ +#define DSETNAME "dset" /* Name of dataset */ +#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */ +#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */ +#define FILE5 "tfile5.h5" /* Test file */ +#define TEST_THRESHOLD10 10 /* Free space section threshold */ /* Declaration for test_libver_macros2() */ #define FILE6 "tfile6.h5" /* Test file */ @@ -120,7 +120,8 @@ #define NGROUPS 2 #define NDSETS 4 -const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch */ +/* Files created under 1.6 branch and 1.8 branch--used in test_filespace_compatible() */ +const char *OLD_FILENAME[] = { "filespace_1_6.h5", /* 1.6 HDF5 file */ "filespace_1_8.h5" /* 1.8 HDF5 file */ }; @@ -888,9 +889,8 @@ test_file_close(void) ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); break; - - case H5F_CLOSE_DEFAULT: - default: + case H5F_CLOSE_DEFAULT: + default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); break; } @@ -3605,36 +3605,36 @@ static void test_filespace_compatible(void) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ - hid_t fid; /* File id */ - hid_t fcpl; /* File creation property list template */ - hid_t did; /* Dataset id */ - int check[100]; /* Temporary buffer for verifying dataset data */ - int rdbuf[100]; /* Temporary buffer for reading in dataset data */ + hid_t fid = -1; /* File id */ + hid_t did = -1; /* Dataset id */ + hid_t fcpl; /* File creation property list template */ + int check[100]; /* Temporary buffer for verifying dataset data */ + int rdbuf[100]; /* Temporary buffer for reading in dataset data */ uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */ - ssize_t nread; /* Number of bytes read in */ - unsigned i, j; /* Local index variable */ - hssize_t free_space; /* Amount of free space in the file */ - hsize_t threshold; /* Free space section threshold */ + ssize_t nread; /* Number of bytes read in */ + unsigned i, j; /* Local index variable */ + hssize_t free_space; /* Amount of free-space in the file */ + hsize_t threshold; /* Free-space section threshold */ H5F_file_space_type_t strategy; /* File space handling strategy */ - herr_t ret; /* Return value */ + herr_t ret; /* Return value */ /* Output message about test being performed */ - MESSAGE(5, ("Testing File space compatibility for 1.6 and 1.8 files\n")); + MESSAGE(5, ("File space compatibility testing for 1.6 and 1.8 files\n")); for(j = 0; j < NELMTS(OLD_FILENAME); j++) { const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */ - /* Copy old file into test file */ + /* Open and copy the test file into a temporary file */ fd_old = HDopen(filename, O_RDONLY, 0666); CHECK(fd_old, FAIL, "HDopen"); fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, 0666); CHECK(fd_new, FAIL, "HDopen"); /* Copy data */ - while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) { - ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread); - CHECK(write_err, -1, "HDwrite"); - } /* end while */ + while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) { + ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread); + CHECK(write_err, -1, "HDwrite"); + } /* end while */ /* Close the files */ ret = HDclose(fd_old); @@ -3642,7 +3642,7 @@ test_filespace_compatible(void) ret = HDclose(fd_new); CHECK(ret, FAIL, "HDclose"); - /* Open the test file */ + /* Open the temporary test file */ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -3651,10 +3651,11 @@ test_filespace_compatible(void) CHECK(free_space, FAIL, "H5Fget_freespace"); VERIFY(free_space, (hssize_t)0, "H5Fget_freespace"); - /* Get the file's file creation property list */ + /* Get the file's file creation property list */ + fcpl = H5Fget_create_plist(fid); + CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Retrieve the file space handling strategy and threshold */ - fcpl = H5Fget_create_plist(fid); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); ret = H5Pget_file_space(fcpl, &strategy, &threshold); CHECK(ret, FAIL, "H5Pget_file_space"); @@ -3685,13 +3686,13 @@ test_filespace_compatible(void) ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); - /* Close the plist */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close the plist */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); /* Re-Open the file */ fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -4090,37 +4091,37 @@ test_file(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File I/O\n")); - test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(); /* Test file opening */ - test_file_reopen(); /* Test file reopening */ - test_file_close(); /* Test file close behavior */ - test_get_file_id(); /* Test H5Iget_file_id */ - test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ - test_file_perm(); /* Test file access permissions */ - test_file_perm2(); /* Test file access permission again */ + test_file_create(); /* Test file creation(also creation templates)*/ + test_file_open(); /* Test file opening */ + test_file_reopen(); /* Test file reopening */ + test_file_close(); /* Test file close behavior */ + test_get_file_id(); /* Test H5Iget_file_id */ + test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ + test_file_perm(); /* Test file access permissions */ + test_file_perm2(); /* Test file access permission again */ test_file_freespace(); /* Test file free space information */ - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ - test_file_open_dot(); /* Test opening objects with "." for a name */ - test_file_open_overlap(); /* Test opening files in an overlapping manner */ - test_file_getname(); /* Test basic H5Fget_name() functionality */ - test_file_double_root_open(); /* Test opening root group from two files works properly */ - test_file_double_group_open(); /* Test opening same group from two files works properly */ - test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ - test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + test_file_open_dot(); /* Test opening objects with "." for a name */ + test_file_open_overlap(); /* Test opening files in an overlapping manner */ + test_file_getname(); /* Test basic H5Fget_name() functionality */ + test_file_double_root_open(); /* Test opening root group from two files works properly */ + test_file_double_group_open(); /* Test opening same group from two files works properly */ + test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ + test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ test_file_double_file_dataset_open(TRUE); test_file_double_file_dataset_open(FALSE); - test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ - test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ - test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ - test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */ + test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ + test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ + test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ + test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */ test_filespace_sects(); /* Test file free space section information */ test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */ - test_filespace_compatible();/* Test compatibility for file space management */ - test_libver_bounds(); /* Test compatibility for file space management */ - test_libver_macros(); /* Test the macros for library version comparison */ - test_libver_macros2(); /* Test the macros for library version comparison */ + test_filespace_compatible(); /* Test compatibility for file space management */ + test_libver_bounds(); /* Test compatibility for file space management */ + test_libver_macros(); /* Test the macros for library version comparison */ + test_libver_macros2(); /* Test the macros for library version comparison */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_deprec(); /* Test deprecated routines */ + test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ diff --git a/test/unlink.c b/test/unlink.c index 660a155..e52699a 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2440,9 +2440,9 @@ int main(void) { hid_t fapl, fapl2, file; - int nerrors = 0; + int nerrors = 0; char filename[1024]; - unsigned new_format; + unsigned new_format; /* Metadata cache parameters */ int mdc_nelmts; diff --git a/test/use.h b/test/use.h index dce79a0..6664610 100644 --- a/test/use.h +++ b/test/use.h @@ -36,16 +36,17 @@ typedef enum part_t { UC_WRITER, /* writer only */ UC_READER /* reader only */ } part_t; + typedef struct options_t { - int chunksize; /* chunks are chunksize^2 planes */ - int chunkplanes; /* number of planes per chunk, default 1 */ + hsize_t chunksize; /* chunks are chunksize^2 planes */ + hsize_t chunkplanes; /* number of planes per chunk, default 1 */ hsize_t chunkdims[UC_RANK]; /* chunk dims is (chunkplan, chunksize, chunksize) */ hsize_t dims[UC_RANK]; /* dataset initial dims */ hsize_t max_dims[UC_RANK]; /* dataset max dims */ hsize_t nplanes; /* number of planes to write, default proportional to chunksize */ char *filename; /* use case data filename */ part_t launch; /* launch writer, reader or both */ - int use_swmr; /* use swmr open (1) or not */ + hbool_t use_swmr; /* use swmr open (1) or not */ int iterations; /* iterations, default 1 */ } options_t; diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index 9e50e8b..2b1b631 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -82,22 +82,22 @@ int setup_parameters(int argc, char * const argv[]) /* use case defaults */ HDmemset(&UC_opts, 0, sizeof(options_t)); UC_opts.chunksize = Chunksize_DFT; - UC_opts.use_swmr = 1; /* use swmr open */ + UC_opts.use_swmr = TRUE; /* use swmr open */ UC_opts.iterations = 1; UC_opts.chunkplanes = 1; /* parse options */ - if (parse_option(argc, argv) < 0){ + if (parse_option(argc, argv) < 0) return(-1); - } + /* set chunk dims */ - UC_opts.chunkdims[0] = (hsize_t)UC_opts.chunkplanes; - UC_opts.chunkdims[1] = UC_opts.chunkdims[2] = (hsize_t)UC_opts.chunksize; + UC_opts.chunkdims[0] = UC_opts.chunkplanes; + UC_opts.chunkdims[1] = UC_opts.chunkdims[2] = UC_opts.chunksize; /* set dataset initial and max dims */ UC_opts.dims[0] = 0; UC_opts.max_dims[0] = H5S_UNLIMITED; - UC_opts.dims[1] = UC_opts.dims[2] = UC_opts.max_dims[1] = UC_opts.max_dims[2] = (hsize_t)UC_opts.chunksize; + UC_opts.dims[1] = UC_opts.dims[2] = UC_opts.max_dims[1] = UC_opts.max_dims[2] = UC_opts.chunksize; /* set nplanes */ if (UC_opts.nplanes == 0) @@ -125,7 +125,7 @@ main(int argc, char *argv[]) int child_wait_option=0; int ret_value = 0; int child_ret_value; - hbool_t send_wait = 0; + hbool_t send_wait = FALSE; /* initialization */ if (setup_parameters(argc, argv) < 0){ @@ -135,7 +135,7 @@ main(int argc, char *argv[]) /* Determine the need to send/wait message file*/ if(UC_opts.launch == UC_READWRITE) { HDunlink(WRITER_MESSAGE); - send_wait = 1; + send_wait = TRUE; } /* ==============================================================*/ @@ -157,12 +157,12 @@ main(int argc, char *argv[]) if (UC_opts.launch==UC_READWRITE){ /* fork process */ - if((childpid = fork()) < 0) { - perror("fork"); + if((childpid = HDfork()) < 0) { + HDperror("fork"); Hgoto_error(1); }; }; - mypid = getpid(); + mypid = HDgetpid(); /* ============= */ /* launch reader */ @@ -193,8 +193,8 @@ main(int argc, char *argv[]) /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE){ - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ - perror("waitpid"); + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){ + HDperror("waitpid"); Hgoto_error(1); } if (WIFEXITED(child_status)){ diff --git a/test/use_common.c b/test/use_common.c index 99c0bd1..a18601c 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -69,7 +69,7 @@ parse_option(int argc, char * const argv[]) UC_opts.filename = optarg; break; case 'i': /* iterations */ - if ((UC_opts.iterations = atoi(optarg)) <= 0){ + if ((UC_opts.iterations = HDatoi(optarg)) <= 0) { fprintf(stderr, "bad iterations number %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); @@ -91,28 +91,28 @@ parse_option(int argc, char * const argv[]) } break; case 'n': /* number of planes to write/read */ - if ((UC_opts.nplanes = atoi(optarg)) <= 0){ + if ((UC_opts.nplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 's': /* use swmr file open mode */ - if ((UC_opts.use_swmr = atoi(optarg)) < 0){ + if ((UC_opts.use_swmr = HDatoi(optarg)) < 0) { fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); usage(progname_g); Hgoto_error(-1); }; break; case 'y': /* Number of planes per chunk */ - if ((UC_opts.chunkplanes = atoi(optarg)) <= 0){ + if ((UC_opts.chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'z': /* size of chunk=(z,z) */ - if ((UC_opts.chunksize = atoi(optarg)) <= 0){ + if ((UC_opts.chunksize = HDstrtoull(optarg, NULL, 0)) <= 0) { fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); @@ -361,7 +361,7 @@ int write_uc_file(hbool_t tosend) bufptr = buffer; for (j=0; j