This source file includes following definitions.
- ADIOI_SFS_Fcntl
1
2
3
4
5
6
7
8 #include "ad_sfs.h"
9 #include "adio_extern.h"
10
11 void ADIOI_SFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
12 {
13 int i, ntimes, len;
14 ADIO_Offset curr_fsize, alloc_size, size, done;
15 ADIO_Status status;
16 char *buf;
17 #ifndef PRINT_ERR_MSG
18 static char myname[] = "ADIOI_SFS_FCNTL";
19 #endif
20
21 switch(flag) {
22 case ADIO_FCNTL_GET_FSIZE:
23
24
25
26
27
28
29 fsync(fd->fd_sys);
30 MPI_Barrier(fd->comm);
31 fsync(fd->fd_sys);
32
33 fcntl_struct->fsize = llseek(fd->fd_sys, 0, SEEK_END);
34 if (fd->fp_sys_posn != -1)
35 llseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
36 if (fcntl_struct->fsize == -1) {
37 #ifdef MPICH
38 *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
39 "**io %s", strerror(errno));
40 #elif defined(PRINT_ERR_MSG)
41 *error_code = MPI_ERR_UNKNOWN;
42 #else
43 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
44 myname, "I/O Error", "%s", strerror(errno));
45 ADIOI_Error(fd, *error_code, myname);
46 #endif
47 }
48 else *error_code = MPI_SUCCESS;
49 break;
50
51 case ADIO_FCNTL_SET_DISKSPACE:
52 ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
53 break;
54
55 case ADIO_FCNTL_SET_ATOMICITY:
56 fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
57 *error_code = MPI_SUCCESS;
58 break;
59
60 default:
61 FPRINTF(stderr, "Unknown flag passed to ADIOI_SFS_Fcntl\n");
62 MPI_Abort(MPI_COMM_WORLD, 1);
63 }
64 }