critical impact:
wait4 - parameter differences (CrCh180)
Problem description
The status parameter for the wait4 function is different on Tru64 UNIX and HP-UX.
The wait4 function waits for a child process to stop or terminate.
On Tru64 UNIX, wait4 has the following function prototype:
pid_t wait4 (pid_t wpid, union wait *status, int options, struct rusage *rusage);
On HP-UX, wait4 has the following function prototype:
pid_t wait4 (pid_t wpid, int *status, int options, struct rusage *rusage);
Note that on Tru64 UNIX, status is declared as union wait *; on HP-UX, status is declared as an int *. Identifiers
 wait4 |
|
|
|
|
|
|
Old behavior
Example 1
union wait status;
result = wait4(pid, &status, options, rusage);
Example 2
.
.
.
union wait status;
if (WIFEXITED(status -> w_status)) ...
.
.
.
See also
Solution description
Change your code.
If your application uses wait4, change the union wait variable to an int.
In addition, for each of the following macros (called after wait4 in accordance with the Tru64 UNIX documentation), change the type of the parameter passed to the macro from the w_status member of the wait union to an to an integer:
- WIFEXITED()
- WEXITSTATUS()
- WIFSIGNALED()
- WTERMSIG()
- WIFSTOPPED()
- WSTOPSIG()
- WIFCONTINUED()
The wait4 function will be documented in a future release of HP-UX. Monitor the HP-UX release notes for information on its availability. New behavior
Example 1
int status;
result = wait4(pid, &status, options, rusage);
Example 2
.
.
.
int status;
if (WIFEXITED(status)) ...
.
.
.
Problem summary
| classifications |
source types |
OS release |
severity |
type |
| KN, SIG |
C, C++ |
any HP-UX 11i version |
critical |
changed |
|