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_byte_offset = PMPI_File_get_byte_offset
00015 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
00016 #pragma _HP_SECONDARY_DEF PMPI_File_get_byte_offset MPI_File_get_byte_offset
00017 #elif defined(HAVE_PRAGMA_CRI_DUP)
00018 #pragma _CRI duplicate MPI_File_get_byte_offset as PMPI_File_get_byte_offset
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
00039
00040
00041 int MPI_File_get_byte_offset(MPI_File fh, MPI_Offset offset, MPI_Offset *disp)
00042 {
00043 #ifndef PRINT_ERR_MSG
00044 int error_code;
00045 static char myname[] = "MPI_FILE_GET_BYTE_OFFSET";
00046 #endif
00047
00048 #ifdef PRINT_ERR_MSG
00049 if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
00050 FPRINTF(stderr, "MPI_File_get_byte_offset: Invalid file handle\n");
00051 MPI_Abort(MPI_COMM_WORLD, 1);
00052 }
00053 #else
00054 ADIOI_TEST_FILE_HANDLE(fh, myname);
00055 #endif
00056
00057 if (offset < 0) {
00058 #ifdef PRINT_ERR_MSG
00059 FPRINTF(stderr, "MPI_File_get_byte_offset: Invalid offset argument\n");
00060 MPI_Abort(MPI_COMM_WORLD, 1);
00061 #else
00062 error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
00063 myname, (char *) 0, (char *) 0);
00064 return ADIOI_Error(fh, error_code, myname);
00065 #endif
00066 }
00067
00068 if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
00069 #ifdef PRINT_ERR_MSG
00070 FPRINTF(stderr, "MPI_File_get_byte_offset: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
00071 MPI_Abort(MPI_COMM_WORLD, 1);
00072 #else
00073 error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, MPIR_ERR_AMODE_SEQ,
00074 myname, (char *) 0, (char *) 0);
00075 return ADIOI_Error(fh, error_code, myname);
00076 #endif
00077 }
00078
00079 ADIOI_Get_byte_offset(fh, offset, disp);
00080 return MPI_SUCCESS;
00081 }