This source file includes following definitions.
- ADIOI_NFS_Set_shared_fp
1
2
3
4
5
6
7
8 #include "ad_nfs.h"
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
32 {
33 ssize_t err;
34 MPI_Comm dupcommself;
35 static char myname[] = "ADIOI_NFS_SET_SHARED_FP";
36
37 if (fd->shared_fp_fd == ADIO_FILE_NULL) {
38 MPI_Comm_dup(MPI_COMM_SELF, &dupcommself);
39 fd->shared_fp_fd = ADIO_Open(MPI_COMM_SELF, dupcommself,
40 fd->shared_fp_fname,
41 fd->file_system, fd->fns,
42 ADIO_CREATE | ADIO_RDWR | ADIO_DELETE_ON_CLOSE,
43 0, MPI_BYTE, MPI_BYTE, MPI_INFO_NULL,
44 ADIO_PERM_NULL, error_code);
45 }
46
47 if (*error_code != MPI_SUCCESS) return;
48
49 ADIOI_WRITE_LOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
50 #ifdef ADIOI_MPE_LOGGING
51 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
52 #endif
53 lseek(fd->shared_fp_fd->fd_sys, 0, SEEK_SET);
54 #ifdef ADIOI_MPE_LOGGING
55 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
56 #endif
57 #ifdef ADIOI_MPE_LOGGING
58 MPE_Log_event( ADIOI_MPE_write_a, 0, NULL );
59 #endif
60 err = write(fd->shared_fp_fd->fd_sys, &offset, sizeof(ADIO_Offset));
61 #ifdef ADIOI_MPE_LOGGING
62 MPE_Log_event( ADIOI_MPE_write_b, 0, NULL );
63 #endif
64 ADIOI_UNLOCK(fd->shared_fp_fd, 0, SEEK_SET, sizeof(ADIO_Offset));
65
66 if (err == -1) {
67 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
68 myname, __LINE__, MPI_ERR_IO,
69 "**io",
70 "**io %s", strerror(errno));
71 }
72 else *error_code = MPI_SUCCESS;
73 }
74