changeset 111:2f025f4bfa0a

8073849: Print last system error at every CRITICAL and ERROR messages Summary: strerror(errno) is added at JAVACALL_REPORT_ERROR/CRITICAL Reviewed-by: snazarki Contributed-by: alexey.karaksin@oracle.com
author snazarki
date Wed, 25 Feb 2015 12:45:03 +0300
parents 6b1ef3cdc4f4
children 380a1d95976d
files src/se/native/com/oracle/dio/javacall_logging.h
diffstat 1 files changed, 17 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/se/native/com/oracle/dio/javacall_logging.h	Wed Feb 25 12:39:11 2015 +0300
+++ b/src/se/native/com/oracle/dio/javacall_logging.h	Wed Feb 25 12:45:03 2015 +0300
@@ -34,6 +34,8 @@
  */
 
 #include "javacall_defs.h"
+#include <errno.h>
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -378,21 +380,21 @@
  * @{
  */
 #if JAVACALL_REPORT_LEVEL <= JAVACALL_LOGGING_ERROR
-#define JAVACALL_REPORT_ERROR(ch, msg) javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg)
-#define JAVACALL_REPORT_ERROR1(ch, msg, a1) javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg, a1)
+#define JAVACALL_REPORT_ERROR(ch, msg) javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg ". %s", strerror(errno))
+#define JAVACALL_REPORT_ERROR1(ch, msg, a1) javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg  ". %s", a1, strerror(errno))
 #define JAVACALL_REPORT_ERROR2(ch, msg, a1, a2) \
-  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg, a1, a2)
+  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg ". %s", a1, a2, strerror(errno))
 #define JAVACALL_REPORT_ERROR3(ch, msg, a1, a2, a3) \
-  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg, a1, a2, a3)
+  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, strerror(errno))
 #define JAVACALL_REPORT_ERROR4(ch, msg, a1, a2, a3, a4) \
-  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg, a1, a2, a3, a4)
+  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, a4, strerror(errno))
 #define JAVACALL_REPORT_ERROR5(ch, msg, a1, a2, a3, a4, a5) \
-  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg, a1, a2, a3, a4, a5)
+  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, a4, a5, strerror(errno))
 #define JAVACALL_REPORT_ERROR6(ch, msg, a1, a2, a3, a4, a5, a6) \
-  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg, a1, a2, a3, a4, a5, a6)
+  javacall_logging_printf(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, a4, a5, a6, strerror(errno))
 
 #define JAVACALL_REPORT_UTF16_ERROR(ch, prefix, msg, len) \
-    javacall_logging_utf16_print(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, prefix, msg, len)
+    javacall_logging_utf16_print(JAVACALL_LOGGING_ERROR, ch, __FILE__, __LINE__, prefix, msg ". %s", len, strerror(errno))
 #else
 #define JAVACALL_REPORT_ERROR(ch, msg)
 #define JAVACALL_REPORT_ERROR1(ch, msg, a1)
@@ -414,19 +416,19 @@
  * @{
  */
 #if JAVACALL_REPORT_LEVEL <= JAVACALL_LOGGING_CRITICAL
-#define JAVACALL_REPORT_CRIT(ch, msg) javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg)
-#define JAVACALL_REPORT_CRIT1(ch, msg, a1) javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch,__FILE__, __LINE__, msg, a1)
+#define JAVACALL_REPORT_CRIT(ch, msg) javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg ". %s", strerror(errno))
+#define JAVACALL_REPORT_CRIT1(ch, msg, a1) javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch,__FILE__, __LINE__, msg ". %s", a1, strerror(errno))
 #define JAVACALL_REPORT_CRIT2(ch, msg, a1, a2) \
-  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg, a1, a2)
+  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg ". %s", a1, a2, strerror(errno))
 #define JAVACALL_REPORT_CRIT3(ch, msg, a1, a2, a3) \
-  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg, a1, a2, a3)
+  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, strerror(errno))
 #define JAVACALL_REPORT_CRIT4(ch, msg, a1, a2, a3, a4) \
-  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg, a1, a2, a3, a4)
+  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, a4, strerror(errno))
 #define JAVACALL_REPORT_CRIT5(ch, msg, a1, a2, a3, a4, a5) \
-  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg, a1, a2, a3, a4, a5)
+  javacall_logging_printf(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, msg ". %s", a1, a2, a3, a4, a5, strerror(errno))
 
 #define JAVACALL_REPORT_UTF16_CRIT(ch, prefix, msg, len) \
-    javacall_logging_utf16_print(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, prefix, msg, len)
+    javacall_logging_utf16_print(JAVACALL_LOGGING_CRITICAL, ch, __FILE__, __LINE__, prefix, msg ". %s", len, strerror(errno))
 #else
 #define JAVACALL_REPORT_CRIT(ch, msg)
 #define JAVACALL_REPORT_CRIT1(ch, msg, a1)