ap_config.inc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. { Copyright 1999-2005 The Apache Software Foundation or its licensors, as
  2. * applicable.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. }
  16. {#include "apr.h"
  17. #include "apr_hooks.h"
  18. #include "apr_optional_hooks.h"}
  19. {
  20. * @file ap_config.h
  21. * @brief Symbol export macros and hook functions
  22. }
  23. { Although this file doesn't declare any hooks, declare the hook group here }
  24. { @defgroup hooks Apache Hooks }
  25. {$ifdef DOXYGEN}
  26. { define these just so doxygen documents them }
  27. {
  28. * AP_DECLARE_STATIC is defined when including Apache's Core headers,
  29. * to provide static linkage when the dynamic library may be unavailable.
  30. *
  31. * @see AP_DECLARE_EXPORT
  32. *
  33. * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
  34. * including Apache's Core headers, to import and link the symbols from the
  35. * dynamic Apache Core library and assure appropriate indirection and calling
  36. * conventions at compile time.
  37. }
  38. {$define AP_DECLARE_STATIC}
  39. {
  40. * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
  41. * library, so that all public symbols are exported.
  42. *
  43. * @see AP_DECLARE_STATIC
  44. }
  45. {$define AP_DECLARE_EXPORT}
  46. {$endif} { def DOXYGEN }
  47. //#if !defined(WIN32)
  48. {
  49. * Apache Core dso functions are declared with AP_DECLARE(), so they may
  50. * use the most appropriate calling convention. Hook functions and other
  51. * Core functions with variable arguments must use AP_DECLARE_NONSTD().
  52. * @code
  53. * AP_DECLARE(rettype) ap_func(args)
  54. * @endcode
  55. }
  56. //#define AP_DECLARE(type) type
  57. {
  58. * Apache Core dso variable argument and hook functions are declared with
  59. * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
  60. * @see AP_DECLARE
  61. * @code
  62. * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
  63. * @endcode
  64. }
  65. //#define AP_DECLARE_NONSTD(type) type
  66. {
  67. * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
  68. * This assures the appropriate indirection is invoked at compile time.
  69. *
  70. * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
  71. * declarations within headers to properly import the variable.
  72. * @code
  73. * AP_DECLARE_DATA type apr_variable
  74. * @endcode
  75. }
  76. {#define AP_DECLARE_DATA
  77. #elif defined(AP_DECLARE_STATIC)
  78. #define AP_DECLARE(type) type __stdcall
  79. #define AP_DECLARE_NONSTD(type) type
  80. #define AP_DECLARE_DATA
  81. #elif defined(AP_DECLARE_EXPORT)
  82. #define AP_DECLARE(type) __declspec(dllexport) type __stdcall
  83. #define AP_DECLARE_NONSTD(type) __declspec(dllexport) type
  84. #define AP_DECLARE_DATA __declspec(dllexport)
  85. #else
  86. #define AP_DECLARE(type) __declspec(dllimport) type __stdcall
  87. #define AP_DECLARE_NONSTD(type) __declspec(dllimport) type
  88. #define AP_DECLARE_DATA __declspec(dllimport)
  89. #endif
  90. #if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)}
  91. {
  92. * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
  93. *
  94. * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
  95. * declared with AP_MODULE_DECLARE_DATA are always exported.
  96. * @code
  97. * module AP_MODULE_DECLARE_DATA mod_tag
  98. * @endcode
  99. }
  100. {#if defined(WIN32)
  101. #define AP_MODULE_DECLARE(type) type __stdcall
  102. #else
  103. #define AP_MODULE_DECLARE(type) type
  104. #endif
  105. #define AP_MODULE_DECLARE_NONSTD(type) type
  106. #define AP_MODULE_DECLARE_DATA
  107. #else}
  108. {
  109. * AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the
  110. * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
  111. *
  112. * The old SHARED_MODULE compile-time symbol is now the default behavior,
  113. * so it is no longer referenced anywhere with Apache 2.0.
  114. }
  115. {#define AP_MODULE_DECLARE_EXPORT
  116. #define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall
  117. #define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type
  118. #define AP_MODULE_DECLARE_DATA __declspec(dllexport)
  119. #endif}
  120. {
  121. * Declare a hook function
  122. * @param ret The return type of the hook
  123. * @param name The hook's name (as a literal)
  124. * @param args The arguments the hook function takes, in brackets.
  125. }
  126. {#define AP_DECLARE_HOOK(ret,name,args) \
  127. APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
  128. }
  129. { @internal }
  130. {#define AP_IMPLEMENT_HOOK_BASE(name) \
  131. APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
  132. }
  133. {
  134. * Implement an Apache core hook that has no return code, and
  135. * therefore runs all of the registered functions. The implementation
  136. * is called ap_run_<i>name</i>.
  137. *
  138. * @param name The name of the hook
  139. * @param args_decl The declaration of the arguments for the hook, for example
  140. * "(int x,void *y)"
  141. * @param args_use The arguments for the hook as used in a call, for example
  142. * "(x,y)"
  143. * @note If IMPLEMENTing a hook that is not linked into the Apache core,
  144. * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
  145. }
  146. {#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
  147. APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
  148. }
  149. {
  150. * Implement an Apache core hook that runs until one of the functions
  151. * returns something other than ok or decline. That return value is
  152. * then returned from the hook runner. If the hooks run to completion,
  153. * then ok is returned. Note that if no hook runs it would probably be
  154. * more correct to return decline, but this currently does not do
  155. * so. The implementation is called ap_run_<i>name</i>.
  156. *
  157. * @param ret The return type of the hook (and the hook runner)
  158. * @param name The name of the hook
  159. * @param args_decl The declaration of the arguments for the hook, for example
  160. * "(int x,void *y)"
  161. * @param args_use The arguments for the hook as used in a call, for example
  162. * "(x,y)"
  163. * @param ok The "ok" return value
  164. * @param decline The "decline" return value
  165. * @return ok, decline or an error.
  166. * @note If IMPLEMENTing a hook that is not linked into the Apache core,
  167. * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
  168. }
  169. {#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
  170. APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
  171. args_use,ok,decline)
  172. }
  173. {
  174. * Implement a hook that runs until a function returns something other than
  175. * decline. If all functions return decline, the hook runner returns decline.
  176. * The implementation is called ap_run_<i>name</i>.
  177. *
  178. * @param ret The return type of the hook (and the hook runner)
  179. * @param name The name of the hook
  180. * @param args_decl The declaration of the arguments for the hook, for example
  181. * "(int x,void *y)"
  182. * @param args_use The arguments for the hook as used in a call, for example
  183. * "(x,y)"
  184. * @param decline The "decline" return value
  185. * @return decline or an error.
  186. * @note If IMPLEMENTing a hook that is not linked into the Apache core
  187. * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
  188. }
  189. {#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
  190. APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
  191. args_use,decline)
  192. }
  193. { Note that the other optional hook implementations are straightforward but
  194. * have not yet been needed
  195. }
  196. {
  197. * Implement an optional hook. This is exactly the same as a standard hook
  198. * implementation, except the hook is optional.
  199. * @see AP_IMPLEMENT_HOOK_RUN_ALL
  200. }
  201. {#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
  202. decline) \
  203. APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
  204. args_use,ok,decline)
  205. }
  206. {
  207. * Hook an optional hook. Unlike static hooks, this uses a macro instead of a
  208. * function.
  209. }
  210. {#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
  211. APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
  212. #include "os.h"
  213. #if !defined(WIN32) && !defined(NETWARE)
  214. #include "ap_config_auto.h"
  215. #include "ap_config_layout.h"
  216. #endif
  217. #if defined(NETWARE)
  218. #define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
  219. #endif}
  220. { TODO - We need to put OS detection back to make all the following work }
  221. {$if defined(SUNOS) or defined(IRIX) or defined(NEXT) or defined(AUX)
  222. or defined (UW) or defined(LYNXOS) or defined(TPF)}
  223. { These systems don't do well with any lingering close code; I don't know
  224. * why -- manoj }
  225. {$define NO_LINGCLOSE}
  226. {$endif}
  227. { If APR has OTHER_CHILD logic, use reliable piped logs. }
  228. {$ifdef APR_HAS_OTHER_CHILD}
  229. {$define AP_HAVE_RELIABLE_PIPED_LOGS}
  230. {$endif}