1 /*
2    (C) 2004 by Argonne National Laboratory.
3        See COPYRIGHT in top-level directory.
4 */
5 #include "collchk.h"
6 
MPI_File_open(MPI_Comm comm,MPICH2_CONST char * filename,int amode,MPI_Info info,MPI_File * fh)7 int MPI_File_open(MPI_Comm comm, MPICH2_CONST char *filename, int amode,
8                   MPI_Info info, MPI_File *fh)
9 {
10     int g2g = 1,i;
11     char call[COLLCHK_SM_STRLEN];
12 
13     sprintf(call, "FILE_OPEN");
14 
15     /* Check if init has been called */
16     g2g = CollChk_is_init();
17 
18     if(g2g) {
19         /* check for call consistancy */
20         CollChk_same_call(comm, call);
21         /* check for amode consistancy */
22         CollChk_same_amode(comm, amode, call);
23 
24         /* make the call */
25         i = PMPI_File_open(comm, filename, amode, info, fh);
26 
27         /* save the fh's communicator for future reference */
28         CollChk_add_fh(*fh, comm);
29 
30         /* return to the user */
31         return i;
32     }
33     else {
34         /* init not called */
35         return CollChk_err_han("MPI_Init() has not been called!",
36                                COLLCHK_ERR_NOT_INIT, call, comm);
37     }
38 }
39