00001 /* -*- Mode: C; c-basic-offset:4 ; -*- */ 00002 /* 00003 * (C) 2001 by Argonne National Laboratory. 00004 * See COPYRIGHT in top-level directory. 00005 */ 00006 #include "mpioimpl.h" 00007 #include "adio_extern.h" 00008 00009 #ifdef MPICH2 00010 00011 /* Forward ref for the routine to extract and set the error handler 00012 in a ROMIO File structure. FIXME: These should be imported from a common 00013 header file that is also used in errhan/file_set_errhandler.c 00014 */ 00015 int MPIR_ROMIO_Get_file_errhand( MPI_File, MPI_Errhandler * ); 00016 int MPIR_ROMIO_Set_file_errhand( MPI_File, MPI_Errhandler ); 00017 void MPIR_Get_file_error_routine( MPI_Errhandler, 00018 void (**)(MPI_File *, int *, ...), 00019 int * ); 00020 00021 /* These next two routines are used to allow MPICH2 to access/set the 00022 error handers in the MPI_File structure until MPICH2 knows about the 00023 file structure, and to handle the errhandler structure, which 00024 includes a reference count. Not currently used. */ 00025 int MPIR_ROMIO_Set_file_errhand( MPI_File file_ptr, MPI_Errhandler e ) 00026 { 00027 if (file_ptr == MPI_FILE_NULL) ADIOI_DFLT_ERR_HANDLER = e; 00028 /* --BEGIN ERROR HANDLING-- */ 00029 else if (file_ptr->cookie != ADIOI_FILE_COOKIE) { 00030 return MPI_ERR_FILE; 00031 } 00032 /* --END ERROR HANDLING-- */ 00033 else 00034 file_ptr->err_handler = e; 00035 return 0; 00036 } 00037 int MPIR_ROMIO_Get_file_errhand( MPI_File file_ptr, MPI_Errhandler *e ) 00038 { 00039 if (file_ptr == MPI_FILE_NULL) { 00040 if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_RETURN) 00041 *e = 0; 00042 else { 00043 *e = ADIOI_DFLT_ERR_HANDLER; 00044 } 00045 } 00046 /* --BEGIN ERROR HANDLING-- */ 00047 else if (file_ptr->cookie != ADIOI_FILE_COOKIE) { 00048 return MPI_ERR_FILE; 00049 } 00050 /* --END ERROR HANDLING-- */ 00051 else { 00052 if (file_ptr->err_handler == MPI_ERRORS_RETURN) 00053 *e = 0; 00054 else 00055 *e = file_ptr->err_handler; 00056 } 00057 return 0; 00058 } 00059 00060 #endif /* MPICH2 */