00001
00002
00003
00004
00005
00006
00007
00008 #include "mpioimpl.h"
00009
00010 #ifdef HAVE_WEAK_SYMBOLS
00011
00012 #if defined(HAVE_PRAGMA_WEAK)
00013 #pragma weak MPI_File_get_size = PMPI_File_get_size
00014 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00015 #pragma _HP_SECONDARY_DEF PMPI_File_get_size MPI_File_get_size
00016 #elif defined(HAVE_PRAGMA_CRI_DUP)
00017 #pragma _CRI duplicate MPI_File_get_size as PMPI_File_get_size
00018
00019 #endif
00020
00021
00022 #define MPIO_BUILD_PROFILING
00023 #include "mpioprof.h"
00024 #endif
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 int MPI_File_get_size(MPI_File mpi_fh, MPI_Offset *size)
00038 {
00039 int error_code;
00040 ADIO_File fh;
00041 ADIO_Fcntl_t *fcntl_struct;
00042 static char myname[] = "MPI_FILE_GET_SIZE";
00043 #ifdef MPI_hpux
00044 int fl_xmpi;
00045
00046 HPMP_IO_START(fl_xmpi, BLKMPIFILEGETSIZE, TRDTBLOCK, fh,
00047 MPI_DATATYPE_NULL, -1);
00048 #endif
00049
00050 fh = MPIO_File_resolve(mpi_fh);
00051
00052
00053 MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
00054
00055
00056 ADIOI_TEST_DEFERRED(fh, myname, &error_code);
00057
00058 fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t));
00059 ADIO_Fcntl(fh, ADIO_FCNTL_GET_FSIZE, fcntl_struct, &error_code);
00060
00061 if (error_code != MPI_SUCCESS)
00062 error_code = MPIO_Err_return_file(fh, error_code);
00063
00064 *size = fcntl_struct->fsize;
00065 ADIOI_Free(fcntl_struct);
00066
00067 #ifdef MPI_hpux
00068 HPMP_IO_END(fl_xmpi, fh, MPI_DATATYPE_NULL, -1);
00069 #endif
00070
00071 fn_exit:
00072 return error_code;
00073 }