Remove HD from fork/exec*/wait* (#3190)

These are not C99 but are hidden behind ifdefs and are highly
unlikely to ever have non-POSIX equivalents.
This commit is contained in:
Dana Robinson
2023-06-27 21:35:55 -07:00
committed by GitHub
parent badc6098f7
commit 7d1fdb2d27
10 changed files with 66 additions and 84 deletions
-18
View File
@@ -671,15 +671,6 @@ typedef off_t h5_stat_size_t;
#ifndef HDdifftime
#define HDdifftime(X, Y) difftime(X, Y)
#endif
#ifndef HDexecv
#define HDexecv(S, AV) execv(S, AV)
#endif
#ifndef HDexecve
#define HDexecve(S, AV, E) execve(S, AV, E)
#endif
#ifndef HDexecvp
#define HDexecvp(S, AV) execvp(S, AV)
#endif
#ifndef HDexit
#define HDexit(N) exit(N)
#endif
@@ -754,9 +745,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifndef HDfopen
#define HDfopen(S, M) fopen(S, M)
#endif
#ifndef HDfork
#define HDfork() fork()
#endif
#ifndef HDfprintf
#define HDfprintf fprintf
#endif
@@ -1230,12 +1218,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
#ifndef HDvsnprintf
#define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A)
#endif
#ifndef HDwait
#define HDwait(W) wait(W)
#endif
#ifndef HDwaitpid
#define HDwaitpid(P, W, O) waitpid(P, W, O)
#endif
#ifndef HDwrite
#define HDwrite(F, M, Z) write(F, M, Z)
#endif
+3 -3
View File
@@ -2258,7 +2258,7 @@ test_swmr_write_big(hbool_t newest_format)
int status; /* Status returned from child process */
/* Fork child process to verify that the data at [1024, 2014] does get written to disk */
if ((pid = HDfork()) < 0) {
if ((pid = fork()) < 0) {
HDperror("fork");
FAIL_STACK_ERROR;
}
@@ -2271,13 +2271,13 @@ test_swmr_write_big(hbool_t newest_format)
char swmr_reader[] = SWMR_READER;
char *const new_argv[] = {swmr_reader, NULL};
/* Run the reader */
status = HDexecv(SWMR_READER, new_argv);
status = execv(SWMR_READER, new_argv);
HDprintf("errno from execv = %s\n", HDstrerror(errno));
FAIL_STACK_ERROR;
} /* end if */
/* Parent process -- wait for the child process to complete */
while (pid != HDwaitpid(pid, &status, 0))
while (pid != waitpid(pid, &status, 0))
/*void*/;
/* Check if child process terminates normally and its return value */
+2 -2
View File
@@ -2824,12 +2824,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
*/
HDfflush(stdout);
HDfflush(stderr);
if ((child_pid = HDfork()) < 0) {
if ((child_pid = fork()) < 0) {
HDperror("fork");
return 1;
}
else if (child_pid > 0) {
while (child_pid != HDwaitpid(child_pid, &status, 0)) /*void*/
while (child_pid != waitpid(child_pid, &status, 0)) /*void*/
;
if (WIFEXITED(status) && 255 == WEXITSTATUS(status)) {
return 0; /*child exit after catching SIGFPE*/
+46 -46
View File
@@ -2501,7 +2501,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -2552,7 +2552,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR;
/* Check exit status of child process */
@@ -2580,7 +2580,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -2745,7 +2745,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR;
/* Check exit status of child process */
@@ -2772,7 +2772,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -2822,7 +2822,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR;
/* Check exit status of child process */
@@ -2848,7 +2848,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -2902,7 +2902,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR;
/* Check exit status of child process */
@@ -2928,7 +2928,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -2982,7 +2982,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR;
/* Check exit status of child process */
@@ -5236,7 +5236,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5289,7 +5289,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5313,7 +5313,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5366,7 +5366,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5391,7 +5391,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5444,7 +5444,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5469,7 +5469,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5527,7 +5527,7 @@ test_file_lock_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5633,7 +5633,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5686,7 +5686,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5711,7 +5711,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5764,7 +5764,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5789,7 +5789,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5842,7 +5842,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5866,7 +5866,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5919,7 +5919,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -5943,7 +5943,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -5999,7 +5999,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6023,7 +6023,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6076,7 +6076,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6101,7 +6101,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6154,7 +6154,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6179,7 +6179,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6232,7 +6232,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6257,7 +6257,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6313,7 +6313,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6338,7 +6338,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6391,7 +6391,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6416,7 +6416,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6469,7 +6469,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6494,7 +6494,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -6550,7 +6550,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR;
/* Check if child terminated normally */
@@ -6673,7 +6673,7 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
TEST_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
TEST_ERROR;
if (childpid == 0) {
@@ -6729,7 +6729,7 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri
TEST_ERROR;
/* Wait for child process to complete */
if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
if (waitpid(childpid, &child_status, child_wait_option) < 0)
TEST_ERROR;
/* Check exit status of the child */
@@ -7172,7 +7172,7 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Fork child process */
if ((childpid = HDfork()) < 0)
if ((childpid = fork()) < 0)
FAIL_STACK_ERROR;
if (childpid == 0) { /* Child process */
@@ -7347,7 +7347,7 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR;
/* Check exit status of child process */
+2 -2
View File
@@ -379,7 +379,7 @@ main(int argc, char *argv[])
if (launch_g == UC_READWRITE) {
/* fork process */
if ((childpid = HDfork()) < 0) {
if ((childpid = fork()) < 0) {
HDperror("fork");
Hgoto_error(1);
};
@@ -417,7 +417,7 @@ main(int argc, char *argv[])
/* If readwrite, collect exit code of child process */
/* ================================================ */
if (launch_g == UC_READWRITE) {
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) {
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) {
HDperror("waitpid");
Hgoto_error(1);
}
+2 -2
View File
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
/* Fork process */
/* ============ */
if (UC_opts.launch == UC_READWRITE) {
if ((childpid = HDfork()) < 0) {
if ((childpid = fork()) < 0) {
HDperror("fork");
Hgoto_error(1);
}
@@ -242,7 +242,7 @@ main(int argc, char *argv[])
/* If readwrite, collect exit code of child process */
/* ================================================ */
if (UC_opts.launch == UC_READWRITE) {
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) {
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) {
HDperror("waitpid");
Hgoto_error(1);
}
+2 -2
View File
@@ -260,7 +260,7 @@ main(int argc, char *argv[])
/* Fork process */
/* ============ */
if (UC_opts.launch == UC_READWRITE) {
if ((childpid = HDfork()) < 0) {
if ((childpid = fork()) < 0) {
HDperror("fork");
Hgoto_error(1);
}
@@ -355,7 +355,7 @@ main(int argc, char *argv[])
/* If readwrite, collect exit code of child process */
/* ================================================ */
if (UC_opts.launch == UC_READWRITE) {
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) {
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) {
HDperror("waitpid");
Hgoto_error(1);
}
+2 -2
View File
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
/* Fork process */
/* ============ */
if (UC_opts.launch == UC_READWRITE) {
if ((childpid = HDfork()) < 0) {
if ((childpid = fork()) < 0) {
HDperror("fork");
Hgoto_error(1);
}
@@ -237,7 +237,7 @@ main(int argc, char *argv[])
/* If readwrite, collect exit code of child process */
/* ================================================ */
if (UC_opts.launch == UC_READWRITE) {
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) {
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) {
HDperror("waitpid");
Hgoto_error(1);
}
+5 -5
View File
@@ -1883,8 +1883,8 @@ test_subfiling_h5fuse(void)
pid_t tmppid;
int status;
pid = HDfork();
VRFY(pid >= 0, "HDfork succeeded");
pid = fork();
VRFY(pid >= 0, "fork succeeded");
if (pid == 0) {
char *tmp_filename;
@@ -1906,11 +1906,11 @@ test_subfiling_h5fuse(void)
args[6] = NULL;
/* Call h5fuse script from MPI rank 0 */
HDexecvp("env", args);
execvp("env", args);
}
else {
tmppid = HDwaitpid(pid, &status, 0);
VRFY(tmppid >= 0, "HDwaitpid succeeded");
tmppid = waitpid(pid, &status, 0);
VRFY(tmppid >= 0, "waitpid succeeded");
if (WIFEXITED(status)) {
int ret;
+2 -2
View File
@@ -432,7 +432,7 @@ error:
static void
wait_for_child(int H5_ATTR_UNUSED sig)
{
while (HDwaitpid(-1, NULL, WNOHANG) > 0)
while (waitpid(-1, NULL, WNOHANG) > 0)
;
} /* end wait_for_child() */
@@ -554,7 +554,7 @@ handle_requests(struct server_run *run)
mirror_log(run->loginfo, V_INFO, "probable OPEN xmit confirmed");
pid = HDfork();
pid = fork();
if (pid < 0) { /* fork error */
mirror_log(run->loginfo, V_ERR, "cannot fork");
goto error;