This source file includes following definitions.
- MPI_File_set_errhandler
1
2
3
4
5
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
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
25 #define MPIO_BUILD_PROFILING
26 #include "mpioprof.h"
27 #endif
28
29
30
31
32
33
34
35
36
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
54 MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
55
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 }