root/ompi/mca/io/romio321/romio/mpi-io/get_size.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_get_size

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "mpioimpl.h"
   9 
  10 #ifdef HAVE_WEAK_SYMBOLS
  11 
  12 #if defined(HAVE_PRAGMA_WEAK)
  13 #pragma weak MPI_File_get_size = PMPI_File_get_size
  14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
  15 #pragma _HP_SECONDARY_DEF PMPI_File_get_size MPI_File_get_size
  16 #elif defined(HAVE_PRAGMA_CRI_DUP)
  17 #pragma _CRI duplicate MPI_File_get_size as PMPI_File_get_size
  18 /* end of weak pragmas */
  19 #elif defined(HAVE_WEAK_ATTRIBUTE)
  20 int MPI_File_get_size(MPI_File fh, MPI_Offset *size) __attribute__((weak,alias("PMPI_File_get_size")));
  21 #endif
  22 
  23 /* Include mapping from MPI->PMPI */
  24 #define MPIO_BUILD_PROFILING
  25 #include "mpioprof.h"
  26 #endif
  27 
  28 /*@
  29     MPI_File_get_size - Returns the file size
  30 
  31 Input Parameters:
  32 . fh - file handle (handle)
  33 
  34 Output Parameters:
  35 . size - size of the file in bytes (nonnegative integer)
  36 
  37 .N fortran
  38 @*/
  39 int MPI_File_get_size(MPI_File fh, MPI_Offset *size)
  40 {
  41     int error_code;
  42     ADIO_File adio_fh;
  43     ADIO_Fcntl_t *fcntl_struct;
  44     static char myname[] = "MPI_FILE_GET_SIZE";
  45 #ifdef MPI_hpux
  46     int fl_xmpi;
  47 
  48     HPMP_IO_START(fl_xmpi, BLKMPIFILEGETSIZE, TRDTBLOCK, adio_fh,
  49                   MPI_DATATYPE_NULL, -1);
  50 #endif /* MPI_hpux */
  51 
  52     adio_fh = MPIO_File_resolve(fh);
  53 
  54     /* --BEGIN ERROR HANDLING-- */
  55     MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
  56     if(size == NULL){
  57         error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
  58                      myname, __LINE__, MPI_ERR_ARG,
  59                      "**nullptr", "**nullptr %s", "size");
  60         goto fn_fail;
  61     }
  62     /* --END ERROR HANDLING-- */
  63 
  64     ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);
  65 
  66     fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t));
  67     ADIO_Fcntl(adio_fh, ADIO_FCNTL_GET_FSIZE, fcntl_struct, &error_code);
  68     /* --BEGIN ERROR HANDLING-- */
  69     if (error_code != MPI_SUCCESS)
  70         error_code = MPIO_Err_return_file(adio_fh, error_code);
  71     /* --END ERROR HANDLING-- */
  72     *size = fcntl_struct->fsize;
  73     ADIOI_Free(fcntl_struct);
  74 
  75 #ifdef MPI_hpux
  76     HPMP_IO_END(fl_xmpi, adio_fh, MPI_DATATYPE_NULL, -1);
  77 #endif /* MPI_hpux */
  78 
  79 fn_exit:
  80     return error_code;
  81 fn_fail:
  82     /* --BEGIN ERROR HANDLING-- */
  83     error_code = MPIO_Err_return_file(fh, error_code);
  84     goto fn_exit;
  85     /* --END ERROR HANDLING-- */
  86 }

/* [<][>][^][v][top][bottom][index][help] */