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