Bug 1087245 part 1 - Allow replace-malloc libraries to register debug file handles to poison IO interposer. r=nfroyd

This commit is contained in:
Mike Hommey
2014-11-18 19:21:06 +09:00
parent 42980011ad
commit ef330c5eee
5 changed files with 97 additions and 11 deletions

View File

@@ -32,6 +32,10 @@
#include <dlfcn.h>
#include <fcntl.h>
#ifdef MOZ_REPLACE_MALLOC
#include "replace_malloc_bridge.h"
#endif
namespace {
using namespace mozilla;
@@ -342,6 +346,14 @@ InitPoisonIOInterposer()
MozillaRegisterDebugFD(1);
MozillaRegisterDebugFD(2);
#ifdef MOZ_REPLACE_MALLOC
// The contract with InitDebugFd is that the given registry can be used
// at any moment, so the instance needs to persist longer than the scope
// of this functions.
static DebugFdRegistry registry;
ReplaceMalloc::InitDebugFd(registry);
#endif
for (int i = 0; i < NumFunctions; ++i) {
FuncData* d = Functions[i];
if (!d->Function) {