-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/errhan/file_call_errhandler.c
-: 0:Graph:file_call_errhandler.gcno
-: 0:Data:file_call_errhandler.gcda
-: 0:Runs:623
-: 0:Programs:173
-: 1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
-: 2:/*
-: 3: * (C) 2001 by Argonne National Laboratory.
-: 4: * See COPYRIGHT in top-level directory.
-: 5: */
-: 6:
-: 7:#include "mpiimpl.h"
-: 8:
-: 9:/* mpiext.h contains the prototypes for functions to interface MPICH2
-: 10: and ROMIO */
-: 11:#include "mpiext.h"
-: 12:
-: 13:/* -- Begin Profiling Symbol Block for routine MPI_File_call_errhandler */
-: 14:#if defined(HAVE_PRAGMA_WEAK)
-: 15:#pragma weak MPI_File_call_errhandler = PMPI_File_call_errhandler
-: 16:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 17:#pragma _HP_SECONDARY_DEF PMPI_File_call_errhandler MPI_File_call_errhandler
-: 18:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 19:#pragma _CRI duplicate MPI_File_call_errhandler as PMPI_File_call_errhandler
-: 20:#endif
-: 21:/* -- End Profiling Symbol Block */
-: 22:
-: 23:/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
-: 24: the MPI routines */
-: 25:#ifndef MPICH_MPI_FROM_PMPI
-: 26:#undef MPI_File_call_errhandler
-: 27:#define MPI_File_call_errhandler PMPI_File_call_errhandler
-: 28:
-: 29:#endif
-: 30:
-: 31:#undef FUNCNAME
-: 32:#define FUNCNAME MPI_File_call_errhandler
-: 33:#undef FCNAME
-: 34:#define FCNAME "MPI_File_call_errhander"
-: 35:/*@
-: 36: MPI_File_call_errhandler - Call the error handler installed on a
-: 37: file
-: 38:
-: 39: Input Parameters:
-: 40:+ fh - MPI file with error handler (handle)
-: 41:- errorcode - error code (integer)
-: 42:
-: 43:.N ThreadSafeNoUpdate
-: 44:
-: 45:.N Fortran
-: 46:
-: 47:.N Errors
-: 48:.N MPI_SUCCESS
-: 49:.N MPI_ERR_FILE
-: 50:@*/
-: 51:int MPI_File_call_errhandler(MPI_File fh, int errorcode)
6: 52:{
6: 53: int mpi_errno = MPI_SUCCESS;
-: 54:#ifdef MPI_MODE_RDONLY
-: 55: MPID_Errhandler *e;
-: 56: MPI_Errhandler eh;
-: 57:#endif
6: 58: MPIU_THREADPRIV_DECL;
-: 59: MPID_MPI_STATE_DECL(MPID_STATE_MPI_FILE_CALL_ERRHANDLER);
-: 60:
6: 61: MPIR_ERRTEST_INITIALIZED_ORDIE();
-: 62:
-: 63: MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_FILE_CALL_ERRHANDLER);
-: 64:
6: 65: MPIU_THREADPRIV_GET;
-: 66:
-: 67:#ifdef MPI_MODE_RDONLY
-: 68: /* Validate parameters, especially handles needing to be converted */
-: 69: /* FIXME: check for a valid file handle (fh) before converting to a
-: 70: pointer */
-: 71:
-: 72: /* ... body of routine ... */
-: 73:
6: 74: MPIR_ROMIO_Get_file_errhand( fh, &eh );
-: 75: /* Check for the special case of errors-throw-exception. In this case
-: 76: return the error code; the C++ wrapper will cause an exception to
-: 77: be thrown.
-: 78: */
-: 79:#ifdef HAVE_CXX_BINDING
6: 80: if (eh == MPIR_ERRORS_THROW_EXCEPTIONS) {
|
#####: 81: mpi_errno = errorcode;
#####: 82: goto fn_exit;
-: 83: }
-: 84:#endif
|
6: 85: if (!eh) {
|
#####: 86: MPID_Errhandler_get_ptr( MPI_ERRORS_RETURN, e );
-: 87: }
-: 88: else {
|
6: 89: MPID_Errhandler_get_ptr( eh, e );
-: 90: }
-: 91:
-: 92: /* The user error handler may make calls to MPI routines, so the nesting
-: 93: * counter must be incremented before the handler is called */
6: 94: MPIR_Nest_incr();
-: 95:
-: 96: /* Note that, unlike the rest of MPICH2, MPI_File objects are pointers,
-: 97: not integers. */
-: 98:
6: 99: switch (e->language) {
-: 100: case MPID_LANG_C:
3: 101: (*e->errfn.C_File_Handler_function)( &fh, &errorcode );
3: 102: break;
-: 103:#ifdef HAVE_CXX_BINDING
-: 104: case MPID_LANG_CXX:
-: 105: /* See HAVE_LANGUAGE_FORTRAN below for an explanation */
3: 106: { void *fh1 = (void *)&fh;
3: 107: (*MPIR_Process.cxx_call_errfn)( 1, fh1, &errorcode,
-: 108: (void (*)(void))*e->errfn.C_File_Handler_function );
-: 109: }
3: 110: break;
-: 111:#endif
-: 112:#ifdef HAVE_FORTRAN_BINDING
-: 113: case MPID_LANG_FORTRAN90:
-: 114: case MPID_LANG_FORTRAN:
-: 115: /* The assignemt to a local variable prevents the compiler
-: 116: from generating a warning about a type-punned pointer. Since
-: 117: the value is really const (but MPI didn't define error handlers
-: 118: with const), this preserves the intent */
|
#####: 119: { void *fh1 = (void *)&fh;
#####: 120: (*e->errfn.F77_Handler_function)( fh1, &errorcode );
-: 121: }
-: 122: break;
-: 123:#endif
-: 124: }
-: 125:
|
6: 126: MPIR_Nest_decr();
-: 127:
-: 128:#else
-: 129: /* Dummy in case ROMIO is not defined */
-: 130: mpi_errno = MPI_ERR_INTERN;
-: 131:#endif
-: 132: /* ... end of body of routine ... */
-: 133:
-: 134:#if defined(HAVE_CXX_BINDING) && defined(MPI_MODE_RDONLY)
6: 135: fn_exit:
-: 136:#endif
|
-: 137: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_FILE_CALL_ERRHANDLER);
|
6: 138: return mpi_errno;
-: 139:
|
-: 140: /* --BEGIN ERROR HANDLING-- */
-: 141:# if 0
-: 142: /* Use #ifdef HAVE_ERROR_CHECKING instead of #if 0 when we start to use
-: 143: this */
-: 144: fn_fail:
-: 145: {
-: 146: mpi_errno = MPIR_Err_create_code(
-: 147: mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
-: 148: "**mpi_file_call_errhandler",
-: 149: "**mpi_file_call_errhandler %F %d", fh, errorcode);
-: 150: }
-: 151: /* FIXME: Is this obsolete now? */
-: 152:#ifdef MPI_MODE_RDONLY
-: 153: mpi_errno = MPIO_Err_return_file( fh, mpi_errno );
-: 154:#endif
-: 155: goto fn_exit;
-: 156:# endif
-: 157: /* --END ERROR HANDLING-- */
-: 158:}
-: 159:
-: 160:#ifndef MPICH_MPI_FROM_PMPI
-: 161:/* This is a glue routine that can be used by ROMIO
-: 162: (see mpi-io/glue/mpich2/mpio_err.c) to properly invoke the C++
-: 163: error handler */
-: 164:#undef FUNCNAME
-: 165:#define FUNCNAME MPIR_File_call_cxx_errhandler
-: 166:#undef FCNAME
-: 167:#define FCNAME MPIU_QUOTE(FUNCNAME)
-: 168:int MPIR_File_call_cxx_errhandler( MPI_File *fh, int *errorcode,
-: 169: void (*c_errhandler)(MPI_File *, int *, ... ) )
|
1: 170:{
-: 171: /* ROMIO will contain a reference to this routine, so if there is
-: 172: no C++ support, it will never be called but it must be availavle. */
-: 173:#ifdef HAVE_CXX_BINDING
1: 174: void *fh1 = (void *)fh;
1: 175: (*MPIR_Process.cxx_call_errfn)( 1, fh1, errorcode, (void(*)(void))c_errhandler );
-: 176: /* The C++ code throws an exception if the error handler
-: 177: returns something other than MPI_SUCCESS. There is no "return"
-: 178: of an error code. This code mirrors that in errutil.c */
1: 179: *errorcode = MPI_SUCCESS;
-: 180:#endif
1: 181: return *errorcode;
-: 182:}
-: 183:#endif
|