Commit 7d367a68 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

Dead code: countLoadedElfFiles

Summary: [Folly] Cut dead code: `countLoadedElfFiles()`.

Differential Revision: D21910945

fbshipit-source-id: 43ff7d118b4876e2cbd4527713c8552963810537
parent 35ff8b26
......@@ -16,44 +16,14 @@
#include <folly/experimental/symbolizer/ElfCache.h>
#include <link.h>
#include <signal.h>
#include <folly/ScopeGuard.h>
#include <folly/portability/SysMman.h>
/*
* This is declared in `link.h' on Linux platforms, but apparently not on the
* Mac version of the file. It's harmless to declare again, in any case.
*
* Note that declaring it with `extern "C"` results in linkage conflicts.
*/
extern struct r_debug _r_debug;
namespace folly {
namespace symbolizer {
size_t countLoadedElfFiles() {
// _r_debug synchronization is... lacking to say the least. It's
// meant as an aid for debuggers and synchronization is done by
// calling dl_debug_state() which debuggers are supposed to
// intercept by setting a breakpoint on.
// Can't really do that here, so we apply the hope-and-pray strategy.
if (_r_debug.r_version != 1 || _r_debug.r_state != r_debug::RT_CONSISTENT) {
// computo ergo sum
return 1;
}
// r_map -> head of a linked list of 'link_map_t' entries,
// one per ELF 'binary' in the process address space.
size_t count = 0;
for (auto lmap = _r_debug.r_map; lmap != nullptr; lmap = lmap->l_next) {
++count;
}
return count;
}
std::shared_ptr<ElfFile> SignalSafeElfCache::getFile(StringPiece p) {
struct cmp {
bool operator()(Entry const& a, StringPiece b) const noexcept {
......
......@@ -32,11 +32,6 @@
namespace folly {
namespace symbolizer {
/**
* Number of ELF files loaded by the dynamic loader.
*/
size_t countLoadedElfFiles();
class ElfCacheBase {
public:
virtual std::shared_ptr<ElfFile> getFile(StringPiece path) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment