File: mpich_fileutil.c

package info (click to toggle)
openmpi 2.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 99,912 kB
  • ctags: 55,589
  • sloc: ansic: 525,999; f90: 18,307; makefile: 12,062; sh: 6,583; java: 6,278; asm: 3,515; cpp: 2,227; perl: 2,136; python: 1,350; lex: 734; fortran: 52; tcl: 12
file content (60 lines) | stat: -rw-r--r-- 1,798 bytes parent folder | download | duplicates (2)
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
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
 *  (C) 2001 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 */