ipxfwexitstatus
- Date:
10-20-2011
NAME
IPXFWEXITSTATUS - Returns the lower bits of exit argument
SYNOPSIS
INTEGER FUNCTION IPXFWEXITSTATUS(istat)
INTEGER istat
IMPLEMENTATION
Cray Linux Environment (CLE)
DESCRIPTION
The IPXFWEXITSTATUS integer function returns part of the lower bits from the exit argument x. The PXFWIFEXITED logical function returns TRUE when exit() was used to return from the child process. IPXFWEXITSTATUS should only be used when PXFWIFEXITED returns TRUE.
The following is a list of arguments for this routine:
- istat
An input integer variable with the PXFWAIT or PXFWAITPID output status argument.
When using the Cray Fortran compiler, all arguments must be of default kind unless documented otherwise. The default kind is KIND=4 for integer, real, complex, and logical arguments.
EXAMPLES
program pxftest
integer istat, iretpid, ipid, ierror, i, j
integer iwexitstatus, IPXFWEXITSTATUS
logical lwifexited, PXFWIFEXITED
CALL PXFFORK(ipid,ierror)
if (ierror .ne. 0) then
print *,'FAILED: PXFFORK call failed with error = ',ierror
else
if (ipid .eq. 0) then
j = 0
do i=1,100000
j = j + i
enddo
stop
else
CALL PXFWAIT(istat,iretpid,ierror)
if (ierror .eq. 0) then
print *,'PASSED: PXFWAIT normal test'
lwifexited = PXFWIFEXITED(istat)
if (lwifexited .eqv. .TRUE.) then ! exit normally
iwexitstatus = IPXFWEXITSTATUS(istat)
if (iwexitstatus .ne. 0) then ! exit(0) returned
print *,'PXFWIFEXITED returned TRUE'
print *,'expected IPXFWEXITSTATUS(istat) = 0'
print *,'IPXFWEXITSTATUS(istat) = ',iwexitstatus
else
print *,'PXFWIFEXITED test PASSED'
print *,'IPXFWEXITSTATUS test PASSED'
endif
else
print *,'PXFWIFEXITED returned FALSE'
print *,'PXFWAIT istat = ', istat
print *,'IPXFWEXITSTATUS cannot be called.'
endif
else
print *,'FAILED: PXFWAIT call with error = ',ierror
endif
endif
endif
end
SEE ALSO
PXFWAIT(3F), PXFWIFEXITED(3F)