xref: /netbsd-src/external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 //===-- interception_linux.h ------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of AddressSanitizer, an address sanity checker.
9 //
10 // Linux-specific interception methods.
11 //===----------------------------------------------------------------------===//
12 
13 #ifdef __linux__
14 
15 #if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
16 # error "interception_linux.h should be included from interception library only"
17 #endif
18 
19 #ifndef INTERCEPTION_LINUX_H
20 #define INTERCEPTION_LINUX_H
21 
22 namespace __interception {
23 // returns true if a function with the given name was found.
24 bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
25     uptr real, uptr wrapper);
26 }  // namespace __interception
27 
28 #define INTERCEPT_FUNCTION_LINUX(func) \
29     ::__interception::GetRealFunctionAddress( \
30           #func, (::__interception::uptr*)&REAL(func), \
31           (::__interception::uptr)&(func), \
32           (::__interception::uptr)&WRAP(func))
33 
34 #endif  // INTERCEPTION_LINUX_H
35 #endif  // __linux__
36