hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject [14/30] hadoop git commit: MAPREDUCE-6416. Not all platforms have d_type in struct dirent (Alan Burlison via aw)
Date Fri, 30 Oct 2015 18:00:27 GMT
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/HDFS-8966
Commit: 5c24fe7f91970dedae35906ff7990ea5410f070e
Parents: ab99d95
Author: Allen Wittenauer <aw@apache.org>
Authored: Tue Oct 27 12:22:08 2015 -0700
Committer: Allen Wittenauer <aw@apache.org>
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);


Mime
View raw message