From 407b3cb78819d363e7c2661a648459ae19a797e4 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 16 Oct 2006 12:58:40 +0000 Subject: [PATCH] Fix some problems with errhandlers: * Fix MPI-2 page number in comments for a specific reference in the spec * Allow getting/setting the errhandler on MPI_FILE_NULL * Allow freeing of intrinsic errhandlers, per MPI-2 errata (if you GET an errhandler on a communicator, you must be able to FREE it, even if it's an intrinsic). Thanks to Lisandro Dalcin for reporting these problems. This commit was SVN r12122. --- NEWS | 8 ++++++++ ompi/mpi/c/errhandler_free.c | 3 +-- ompi/mpi/c/file_delete.c | 2 +- ompi/mpi/c/file_get_errhandler.c | 7 +++++-- ompi/mpi/c/file_open.c | 2 +- ompi/mpi/c/file_set_errhandler.c | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 0629dd6a66..2b30b73932 100644 --- a/NEWS +++ b/NEWS @@ -64,6 +64,14 @@ version 1.0. - Addition of UDAPL BTL ("udapl"). +1.1.3 +----- + +- Fix several MPI_*ERRHANDLER* functions with respect to what + arguments they allowed and the behavior that they effected. Thanks + to Lisandro Dalcin for reporting the problems. + + 1.1.2 ----- diff --git a/ompi/mpi/c/errhandler_free.c b/ompi/mpi/c/errhandler_free.c index a98c87b2f0..87d8978e14 100644 --- a/ompi/mpi/c/errhandler_free.c +++ b/ompi/mpi/c/errhandler_free.c @@ -37,8 +37,7 @@ int MPI_Errhandler_free(MPI_Errhandler *errhandler) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (NULL == errhandler || - ompi_errhandler_is_intrinsic(*errhandler)) { + if (NULL == errhandler) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, "MPI_Errhandler_free"); } diff --git a/ompi/mpi/c/file_delete.c b/ompi/mpi/c/file_delete.c index 38843e80c6..ae5af54eac 100644 --- a/ompi/mpi/c/file_delete.c +++ b/ompi/mpi/c/file_delete.c @@ -50,7 +50,7 @@ int MPI_File_delete(char *filename, MPI_Info info) OMPI_ERRHANDLER_CHECK(rc, MPI_FILE_NULL, rc, FUNC_NAME); } - /* Note that MPI-2:9.7 (p265) says that errors in MPI_FILE_OPEN + /* Note that MPI-2:9.7 (p261) says that errors in MPI_FILE_OPEN (before the file handle is created) should invoke the default error handler on MPI_FILE_NULL. Hence, if we get a file handle out of ompi_file_open(), invoke the error handler on that. If diff --git a/ompi/mpi/c/file_get_errhandler.c b/ompi/mpi/c/file_get_errhandler.c index 6755262b0c..d35415011e 100644 --- a/ompi/mpi/c/file_get_errhandler.c +++ b/ompi/mpi/c/file_get_errhandler.c @@ -38,8 +38,11 @@ int MPI_File_get_errhandler( MPI_File file, MPI_Errhandler *errhandler) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - if (NULL == file || - MPI_FILE_NULL == file) { + + /* Note that MPI-2:9.7 (p261) explicitly says that you are + allowed to set the error handler on MPI_FILE_NULL */ + + if (NULL == file) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_FILE, "MPI_File_get_errhandler"); } else if (NULL == errhandler) { diff --git a/ompi/mpi/c/file_open.c b/ompi/mpi/c/file_open.c index 44b86d4a3d..534154265c 100644 --- a/ompi/mpi/c/file_open.c +++ b/ompi/mpi/c/file_open.c @@ -56,7 +56,7 @@ int MPI_File_open(MPI_Comm comm, char *filename, int amode, } - /* Note that MPI-2:9.7 (p265) says that errors in MPI_FILE_OPEN + /* Note that MPI-2:9.7 (p261) says that errors in MPI_FILE_OPEN (before the file handle is created) should invoke the default error handler on MPI_FILE_NULL. Hence, if we get a file handle out of ompi_file_open(), invoke the error handler on that. If diff --git a/ompi/mpi/c/file_set_errhandler.c b/ompi/mpi/c/file_set_errhandler.c index db37c538c4..54152d25a3 100644 --- a/ompi/mpi/c/file_set_errhandler.c +++ b/ompi/mpi/c/file_set_errhandler.c @@ -39,7 +39,7 @@ int MPI_File_set_errhandler( MPI_File file, MPI_Errhandler errhandler) if (MPI_PARAM_CHECK) { OMPI_ERR_INIT_FINALIZE(FUNC_NAME); - /* Note that MPI-2:9.7 (p265) explicitly says that you are + /* Note that MPI-2:9.7 (p261) explicitly says that you are allowed to set the error handler on MPI_FILE_NULL */ if (NULL == file) {