summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-08-08 15:34:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-08-08 15:34:48 (GMT)
commita130b7453d409206a468e72d36082b26ae46186e (patch)
treeca6011f360d236c7e4a397f4fb3aa28ce5b90db2
parentf31e8921632030104d8ff88234bba5e20b782976 (diff)
downloadhdf5-a130b7453d409206a468e72d36082b26ae46186e.zip
hdf5-a130b7453d409206a468e72d36082b26ae46186e.tar.gz
hdf5-a130b7453d409206a468e72d36082b26ae46186e.tar.bz2
[svn-r11209] Purpose:
New feature Description: Merge changes from development branch to report system errors better. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest
-rw-r--r--release_docs/RELEASE.txt3
-rw-r--r--src/H5E.c4
-rw-r--r--src/H5Eprivate.h20
-rw-r--r--src/H5Epublic.h5
-rw-r--r--src/H5FDsec2.c12
5 files changed, 36 insertions, 8 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index af94774..91109d7 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -41,6 +41,9 @@ New Features
Library:
--------
+ - Added HSYS_ERROR which retrieves the system error message and pushes
+ it to the error stack. This gives more information of the failed
+ system call. AKC - 2005/08/04
- Added H5F_OBJ_LOCAL flag to H5Fget_obj_count() & H5Fget_obj_ids(), to
allow querying for objects in file that were opened with a particular
file ID, instead of all objects opened in file with any file ID.
diff --git a/src/H5E.c b/src/H5E.c
index d4e9c74..36f09a1 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -200,8 +200,10 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = {
{H5E_CALLBACK, "Callback failed"},
{H5E_CANAPPLY, "Error from filter \"can apply\" callback"},
{H5E_SETLOCAL, "Error from filter \"set local\" callback"},
- {H5E_NOENCODER, "Filter present, but encoder not enabled"}
+ {H5E_NOENCODER, "Filter present, but encoder not enabled"},
+ /* I/O pipeline errors */
+ {H5E_SYSERRSTR, "System error message"}
};
/* Interface initialization? */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index 72886f7..edfa959 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -104,6 +104,26 @@ H5_DLL herr_t H5E_push (H5E_major_t maj_num, H5E_minor_t min_num,
H5_DLL herr_t H5E_clear (void);
H5_DLL herr_t H5E_dump_api_stack (int is_api);
+/*
+ * Macros handling system error messages as described in C standard.
+ * These macros assume errnum is a valid system error code.
+ */
+
+/* Retrieve the error code description string and push it onto the error
+ * stack.
+ */
+#define HSYS_ERROR(errnum){ \
+ HERROR(H5E_INTERNAL, H5E_SYSERRSTR, HDstrerror(errnum)); \
+}
+#define HSYS_DONE_ERROR(majorcode, minorcode, retcode, str){ \
+ HSYS_ERROR(errno); \
+ HDONE_ERROR(majorcode, minorcode, retcode, str); \
+}
+#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str){ \
+ HSYS_ERROR(errno); \
+ HGOTO_ERROR(majorcode, minorcode, retcode, str); \
+}
+
#ifdef H5_HAVE_PARALLEL
/*
* MPI error handling macros.
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 5dfecf4..ef405d4 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -228,7 +228,10 @@ typedef enum H5E_minor_t {
H5E_CALLBACK, /*callback failed */
H5E_CANAPPLY, /*error from filter "can apply" callback */
H5E_SETLOCAL, /*error from filter "set local" callback */
- H5E_NOENCODER /* Filter present, but encoding disabled */
+ H5E_NOENCODER, /* Filter present, but encoding disabled */
+
+ /* System level errors */
+ H5E_SYSERRSTR /* System error message */
} H5E_minor_t;
/* Information about an error */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 2229853..cadc459 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -363,9 +363,9 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
/* Open the file */
if ((fd=HDopen(name, o_flags, 0666))<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
+ HSYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
if (HDfstat(fd, &sb)<0)
- HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
+ HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
/* Create the new file struct */
if (NULL==(file=H5FL_CALLOC(H5FD_sec2_t)))
@@ -423,7 +423,7 @@ H5FD_sec2_close(H5FD_t *_file)
FUNC_ENTER_NOAPI(H5FD_sec2_close, FAIL)
if (HDclose(file->fd)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
+ HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
H5FL_FREE(H5FD_sec2_t,file);
@@ -706,7 +706,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
/* Seek to the correct location */
if ((addr!=file->pos || OP_READ!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -790,7 +790,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
/* Seek to the correct location */
if ((addr!=file->pos || OP_WRITE!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Write the data, being careful of interrupted system calls and partial
@@ -873,7 +873,7 @@ H5FD_sec2_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* WIN32 */
if (-1==file_truncate(file->fd, (file_offset_t)file->eoa))
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
+ HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* WIN32 */
/* Update the eof value */