00001
00002
00003
00004
00005
00006
00007
00008 #include "adio.h"
00009
00010 #ifdef HAVE_UNISTD_H
00011 #include <unistd.h>
00012 #endif
00013
00014 void ADIOI_GEN_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
00015 {
00016 int err, rank;
00017 static char myname[] = "ADIOI_GEN_RESIZE";
00018
00019 MPI_Comm_rank(fd->comm, &rank);
00020
00021
00022 if (rank == fd->hints->ranklist[0]) {
00023 ADIOI_Assert(size == (off_t) size);
00024 err = ftruncate(fd->fd_sys, (off_t)size);
00025 }
00026
00027
00028 MPI_Bcast(&err, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
00029
00030
00031 if (err == -1) {
00032 *error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
00033 myname, __LINE__, MPI_ERR_IO,
00034 "**io", "**io %s", strerror(errno));
00035 return;
00036 }
00037
00038
00039 *error_code = MPI_SUCCESS;
00040 }