This source file includes following definitions.
- MPI_File_get_size
1
2
3
4
5
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
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
24 #define MPIO_BUILD_PROFILING
25 #include "mpioprof.h"
26 #endif
27
28
29
30
31
32
33
34
35
36
37
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
51
52 adio_fh = MPIO_File_resolve(fh);
53
54
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
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
69 if (error_code != MPI_SUCCESS)
70 error_code = MPIO_Err_return_file(adio_fh, error_code);
71
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
78
79 fn_exit:
80 return error_code;
81 fn_fail:
82
83 error_code = MPIO_Err_return_file(fh, error_code);
84 goto fn_exit;
85
86 }