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