00001
00002
00003
00009
00010
00011
00012
00013
00014
00015 #include "ad_bgl.h"
00016 #include "ad_bgl_aggrs.h"
00017
00018 void ADIOI_BGL_Close(ADIO_File fd, int *error_code)
00019 {
00020 int err, derr=0;
00021 static char myname[] = "ADIOI_BGL_CLOSE";
00022
00023 #ifdef PROFILE
00024 MPE_Log_event(9, 0, "start close");
00025 #endif
00026
00027 err = close(fd->fd_sys);
00028 if (fd->fd_direct >= 0)
00029 {
00030 derr = close(fd->fd_direct);
00031 }
00032
00033 #ifdef PROFILE
00034 MPE_Log_event(10, 0, "end close");
00035 #endif
00036
00037
00038 if (fd->fs_ptr != NULL) {
00039 ADIOI_Free(fd->fs_ptr);
00040 fd->fs_ptr = NULL;
00041 }
00042 fd->fd_sys = -1;
00043 fd->fd_direct = -1;
00044
00045 if (err == -1 || derr == -1)
00046 {
00047 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00048 myname, __LINE__, MPI_ERR_IO,
00049 "**io",
00050 "**io %s", strerror(errno));
00051 }
00052 else *error_code = MPI_SUCCESS;
00053 }