root/ompi/mca/io/romio321/romio/mpi-io/set_errh.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_set_errhandler

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "mpioimpl.h"
   9 #include "adio_extern.h"
  10 
  11 #ifdef HAVE_WEAK_SYMBOLS
  12 
  13 #if defined(HAVE_PRAGMA_WEAK)
  14 #pragma weak MPI_File_set_errhandler = PMPI_File_set_errhandler
  15 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  16 #pragma _HP_SECONDARY_DEF PMPI_File_set_errhandler MPI_File_set_errhandler
  17 #elif defined(HAVE_PRAGMA_CRI_DUP)
  18 #pragma _CRI duplicate MPI_File_set_errhandler as PMPI_File_set_errhandler
  19 /* end of weak pragmas */
  20 #elif defined(HAVE_WEAK_ATTRIBUTE)
  21 int MPI_File_set_errhandler(MPI_File file, MPI_Errhandler errhandler) __attribute__((weak,alias("PMPI_File_set_errhandler")));
  22 #endif
  23 
  24 /* Include mapping from MPI->PMPI */
  25 #define MPIO_BUILD_PROFILING
  26 #include "mpioprof.h"
  27 #endif
  28 
  29 /*@
  30     MPI_File_set_errhandler - Sets the error handler for a file
  31 
  32 Input Parameters:
  33 . fh - file handle (handle)
  34 . errhandler - error handler (handle)
  35 
  36 .N fortran
  37 @*/
  38 int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler)
  39 {
  40     int error_code = MPI_SUCCESS;
  41     static char myname[] = "MPI_FILE_SET_ERRHANDLER";
  42     ADIO_File fh;
  43     MPID_THREADPRIV_DECL;
  44 
  45     ROMIO_THREAD_CS_ENTER();
  46 
  47     if (mpi_fh == MPI_FILE_NULL) {
  48         ADIOI_DFLT_ERR_HANDLER = errhandler;
  49     }
  50     else {
  51         fh = MPIO_File_resolve(mpi_fh);
  52 
  53         /* --BEGIN ERROR HANDLING-- */
  54         MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
  55         /* --END ERROR HANDLING-- */
  56 
  57         if ((errhandler != MPI_ERRORS_RETURN) &&
  58             (errhandler != MPI_ERRORS_ARE_FATAL))
  59         {
  60             error_code = MPIO_Err_create_code(MPI_SUCCESS,
  61                                               MPIR_ERR_RECOVERABLE,
  62                                               myname, __LINE__,
  63                                               MPI_ERR_UNSUPPORTED_OPERATION,
  64                                               "**fileopunsupported",
  65                                               0);
  66             error_code = MPIO_Err_return_file(fh, error_code);
  67             goto fn_exit;
  68         }
  69 
  70         fh->err_handler = errhandler;
  71     }
  72 
  73 fn_exit:
  74     ROMIO_THREAD_CS_EXIT();
  75     return error_code;
  76 }

/* [<][>][^][v][top][bottom][index][help] */