00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "adio.h"
00010
00011 #ifdef HAVE_UNISTD_H
00012 #include <unistd.h>
00013 #endif
00014
00015 void ADIOI_GEN_Flush(ADIO_File fd, int *error_code)
00016 {
00017 int err;
00018 #ifndef PRINT_ERR_MSG
00019 static char myname[] = "ADIOI_GEN_FLUSH";
00020 #endif
00021 err = fsync(fd->fd_sys);
00022 #ifdef PRINT_ERR_MSG
00023 *error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
00024 #else
00025 if (err == -1) {
00026 *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
00027 myname, "I/O Error", "%s", strerror(errno));
00028 ADIOI_Error(MPI_FILE_NULL, *error_code, myname);
00029 }
00030 else *error_code = MPI_SUCCESS;
00031 #endif
00032 }