src/solaris/native/common/jni_util_md.c

Print this page

        

@@ -35,10 +35,17 @@
 
 char* nativeGetStringPlatformChars(JNIEnv *env, jstring jstr, jboolean *isCopy) {
     return NULL;
 }
 
+#if defined(LINUX) && (defined(_GNU_SOURCE) || \
+         (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE < 200112L \
+             && defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 600))
+extern int __xpg_strerror_r(int, char *, size_t);
+#define strerror_r(a, b, c) __xpg_strerror_r((a), (b), (c))
+#endif
+
 void* getProcessHandle() {
     static void *procHandle = NULL;
     if (procHandle != NULL) {
         return procHandle;
     }

@@ -57,5 +64,11 @@
         strcat(jniEntryName, "_");
         strcat(jniEntryName, cname);
     }
 }
 
+int
+getErrorString(int err, char *buf, size_t len)
+{
+    if (err == 0 || len < 1) return 0;
+    return strerror_r(err, buf, len);
+}