Backed out changeset 83d914c3431d (bug 999473) for Linux mochitest-other failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 01 May 2014 16:45:21 -0400
changeset 181648 977cf6a69034d62d9c992fd7271470f49ac871c7
parent 181647 9e36450f9e746c57f872632c08221dfc8bd5d60a
child 181649 e0b5e968c38fa50b8e63423afe8592bb38ec0f2c
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
bugs999473
milestone32.0a1
backs out83d914c3431d5e7e9fd168e3a6d8099731709803
Backed out changeset 83d914c3431d (bug 999473) for Linux mochitest-other failures.
xpcom/base/SystemMemoryReporter.cpp
--- a/xpcom/base/SystemMemoryReporter.cpp
+++ b/xpcom/base/SystemMemoryReporter.cpp
@@ -270,24 +270,16 @@ private:
         }
         while (true) {
           nsresult rv = ParseMapping(f, processName, aHandleReport, aData,
                                      &processSizes, aTotalPss);
           if (NS_FAILED(rv))
             break;
         }
         fclose(f);
-
-        // Report the open file descriptors for this process.
-        nsPrintfCString procFdPath("/proc/%s/fd", pidStr);
-        nsresult rv = CollectOpenFileReports(
-                  aHandleReport, aData, procFdPath, processName);
-        if (NS_FAILED(rv)) {
-          break;
-        }
       }
     }
     closedir(d);
 
     // Report the "processes/" tree.
 
     for (size_t i = 0; i < ProcessSizeKindLimit; i++) {
       nsAutoCString path("processes/");
@@ -726,94 +718,16 @@ private:
       REPORT_WITH_CLEANUP(comprSizePath, UNITS_BYTES, comprSize,
                           comprSizeDesc, closedir(d));
     }
 
     closedir(d);
     return NS_OK;
   }
 
-  nsresult
-  CollectOpenFileReports(nsIHandleReportCallback* aHandleReport,
-                         nsISupports* aData,
-                         const nsACString& aProcPath,
-                         const nsACString& aProcessName)
-  {
-    // All file descriptors opened by a process are listed under
-    // /proc/<pid>/fd/<numerical_fd>. Each entry is a symlink that points to the
-    // path that was opened. This can be an actual file, a socket, a pipe, an
-    // anon_inode, or possibly an uncategorized device.
-    const char kFilePrefix[] = "/";
-    const char kSocketPrefix[] = "socket:";
-    const char kPipePrefix[] = "pipe:";
-    const char kAnonInodePrefix[] = "anon_inode:";
-
-    const nsCString procPath(aProcPath);
-    DIR* d = opendir(procPath.get());
-    if (!d) {
-      if (NS_WARN_IF(errno != ENOENT)) {
-        return NS_ERROR_FAILURE;
-      }
-      return NS_OK;
-    }
-
-    char linkPath[PATH_MAX + 1];
-    struct dirent* ent;
-    while ((ent = readdir(d))) {
-      const char* fd = ent->d_name;
-
-      // Skip "." and ".." (and any other dotfiles).
-      if (fd[0] == '.') {
-        continue;
-      }
-
-      nsPrintfCString fullPath("%s/%s", procPath.get(), fd);
-      ssize_t linkPathSize = readlink(fullPath.get(), linkPath, PATH_MAX);
-      if (linkPathSize > 0) {
-        linkPath[linkPathSize] = '\0';
-
-#define CHECK_PREFIX(prefix) \
-  (strncmp(linkPath, prefix, sizeof(prefix) - 1) == 0)
-
-        const char* category = nullptr;
-        const char* descriptionPrefix = nullptr;
-
-        if (CHECK_PREFIX(kFilePrefix)) {
-          category = "files"; // No trailing slash, the file path will have one
-          descriptionPrefix = "An open";
-        } else if (CHECK_PREFIX(kSocketPrefix)) {
-          category = "sockets/";
-          descriptionPrefix = "A socket";
-        } else if (CHECK_PREFIX(kPipePrefix)) {
-          category = "pipes/";
-          descriptionPrefix = "A pipe";
-        } else if (CHECK_PREFIX(kAnonInodePrefix)) {
-          category = "anon_inodes/";
-          descriptionPrefix = "An anon_inode";
-        } else {
-          category = "";
-          descriptionPrefix = "An uncategorized";
-        }
-
-#undef CHECK_PREFIX
-
-        const nsCString processName(aProcessName);
-        nsPrintfCString entryPath(
-            "open-fds/%s/%s%s/%s", processName.get(), category, linkPath, fd);
-        nsPrintfCString entryDescription(
-            "%s file descriptor opened by the process", descriptionPrefix);
-        REPORT_WITH_CLEANUP(
-            entryPath, UNITS_COUNT, 1, entryDescription, closedir(d));
-      }
-    }
-
-    closedir(d);
-    return NS_OK;
-  }
-
 #undef REPORT
 };
 
 NS_IMPL_ISUPPORTS(SystemReporter, nsIMemoryReporter)
 
 // Keep this in sync with SystemReporter::ProcessSizeKind!
 const char* SystemReporter::kindPathSuffixes[] = {
     "anonymous/outside-brk",