| Alexey Samsonov | 5b29018 | 2012-02-08 19:52:01 +0000 | [diff] [blame] | 1 | //===-- interception_linux.h ------------------------------------*- 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 | |
| 17 | #if !defined(INCLUDED_FROM_INTERCEPTION_LIB) |
| Timur Iskhodzhanov | e6b9ebb | 2012-02-22 08:56:25 +0000 | [diff] [blame] | 18 | # error "interception_linux.h should be included from interception library only" |
| Alexey Samsonov | 5b29018 | 2012-02-08 19:52:01 +0000 | [diff] [blame] | 19 | #endif |
| 20 | |
| 21 | #ifndef INTERCEPTION_LINUX_H |
| 22 | #define INTERCEPTION_LINUX_H |
| 23 | |
| 24 | namespace __interception { |
| 25 | // returns true if a function with the given name was found. |
| Dmitry Vyukov | 580469d | 2012-05-24 13:54:31 +0000 | [diff] [blame] | 26 | bool GetRealFunctionAddress(const char *func_name, void **func_addr, |
| 27 | void *real, void *wrapper); |
| Alexey Samsonov | 5b29018 | 2012-02-08 19:52:01 +0000 | [diff] [blame] | 28 | } // namespace __interception |
| 29 | |
| 30 | #define INTERCEPT_FUNCTION_LINUX(func) \ |
| Dmitry Vyukov | 580469d | 2012-05-24 13:54:31 +0000 | [diff] [blame] | 31 | ::__interception::GetRealFunctionAddress(#func, (void**)&REAL(func), \ |
| 32 | (void*)&(func), (void*)&WRAP(func)) |
| Alexey Samsonov | 5b29018 | 2012-02-08 19:52:01 +0000 | [diff] [blame] | 33 | |
| 34 | #endif // INTERCEPTION_LINUX_H |
| 35 | #endif // __linux__ |