Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2986)

Unified Diff: base/debug/proc_maps_linux.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/leak_tracker_unittest.cc ('k') | base/debug/proc_maps_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/proc_maps_linux.h
diff --git a/base/debug/proc_maps_linux.h b/base/debug/proc_maps_linux.h
deleted file mode 100644
index 9fbd47898d378407aab5cb6f7b20e96050018883..0000000000000000000000000000000000000000
--- a/base/debug/proc_maps_linux.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_DEBUG_PROC_MAPS_LINUX_H_
-#define BASE_DEBUG_PROC_MAPS_LINUX_H_
-
-#include <string>
-#include <vector>
-
-#include "base/base_export.h"
-#include "base/basictypes.h"
-
-namespace base {
-namespace debug {
-
-// Describes a region of mapped memory and the path of the file mapped.
-struct MappedMemoryRegion {
- enum Permission {
- READ = 1 << 0,
- WRITE = 1 << 1,
- EXECUTE = 1 << 2,
- PRIVATE = 1 << 3, // If set, region is private, otherwise it is shared.
- };
-
- // The address range [start,end) of mapped memory.
- uintptr_t start;
- uintptr_t end;
-
- // Byte offset into |path| of the range mapped into memory.
- unsigned long long offset;
-
- // Bitmask of read/write/execute/private/shared permissions.
- uint8 permissions;
-
- // Name of the file mapped into memory.
- //
- // NOTE: path names aren't guaranteed to point at valid files. For example,
- // "[heap]" and "[stack]" are used to represent the location of the process'
- // heap and stack, respectively.
- std::string path;
-};
-
-// Reads the data from /proc/self/maps and stores the result in |proc_maps|.
-// Returns true if successful, false otherwise.
-//
-// There is *NO* guarantee that the resulting contents will be free of
-// duplicates or even contain valid entries by time the method returns.
-//
-//
-// THE GORY DETAILS
-//
-// Did you know it's next-to-impossible to atomically read the whole contents
-// of /proc/<pid>/maps? You would think that if we passed in a large-enough
-// buffer to read() that It Should Just Work(tm), but sadly that's not the case.
-//
-// Linux's procfs uses seq_file [1] for handling iteration, text formatting,
-// and dealing with resulting data that is larger than the size of a page. That
-// last bit is especially important because it means that seq_file will never
-// return more than the size of a page in a single call to read().
-//
-// Unfortunately for a program like Chrome the size of /proc/self/maps is
-// larger than the size of page so we're forced to call read() multiple times.
-// If the virtual memory table changed in any way between calls to read() (e.g.,
-// a different thread calling mprotect()), it can make seq_file generate
-// duplicate entries or skip entries.
-//
-// Even if seq_file was changed to keep flushing the contents of its page-sized
-// buffer to the usermode buffer inside a single call to read(), it has to
-// release its lock on the virtual memory table to handle page faults while
-// copying data to usermode. This puts us in the same situation where the table
-// can change while we're copying data.
-//
-// Alternatives such as fork()-and-suspend-the-parent-while-child-reads were
-// attempted, but they present more subtle problems than it's worth. Depending
-// on your use case your best bet may be to read /proc/<pid>/maps prior to
-// starting other threads.
-//
-// [1] http://kernelnewbies.org/Documents/SeqFileHowTo
-BASE_EXPORT bool ReadProcMaps(std::string* proc_maps);
-
-// Parses /proc/<pid>/maps input data and stores in |regions|. Returns true
-// and updates |regions| if and only if all of |input| was successfully parsed.
-BASE_EXPORT bool ParseProcMaps(const std::string& input,
- std::vector<MappedMemoryRegion>* regions);
-
-} // namespace debug
-} // namespace base
-
-#endif // BASE_DEBUG_PROC_MAPS_LINUX_H_
« no previous file with comments | « base/debug/leak_tracker_unittest.cc ('k') | base/debug/proc_maps_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698