root/ompi/mca/io/romio321/romio/adio/common/ad_fcntl.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_GEN_Fcntl

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 2005 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "adio.h"
   9 
  10 #ifdef HAVE_UNISTD_H
  11 #include <unistd.h>
  12 #endif
  13 
  14 void ADIOI_GEN_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
  15                      int *error_code)
  16 {
  17     static char myname[] = "ADIOI_GEN_FCNTL";
  18 
  19     switch(flag) {
  20     case ADIO_FCNTL_GET_FSIZE:
  21 #ifdef ADIOI_MPE_LOGGING
  22         MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
  23 #endif
  24         fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END);
  25 #ifdef ADIOI_MPE_LOGGING
  26         MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
  27 #endif
  28         if (fd->fp_sys_posn != -1) {
  29 #ifdef ADIOI_MPE_LOGGING
  30              MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );
  31 #endif
  32              lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
  33 #ifdef ADIOI_MPE_LOGGING
  34              MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );
  35 #endif
  36         }
  37         if (fcntl_struct->fsize == -1) {
  38             *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  39                                                MPIR_ERR_RECOVERABLE, myname,
  40                                                __LINE__, MPI_ERR_IO, "**io",
  41                                                "**io %s", strerror(errno));
  42         }
  43         else *error_code = MPI_SUCCESS;
  44         break;
  45 
  46     case ADIO_FCNTL_SET_DISKSPACE:
  47         ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
  48         break;
  49 
  50     case ADIO_FCNTL_SET_ATOMICITY:
  51         fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
  52         *error_code = MPI_SUCCESS;
  53         break;
  54 
  55         /* --BEGIN ERROR HANDLING-- */
  56     default:
  57         *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  58                                            MPIR_ERR_RECOVERABLE,
  59                                            myname, __LINE__,
  60                                            MPI_ERR_ARG,
  61                                            "**flag", "**flag %d", flag);
  62         /* --END ERROR HANDLING-- */
  63     }
  64 }

/* [<][>][^][v][top][bottom][index][help] */