blob: 37e593323d222a10d36a5fa56911b36be80a7cbd [file] [log] [blame]
Alexey Samsonov8489f2a2012-02-08 19:52:01 +00001//===-- interception_linux.cc -----------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is a part of AddressSanitizer, an address sanity checker.
11//
12// Linux-specific interception methods.
13//===----------------------------------------------------------------------===//
14
15#ifdef __linux__
16
Alexander Potapenko234d8c22012-02-13 17:11:19 +000017#include <stddef.h> // for NULL
18#include <dlfcn.h> // for dlsym
Alexey Samsonov8489f2a2012-02-08 19:52:01 +000019
20namespace __interception {
Dmitry Vyukov7fb73302012-05-24 13:54:31 +000021bool GetRealFunctionAddress(const char *func_name, void **func_addr,
22 void *real, void *wrapper) {
Alexey Samsonov8489f2a2012-02-08 19:52:01 +000023 *func_addr = dlsym(RTLD_NEXT, func_name);
Dmitry Vyukov7fb73302012-05-24 13:54:31 +000024 return real == wrapper;
Alexey Samsonov8489f2a2012-02-08 19:52:01 +000025}
26} // namespace __interception
27
28
29#endif // __linux__