1 /*
2  * Copyright (C) by Argonne National Laboratory
3  *     See COPYRIGHT in top-level directory
4  */
5 
6 #include "mpioimpl.h"
7 
8 #ifdef HAVE_WEAK_SYMBOLS
9 
10 #if defined(HAVE_PRAGMA_WEAK)
11 #pragma weak MPI_File_get_amode = PMPI_File_get_amode
12 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
13 #pragma _HP_SECONDARY_DEF PMPI_File_get_amode MPI_File_get_amode
14 #elif defined(HAVE_PRAGMA_CRI_DUP)
15 #pragma _CRI duplicate MPI_File_get_amode as PMPI_File_get_amode
16 /* end of weak pragmas */
17 #elif defined(HAVE_WEAK_ATTRIBUTE)
18 int MPI_File_get_amode(MPI_File fh, int *amode)
19     __attribute__ ((weak, alias("PMPI_File_get_amode")));
20 #endif
21 
22 /* Include mapping from MPI->PMPI */
23 #define MPIO_BUILD_PROFILING
24 #include "mpioprof.h"
25 #endif
26 
27 /*@
28     MPI_File_get_amode - Returns the file access mode
29 
30 Input Parameters:
31 . fh - file handle (handle)
32 
33 Output Parameters:
34 . amode - access mode (integer)
35 
36 .N fortran
37 @*/
MPI_File_get_amode(MPI_File fh,int * amode)38 int MPI_File_get_amode(MPI_File fh, int *amode)
39 {
40     int error_code = MPI_SUCCESS;
41     static char myname[] = "MPI_FILE_GET_AMODE";
42     ADIO_File adio_fh;
43 
44     adio_fh = MPIO_File_resolve(fh);
45 
46     /* --BEGIN ERROR HANDLING-- */
47     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
48     /* --END ERROR HANDLING-- */
49 
50     *amode = adio_fh->orig_access_mode;
51 
52   fn_exit:
53     return error_code;
54 }
55