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 3C05F177B5 for ; Tue, 27 Oct 2015 19:22:16 +0000 (UTC) Received: (qmail 23838 invoked by uid 500); 27 Oct 2015 19:22:15 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 23766 invoked by uid 500); 27 Oct 2015 19:22:15 -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 23757 invoked by uid 99); 27 Oct 2015 19:22:15 -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; Tue, 27 Oct 2015 19:22:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AC442DFF30; Tue, 27 Oct 2015 19:22:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aw@apache.org To: common-commits@hadoop.apache.org Message-Id: <4d083d46aedf4e838c37066c7522d5eb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: MAPREDUCE-6416. Not all platforms have d_type in struct dirent (Alan Burlison via aw) Date: Tue, 27 Oct 2015 19:22:15 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/trunk ab99d953e -> 5c24fe7f9 MAPREDUCE-6416. Not all platforms have d_type in struct dirent (Alan Burlison via aw) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5c24fe7f Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5c24fe7f Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5c24fe7f Branch: refs/heads/trunk Commit: 5c24fe7f91970dedae35906ff7990ea5410f070e Parents: ab99d95 Author: Allen Wittenauer Authored: Tue Oct 27 12:22:08 2015 -0700 Committer: Allen Wittenauer Committed: Tue Oct 27 12:22:08 2015 -0700 ---------------------------------------------------------------------- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../src/main/native/src/lib/FileSystem.cc | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/5c24fe7f/hadoop-mapreduce-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 4b5413f..49244d3 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -214,6 +214,9 @@ Trunk (Unreleased) MAPREDUCE-6412. Make hadoop-mapreduce-client Native code -Wall-clean (Alan Burlison via aw) + MAPREDUCE-6416. Not all platforms have d_type in struct dirent + (Alan Burlison via aw) + BREAKDOWN OF MAPREDUCE-2841 (NATIVE TASK) SUBTASKS MAPREDUCE-5985. native-task: Fix build on macosx. Contributed by http://git-wip-us.apache.org/repos/asf/hadoop/blob/5c24fe7f/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/FileSystem.cc ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/FileSystem.cc b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/FileSystem.cc index e0a698c..2fb78a8 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/FileSystem.cc +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/FileSystem.cc @@ -167,10 +167,17 @@ class RawFileSystem : public FileSystem { FileEntry temp; while ((dirp = readdir(dp)) != NULL) { temp.name = dirp->d_name; - temp.isDirectory = dirp->d_type & DT_DIR; if (temp.name == "." || temp.name == "..") { continue; } +/* Use Linux d_type if available, otherwise stat(2) the path */ +#ifdef DT_DIR + temp.isDirectory = dirp->d_type & DT_DIR; +#else + const string p = path + "/" + temp.name; + struct stat sb; + temp.isDirectory = stat(p.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode) == 0; +#endif status.push_back(temp); } closedir(dp);