AMPI #952: update ROMIO to MPICH2-1.4.1p1
[charm.git] / src / libs / ck-libs / ampi / romio / mpi-io / get_posn_sh.c
blob873f5c4e196d79e937531a2897db6ba4eb681d28
1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 /*
4 * Copyright (C) 1997 University of Chicago.
5 * See COPYRIGHT notice in top-level directory.
6 */
8 #include "mpioimpl.h"
10 #ifdef HAVE_WEAK_SYMBOLS
12 #if defined(HAVE_PRAGMA_WEAK)
13 #pragma weak MPI_File_get_position_shared = PMPI_File_get_position_shared
14 #elif defined(HAVE_PRAGMA_HP_SEC_DEF)
15 #pragma _HP_SECONDARY_DEF PMPI_File_get_position_shared MPI_File_get_position_shared
16 #elif defined(HAVE_PRAGMA_CRI_DUP)
17 #pragma _CRI duplicate MPI_File_get_position_shared as PMPI_File_get_position_shared
18 /* end of weak pragmas */
19 #endif
21 /* Include mapping from MPI->PMPI */
22 #define MPIO_BUILD_PROFILING
23 #include "mpioprof.h"
24 #endif
26 /*@
27 MPI_File_get_position_shared - Returns the current position of the
28 shared file pointer in etype units relative to the current view
30 Input Parameters:
31 . fh - file handle (handle)
33 Output Parameters:
34 . offset - offset of shared file pointer (nonnegative integer)
36 .N fortran
37 @*/
38 int MPI_File_get_position_shared(MPI_File mpi_fh, MPI_Offset *offset)
40 int error_code;
41 ADIO_File fh;
42 static char myname[] = "MPI_FILE_GET_POSITION_SHARED";
44 fh = MPIO_File_resolve(mpi_fh);
46 /* --BEGIN ERROR HANDLING-- */
47 MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);
48 MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code);
49 MPIO_CHECK_FS_SUPPORTS_SHARED(fh, myname, error_code);
50 /* --END ERROR HANDLING-- */
52 ADIOI_TEST_DEFERRED(fh, myname, &error_code);
54 ADIO_Get_shared_fp(fh, 0, offset, &error_code);
55 /* --BEGIN ERROR HANDLING-- */
56 if (error_code != MPI_SUCCESS)
57 error_code = MPIO_Err_return_file(fh, error_code);
58 /* --END ERROR HANDLING-- */
60 fn_exit:
61 return error_code;