This source file includes following definitions.
- ADIOI_UFS_Open
1
2
3
4
5
6
7
8 #include "ad_ufs.h"
9
10 void ADIOI_UFS_Open(ADIO_File fd, int *error_code)
11 {
12 int perm, old_mask, amode;
13 static char myname[] = "ADIOI_UFS_OPEN";
14
15 if (fd->perm == ADIO_PERM_NULL) {
16 old_mask = umask(022);
17 umask(old_mask);
18 perm = old_mask ^ 0666;
19 }
20 else perm = fd->perm;
21
22 amode = 0;
23 if (fd->access_mode & ADIO_CREATE)
24 amode = amode | O_CREAT;
25 if (fd->access_mode & ADIO_RDONLY)
26 amode = amode | O_RDONLY;
27 if (fd->access_mode & ADIO_WRONLY)
28 amode = amode | O_WRONLY;
29 if (fd->access_mode & ADIO_RDWR)
30 amode = amode | O_RDWR;
31 if (fd->access_mode & ADIO_EXCL)
32 amode = amode | O_EXCL;
33
34
35 #ifdef ADIOI_MPE_LOGGING
36 MPE_Log_event( ADIOI_MPE_open_a, 0, NULL );
37 #endif
38 fd->fd_sys = open(fd->filename, amode, perm);
39 #ifdef ADIOI_MPE_LOGGING
40 MPE_Log_event( ADIOI_MPE_open_b, 0, NULL );
41 #endif
42 fd->fd_direct = -1;
43
44 if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND)) {
45 #ifdef ADIOI_MPE_LOGGING
46 MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
47 #endif
48 fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
49 #ifdef ADIOI_MPE_LOGGING
50 MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
51 #endif
52 }
53
54 if (fd->fd_sys == -1) {
55 *error_code = ADIOI_Err_create_code(myname, fd->filename, errno);
56 }
57 else *error_code = MPI_SUCCESS;
58 }