00001
00002
00003
00009
00010
00011
00012
00013
00014
00015 #include "ad_bgl.h"
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 void ADIOI_BGL_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
00039 {
00040 int err;
00041 MPI_Comm dupcommself;
00042 static char myname[] = "ADIOI_BGL_SET_SHARED_FP";
00043
00044 if (fd->shared_fp_fd == ADIO_FILE_NULL) {
00045 MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
00046 fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
00047 fd->shared_fp_fname,
00048 fd->file_system, fd->fns,
00049 ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
00050 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL,
00051 ADIO_PERM_NULL, error_code);
00052 }
00053
00054 if (*error_code != MPI_SUCCESS) return;
00055
00056 ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
00057 lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET);
00058 err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset));
00059 ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
00060
00061 if (err == -1) {
00062 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00063 myname, __LINE__, MPI_ERR_IO,
00064 "**io",
00065 "**io %s", strerror(errno));
00066 }
00067 else *error_code = MPI_SUCCESS;
00068 }