MPI_File_get_amode(3)

MPI_File_get_amode - Returns the file access mode

As shipped in IRIX 6.5.19. Added in IRIX 6.5.19.

NAME
     MPI_File_get_amode - Returns the file access mode

SYNOPSIS
     C:

          #include "mpi.h"

          int MPI_File_get_amode (MPI_File fh, int *amode)


     Fortran:

          INCLUDE "mpif.h" (or USE MPI)

          INTEGER fh, amode, ierror

          CALL MPI_FILE_GET_AMODE (fh, amode, ierror)


DESCRIPTION
     MPI_File_get_amode returns, in amode, the access mode of the file
     associated with fh.  Access mode bits are defined in the MPI_File_open(3)
     man page.

     This routine accepts the following arguments:

     fh        Specifies the file handle (handle)

     amode     Returns access mode (integer)

     ierror    Specifies the return code value for successful completion,
               which is in MPI_SUCCESS.  MPI_SUCCESS is defined in the mpif.h
               file.

EXAMPLES
     The following Fortran 77 example illustrates decoding an access mode bit
     vector:

     SUBROUTINE BIT_QUERY(TEST_BIT, MAX_BIT, AMODE, BIT_FOUND)
     !
     !   TEST IF THE INPUT TEST_BIT IS SET IN THE INPUT AMODE
     !   IF SET, RETURN 1 IN BIT_FOUND, 0 OTHERWISE
     !
           INTEGER TEST_BIT, AMODE, BIT_FOUND, CP_AMODE, HIFOUND
           BIT_FOUND = 0
           CP_AMODE = AMODE
      100  CONTINUE
           LBIT = 0
           HIFOUND = 0
           DO 20 L = MAX_BIT, 0, -1
              MATCHER = 2**L
              IF (CP_AMODE .GE. MATCHER .AND. HIFOUND .EQ. 0) THEN
                 HIFOUND = 1
                 LBIT = MATCHER
                 CP_AMODE = CP_AMODE - MATCHER
              END IF
       20  CONTINUE
           IF (HIFOUND .EQ. 1 .AND. LBIT .EQ. TEST_BIT) BIT_FOUND = 1
           IF (BIT_FOUND .EQ. 0 .AND. HIFOUND .EQ. 1 .AND. &
               CP_AMODE .GT. 0) GO TO 100
           END


     The previous routine can be called successively to decode amode, one bit
     at a time.  For example, the following code fragment checks for
     MPI_MODE_RDONLY:

     CALL BIT_QUERY(MPI_MODE_RDONLY, 30, AMODE, BIT_FOUND)
           IF (BIT_FOUND .EQ. 1) THEN
              PRINT *, ' FOUND READ-ONLY BIT IN AMODE=', AMODE
           ELSE
              PRINT *, ' READ-ONLY BIT NOT FOUND IN AMODE=', AMODE
           END IF


   Notes for Fortran
     All MPI objects (for example, MPI_Datatype, MPI_Comm, MPI_File) are of
     type INTEGER.

SEE ALSO
     MPI_File_open(3), MPI_IO(3)