interception.h revision 6afa1b0406f5cce7256d4f8717bfe394a16999b5
15b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov//===-- interception.h ------------------------------------------*- C++ -*-===// 25b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 35b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// The LLVM Compiler Infrastructure 45b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 55b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// This file is distributed under the University of Illinois Open Source 65b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// License. See LICENSE.TXT for details. 75b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 85b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov//===----------------------------------------------------------------------===// 95b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 105b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// This file is a part of AddressSanitizer, an address sanity checker. 115b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 125b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// Machinery for providing replacements/wrappers for system functions. 135b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov//===----------------------------------------------------------------------===// 145b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 155b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#ifndef INTERCEPTION_H 165b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#define INTERCEPTION_H 175b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 185b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#if !defined(__linux__) && !defined(__APPLE__) && !defined(_WIN32) 195b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# error "Interception doesn't work on this operating system." 205b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#endif 215b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 226afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryany#include "sanitizer/common_interface_defs.h" 236afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryany 246afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryany// These typedefs should be used only in the interceptor definitions to replace 256afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryany// the standard system types (e.g. SSIZE_T instead of ssize_t) 266afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryanytypedef __sanitizer::uptr SIZE_T; 276afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryanytypedef __sanitizer::sptr SSIZE_T; 286afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryanytypedef __sanitizer::u64 OFF_T; 296afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryanytypedef __sanitizer::u64 OFF64_T; 306afa1b0406f5cce7256d4f8717bfe394a16999b5Kostya Serebryany 315b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// How to use this library: 325b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 1) Include this header to define your own interceptors 335b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// (see details below). 345b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 2) Build all *.cc files and link against them. 355b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// On Mac you will also need to: 365b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 3) Provide your own implementation for the following functions: 375b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// mach_error_t __interception::allocate_island(void **ptr, 385b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// size_t size, 395b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// void *hint); 405b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// mach_error_t __interception::deallocate_island(void *ptr); 415b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// See "interception_mac.h" for more details. 425b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 435b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// How to add an interceptor: 445b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// Suppose you need to wrap/replace system function (generally, from libc): 455b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// int foo(const char *bar, double baz); 465b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// You'll need to: 475b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 1) define INTERCEPTOR(int, foo, const char *bar, double baz) { ... } in 485b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// your source file. 495b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 2) Call "INTERCEPT_FUNCTION(foo)" prior to the first call of "foo". 505b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// INTERCEPT_FUNCTION(foo) evaluates to "true" iff the function was 515b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// intercepted successfully. 525b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// You can access original function by calling REAL(foo)(bar, baz). 535b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// By default, REAL(foo) will be visible only inside your interceptor, and if 545b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// you want to use it in other parts of RTL, you'll need to: 55b4fefa713da3dabda1cd83ae4182c71f1683f02cAlexey Samsonov// 3a) add DECLARE_REAL(int, foo, const char*, double) to a 565b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// header file. 575b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// However, if the call "INTERCEPT_FUNCTION(foo)" and definition for 585b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// INTERCEPTOR(..., foo, ...) are in different files, you'll instead need to: 59b4fefa713da3dabda1cd83ae4182c71f1683f02cAlexey Samsonov// 3b) add DECLARE_REAL_AND_INTERCEPTOR(int, foo, const char*, double) 605b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// to a header file. 615b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 625b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// Notes: 1. Things may not work properly if macro INTERCEPT(...) {...} or 63b4fefa713da3dabda1cd83ae4182c71f1683f02cAlexey Samsonov// DECLARE_REAL(...) are located inside namespaces. 645b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// 2. On Mac you can also use: "OVERRIDE_FUNCTION(foo, zoo);" to 655b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// effectively redirect calls from "foo" to "zoo". In this case 665b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// you aren't required to implement 67b4fefa713da3dabda1cd83ae4182c71f1683f02cAlexey Samsonov// INTERCEPTOR(int, foo, const char *bar, double baz) {...} 685b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// but instead you'll have to add 69b4fefa713da3dabda1cd83ae4182c71f1683f02cAlexey Samsonov// DEFINE_REAL(int, foo, const char *bar, double baz) in your 705b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// source file (to define a pointer to overriden function). 715b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 725b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// How it works: 73580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// To replace system functions on Linux we just need to declare functions 745b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// with same names in our library and then obtain the real function pointers 75580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// using dlsym(). 76580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// There is one complication. A user may also intercept some of the functions 77f54c0e3321e2381fca3f02faefaaa6639d59c7cfDmitry Vyukov// we intercept. To resolve this we declare our interceptors with __interceptor_ 78f54c0e3321e2381fca3f02faefaaa6639d59c7cfDmitry Vyukov// prefix, and then make actual interceptors weak aliases to __interceptor_ 79580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// functions. 80580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// This is not so on Mac OS, where the two-level namespace makes 815b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// our replacement functions invisible to other libraries. This may be overcomed 825b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// using the DYLD_FORCE_FLAT_NAMESPACE, but some errors loading the shared 83580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// libraries in Chromium were noticed when doing so. Instead we use 84580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// mach_override, a handy framework for patching functions at runtime. 85580469d7e40e39319cb2d3750edac4bccca18105Dmitry Vyukov// To avoid possible name clashes, our replacement functions have 865b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov// the "wrap_" prefix on Mac. 870ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko// An alternative to function patching is to create a dylib containing a 880ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko// __DATA,__interpose section that associates library functions with their 890ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko// wrappers. When this dylib is preloaded before an executable using 900ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko// DYLD_INSERT_LIBRARIES, it routes all the calls to interposed functions done 910ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko// through stubs to the wrapper functions. Such a library is built with 920ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko// -DMAC_INTERPOSE_FUNCTIONS=1. 930ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko 940ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#if !defined(MAC_INTERPOSE_FUNCTIONS) || !defined(__APPLE__) 950ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define MAC_INTERPOSE_FUNCTIONS 0 960ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#endif 975b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 985b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#if defined(__APPLE__) 995b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define WRAP(x) wrap_##x 1005b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define WRAPPER_NAME(x) "wrap_"#x 1015b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define INTERCEPTOR_ATTRIBUTE 102b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov# define DECLARE_WRAPPER(ret_type, func, ...) 1035b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#elif defined(_WIN32) 1042716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# if defined(_DLL) // DLL CRT 1052716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# define WRAP(x) x 1062716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# define WRAPPER_NAME(x) #x 1072716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# define INTERCEPTOR_ATTRIBUTE 1082716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# else // Static CRT 1092716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# define WRAP(x) wrap_##x 1102716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# define WRAPPER_NAME(x) "wrap_"#x 1112716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# define INTERCEPTOR_ATTRIBUTE 1122716a61d085a8fdf13a099822720e320414cc4dcTimur Iskhodzhanov# endif 113b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov# define DECLARE_WRAPPER(ret_type, func, ...) 1145b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#else 115f54c0e3321e2381fca3f02faefaaa6639d59c7cfDmitry Vyukov# define WRAP(x) __interceptor_ ## x 116f54c0e3321e2381fca3f02faefaaa6639d59c7cfDmitry Vyukov# define WRAPPER_NAME(x) "__interceptor_" #x 1175b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) 118b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov# define DECLARE_WRAPPER(ret_type, func, ...) \ 119b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov extern "C" ret_type func(__VA_ARGS__) \ 120ba362a7f0e98b369758f07aec8794c61e688b82dAlexey Samsonov __attribute__((weak, alias("__interceptor_" #func), visibility("default"))); 1215b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#endif 1225b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 1230ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#if !MAC_INTERPOSE_FUNCTIONS 1240ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define PTR_TO_REAL(x) real_##x 1250ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define REAL(x) __interception::PTR_TO_REAL(x) 1260ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define FUNC_TYPE(x) x##_f 1270ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko 1280ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define DECLARE_REAL(ret_type, func, ...) \ 1290ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \ 1300ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko namespace __interception { \ 1310ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko extern FUNC_TYPE(func) PTR_TO_REAL(func); \ 1320ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko } 1330ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#else // MAC_INTERPOSE_FUNCTIONS 1340ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define REAL(x) x 1350ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko# define DECLARE_REAL(ret_type, func, ...) \ 1360ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko extern "C" ret_type func(__VA_ARGS__); 1370ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#endif // MAC_INTERPOSE_FUNCTIONS 1385b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 1396bae39d1db13f60d3e9b8393e5b9d9eb2ab1b5c0Chandler Carruth#define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \ 140c27279a4a08e0661f204c3e5dc65aafce79dec8aAlexey Samsonov DECLARE_REAL(ret_type, func, __VA_ARGS__) \ 1415b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov extern "C" ret_type WRAP(func)(__VA_ARGS__); 1425b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 143b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov// Generally, you don't need to use DEFINE_REAL by itself, as INTERCEPTOR 144b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov// macros does its job. In exceptional cases you may need to call REAL(foo) 145b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov// without defining INTERCEPTOR(..., foo, ...). For example, if you override 146b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov// foo with an interceptor for other function. 1470ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#if !MAC_INTERPOSE_FUNCTIONS 148b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov# define DEFINE_REAL(ret_type, func, ...) \ 149b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \ 1500ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko namespace __interception { \ 1510ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko FUNC_TYPE(func) PTR_TO_REAL(func); \ 1520ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko } 1530ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#else 154b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov# define DEFINE_REAL(ret_type, func, ...) 1550ef531054fc25c11e372cbab1384f10954984219Alexander Potapenko#endif 156600972e3427173cc8904d741decd1af0ed5de9fdTimur Iskhodzhanov 157b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov#define INTERCEPTOR(ret_type, func, ...) \ 158b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov DEFINE_REAL(ret_type, func, __VA_ARGS__) \ 159b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \ 1605b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov extern "C" \ 1615b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov INTERCEPTOR_ATTRIBUTE \ 162b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov ret_type WRAP(func)(__VA_ARGS__) 163600972e3427173cc8904d741decd1af0ed5de9fdTimur Iskhodzhanov 164600972e3427173cc8904d741decd1af0ed5de9fdTimur Iskhodzhanov#if defined(_WIN32) 165600972e3427173cc8904d741decd1af0ed5de9fdTimur Iskhodzhanov# define INTERCEPTOR_WINAPI(ret_type, func, ...) \ 166b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov typedef ret_type (__stdcall *FUNC_TYPE(func))(__VA_ARGS__); \ 167b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov namespace __interception { \ 168b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov FUNC_TYPE(func) PTR_TO_REAL(func); \ 169b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov } \ 170b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \ 171b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov extern "C" \ 172b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov INTERCEPTOR_ATTRIBUTE \ 173b66bfd1e28776f0a350b9c197926c2c172678603Alexey Samsonov ret_type __stdcall WRAP(func)(__VA_ARGS__) 174600972e3427173cc8904d741decd1af0ed5de9fdTimur Iskhodzhanov#endif 1755b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 176592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov// ISO C++ forbids casting between pointer-to-function and pointer-to-object, 177592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov// so we use casting via an integral type __interception::uptr, 178592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov// assuming that system is POSIX-compliant. Using other hacks seem 179592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov// challenging, as we don't even pass function type to 180592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov// INTERCEPT_FUNCTION macro, only its name. 181592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonovnamespace __interception { 182b46941a1d23012491a7a8a52718cacbde3c19ba1Alexey Samsonov#if defined(_WIN64) 183b46941a1d23012491a7a8a52718cacbde3c19ba1Alexey Samsonovtypedef unsigned long long uptr; // NOLINT 184b46941a1d23012491a7a8a52718cacbde3c19ba1Alexey Samsonov#else 185592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonovtypedef unsigned long uptr; // NOLINT 186b46941a1d23012491a7a8a52718cacbde3c19ba1Alexey Samsonov#endif // _WIN64 187592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov} // namespace __interception 188592d3f707e02968c75fd6e90d06d24f5df99c8b9Alexey Samsonov 1895b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#define INCLUDED_FROM_INTERCEPTION_LIB 1905b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 1915b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#if defined(__linux__) 1925b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# include "interception_linux.h" 1935b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX(func) 1945b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#elif defined(__APPLE__) 1955b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# include "interception_mac.h" 1965b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define OVERRIDE_FUNCTION(old_func, new_func) \ 1975b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov OVERRIDE_FUNCTION_MAC(old_func, new_func) 1985b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func) 1995b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#else // defined(_WIN32) 20007bb9f1e3600195119aec1aae1aa48a6ed2f5febTimur Iskhodzhanov# include "interception_win.h" 20107bb9f1e3600195119aec1aae1aa48a6ed2f5febTimur Iskhodzhanov# define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_WIN(func) 2025b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#endif 2035b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 2045b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#undef INCLUDED_FROM_INTERCEPTION_LIB 2055b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov 2065b29018cf422e7711fb760b733c32127397a43fcAlexey Samsonov#endif // INTERCEPTION_H 207