1 /*
2  * Copyright (C) by Argonne National Laboratory
3  *     See COPYRIGHT in top-level directory
4  */
5 
6 #include <stdarg.h>
7 #include <stdio.h>
8 
9 #include "mpioimpl.h"
10 #include "adio_extern.h"
11 
12 /* Default error handling implementation.
13  *
14  * Note that only MPI_ERRORS_ARE_FATAL and MPI_ERRORS_RETURN are
15  * handled correctly; other handlers cause an abort.
16  */
17 
MPIO_Err_create_code(int lastcode,int fatal,const char fcname[],int line,int error_class,const char generic_msg[],const char specific_msg[],...)18 int MPIO_Err_create_code(int lastcode, int fatal, const char fcname[],
19                          int line, int error_class, const char generic_msg[],
20                          const char specific_msg[], ...)
21 {
22     va_list Argp;
23     int idx = 0;
24     char *buf;
25 
26     buf = (char *) ADIOI_Malloc(1024);
27     if (buf != NULL) {
28         idx += MPL_snprintf(buf, 1023, "%s (line %d): ", fcname, line);
29         if (specific_msg == NULL) {
30             MPL_snprintf(&buf[idx], 1023 - idx, "%s\n", generic_msg);
31         } else {
32             va_start(Argp, specific_msg);
33             vsnprintf(&buf[idx], 1023 - idx, specific_msg, Argp);
34             va_end(Argp);
35         }
36         ADIOI_Free(buf);
37     }
38 
39     return error_class;
40 }
41 
MPIO_Err_return_file(MPI_File mpi_fh,int error_code)42 int MPIO_Err_return_file(MPI_File mpi_fh, int error_code)
43 {
44     return error_code;
45 }
46 
MPIO_Err_return_comm(MPI_Comm mpi_comm,int error_code)47 int MPIO_Err_return_comm(MPI_Comm mpi_comm, int error_code)
48 {
49     return error_code;
50 }
51