Skip to content

Commit

Permalink
Remove HD from fork/exec*/wait* (#3190)
Browse files Browse the repository at this point in the history
These are not C99 but are hidden behind ifdefs and are highly
unlikely to ever have non-POSIX equivalents.
  • Loading branch information
derobins authored Jun 28, 2023
1 parent badc609 commit 7d1fdb2
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 84 deletions.
18 changes: 0 additions & 18 deletions src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/accum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions test/dt_arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down
Loading

0 comments on commit 7d1fdb2

Please sign in to comment.