00001
00002
00003
00004
00005
00006
00007
00008 #include "mpioimpl.h"
00009 #include "adio_extern.h"
00010
00011 #ifdef HAVE_WEAK_SYMBOLS
00012
00013 #if defined(HAVE_PRAGMA_WEAK)
00014 #pragma weak MPI_File_get_errhandler = PMPI_File_get_errhandler
00015 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00016 #pragma _HP_SECONDARY_DEF PMPI_File_get_errhandler MPI_File_get_errhandler
00017 #elif defined(HAVE_PRAGMA_CRI_DUP)
00018 #pragma _CRI duplicate MPI_File_get_errhandler as PMPI_File_get_errhandler
00019
00020 #endif
00021
00022
00023 #define MPIO_BUILD_PROFILING
00024 #include "mpioprof.h"
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler *errhandler)
00039 {
00040 int error_code = MPI_SUCCESS;
00041 ADIO_File fh;
00042 static char myname[] = "MPI_FILE_GET_ERRHANDLER";
00043 MPIU_THREADPRIV_DECL;
00044
00045 MPIU_THREAD_CS_ENTER(ALLFUNC,);
00046
00047 if (mpi_fh == MPI_FILE_NULL) {
00048 *errhandler = CtvAccess(ADIOI_DFLT_ERR_HANDLER);
00049 }
00050 else {
00051 fh = MPIO_File_resolve(mpi_fh);
00052
00053 if ((fh <= (MPI_File) 0) || ((fh)->cookie != ADIOI_FILE_COOKIE))
00054 {
00055 error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00056 myname, __LINE__, MPI_ERR_ARG,
00057 "**iobadfh", 0);
00058 error_code = MPIO_Err_return_file(MPI_FILE_NULL, error_code);
00059 goto fn_exit;
00060 }
00061
00062
00063 *errhandler = fh->err_handler;
00064 }
00065
00066 fn_exit:
00067 MPIU_THREAD_CS_EXIT(ALLFUNC,);
00068 return MPI_SUCCESS;
00069 }