Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 422CB176BE for ; Fri, 30 Jan 2015 21:43:46 +0000 (UTC) Received: (qmail 50807 invoked by uid 500); 30 Jan 2015 21:43:46 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 50618 invoked by uid 500); 30 Jan 2015 21:43:46 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 50117 invoked by uid 99); 30 Jan 2015 21:43:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Jan 2015 21:43:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A4BECE01BD; Fri, 30 Jan 2015 21:43:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zhz@apache.org To: common-commits@hadoop.apache.org Date: Fri, 30 Jan 2015 21:43:53 -0000 Message-Id: <72e045a8db9e4a448d05bce9f4ab3773@git.apache.org> In-Reply-To: <057d332d65304d0ca22cc3456f016a22@git.apache.org> References: <057d332d65304d0ca22cc3456f016a22@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [9/9] hadoop git commit: HADOOP-11403. Avoid using sys_errlist on Solaris, which lacks support for it (Malcolm Kavalsky via Colin P. McCabe) HADOOP-11403. Avoid using sys_errlist on Solaris, which lacks support for it (Malcolm Kavalsky via Colin P. McCabe) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8de7e21d Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8de7e21d Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8de7e21d Branch: refs/heads/HDFS-EC Commit: 8de7e21d52b1853d54b49c9a01e30e0c1c3bf554 Parents: a38ace1 Author: Colin Patrick Mccabe Authored: Thu Jan 29 15:43:57 2015 -0800 Committer: Zhe Zhang Committed: Fri Jan 30 13:42:05 2015 -0800 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../hadoop-common/src/main/native/src/exception.c | 6 ++++++ .../native/src/org/apache/hadoop/io/nativeio/NativeIO.c | 7 ++----- .../src/contrib/libwebhdfs/src/hdfs_http_client.c | 11 ++--------- 4 files changed, 13 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8de7e21d/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index cc254e0..c71d35a 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -794,6 +794,9 @@ Release 2.7.0 - UNRELEASED HADOOP-9907. Webapp http://hostname:port/metrics link is not working. (aajisaka) + HADOOP-11403. Avoid using sys_errlist on Solaris, which lacks support for it + (Malcolm Kavalsky via Colin P. McCabe) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/8de7e21d/hadoop-common-project/hadoop-common/src/main/native/src/exception.c ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/exception.c b/hadoop-common-project/hadoop-common/src/main/native/src/exception.c index 228af11..fc072e8 100644 --- a/hadoop-common-project/hadoop-common/src/main/native/src/exception.c +++ b/hadoop-common-project/hadoop-common/src/main/native/src/exception.c @@ -110,9 +110,15 @@ jthrowable newIOException(JNIEnv* env, const char *fmt, ...) const char* terror(int errnum) { + +#if defined(__sun) +// MT-Safe under Solaris which doesn't support sys_errlist/sys_nerr + return strerror(errnum); +#else if ((errnum < 0) || (errnum >= sys_nerr)) { return "unknown error."; } return sys_errlist[errnum]; +#endif } http://git-wip-us.apache.org/repos/asf/hadoop/blob/8de7e21d/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/nativeio/NativeIO.c ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/nativeio/NativeIO.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/nativeio/NativeIO.c index d7f8d4b..071d830 100644 --- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/nativeio/NativeIO.c +++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/nativeio/NativeIO.c @@ -19,6 +19,7 @@ #include "org_apache_hadoop.h" #include "org_apache_hadoop_io_nativeio_NativeIO.h" #include "org_apache_hadoop_io_nativeio_NativeIO_POSIX.h" +#include "exception.h" #ifdef UNIX #include @@ -893,11 +894,7 @@ void throw_ioe(JNIEnv* env, int errnum) char message[80]; jstring jstr_message; - if ((errnum >= 0) && (errnum < sys_nerr)) { - snprintf(message, sizeof(message), "%s", sys_errlist[errnum]); - } else { - snprintf(message, sizeof(message), "Unknown error %d", errnum); - } + snprintf(message,sizeof(message),"%s",terror(errnum)); jobject errno_obj = errno_to_enum(env, errnum); http://git-wip-us.apache.org/repos/asf/hadoop/blob/8de7e21d/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libwebhdfs/src/hdfs_http_client.c ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libwebhdfs/src/hdfs_http_client.c b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libwebhdfs/src/hdfs_http_client.c index e41f950..dc58318 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libwebhdfs/src/hdfs_http_client.c +++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libwebhdfs/src/hdfs_http_client.c @@ -21,21 +21,14 @@ #include #include "hdfs_http_client.h" +#include "exception.h" static pthread_mutex_t curlInitMutex = PTHREAD_MUTEX_INITIALIZER; static volatile int curlGlobalInited = 0; const char *hdfs_strerror(int errnoval) { - const char *msg = NULL; - if (errnoval < 0 || errnoval >= sys_nerr) { - msg = "Invalid Error Code"; - } else if (sys_errlist == NULL) { - msg = "Unknown Error"; - } else { - msg = sys_errlist[errnoval]; - } - return msg; + return terror(errnoval); } int initResponseBuffer(struct ResponseBuffer **buffer)