File: mpich_fileutil.c

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,684 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (60 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Copyright (C) by Argonne National Laboratory
 *     See COPYRIGHT in top-level directory
 */

#include "mpioimpl.h"
#include "adio_extern.h"

#ifdef MPICH

/* Forward ref for the routine to extract and set the error handler
   in a ROMIO File structure.  FIXME: These should be imported from a common
   header file that is also used in errhan/file_set_errhandler.c
 */
int MPIR_ROMIO_Get_file_errhand(MPI_File, MPI_Errhandler *);
int MPIR_ROMIO_Set_file_errhand(MPI_File, MPI_Errhandler);
void MPIR_Get_file_error_routine(MPI_Errhandler, void (**)(MPI_File *, int *, ...), int *);

/* These next two routines are used to allow MPICH to access/set the
   error handers in the MPI_File structure until MPICH knows about the
   file structure, and to handle the errhandler structure, which
   includes a reference count.  Not currently used. */
int MPIR_ROMIO_Set_file_errhand(MPI_File file_ptr, MPI_Errhandler e)
{
    if (file_ptr == MPI_FILE_NULL)
        ADIOI_DFLT_ERR_HANDLER = e;
    /* --BEGIN ERROR HANDLING-- */
    else if (file_ptr->cookie != ADIOI_FILE_COOKIE) {
        return MPI_ERR_FILE;
    }
    /* --END ERROR HANDLING-- */
    else
        file_ptr->err_handler = e;
    return 0;
}

int MPIR_ROMIO_Get_file_errhand(MPI_File file_ptr, MPI_Errhandler * e)
{
    if (file_ptr == MPI_FILE_NULL) {
        if (ADIOI_DFLT_ERR_HANDLER == MPI_ERRORS_RETURN)
            *e = 0;
        else {
            *e = ADIOI_DFLT_ERR_HANDLER;
        }
    }
    /* --BEGIN ERROR HANDLING-- */
    else if (file_ptr->cookie != ADIOI_FILE_COOKIE) {
        return MPI_ERR_FILE;
    }
    /* --END ERROR HANDLING-- */
    else {
        if (file_ptr->err_handler == MPI_ERRORS_RETURN)
            *e = 0;
        else
            *e = file_ptr->err_handler;
    }
    return 0;
}

#endif /* MPICH */