Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

This commit was manufactured by cvs2svn to create tag 'NEWS'.

  • Loading branch information...
commit 3e94ce6a9723f0662a0a4fb57021c1a0ea1fe158 1 parent 9961494
SVN Migration authored
Showing with 0 additions and 41,939 deletions.
  1. +0 −26 TSRM/LICENSE
  2. +0 −6 TSRM/Makefile.am
  3. +0 −2  TSRM/TODO
  4. +0 −764 TSRM/TSRM.c
  5. +0 −186 TSRM/TSRM.dsp
  6. +0 −177 TSRM/TSRM.h
  7. +0 −1  TSRM/acconfig.h
  8. +0 −5 TSRM/acinclude.m4
  9. +0 −43 TSRM/build.mk
  10. +0 −33 TSRM/buildconf
  11. +0 −10 TSRM/config.w32
  12. +0 −31 TSRM/configure.in
  13. +0 −47 TSRM/readdir.h
  14. +0 −173 TSRM/threads.m4
  15. +0 −128 TSRM/tsrm.m4
  16. +0 −20 TSRM/tsrm_config.w32.h
  17. +0 −62 TSRM/tsrm_config_common.h
  18. +0 −240 TSRM/tsrm_nw.c
  19. +0 −29 TSRM/tsrm_nw.h
  20. +0 −63 TSRM/tsrm_strtok_r.c
  21. +0 −6 TSRM/tsrm_strtok_r.h
  22. +0 −1,317 TSRM/tsrm_virtual_cwd.c
  23. +0 −310 TSRM/tsrm_virtual_cwd.h
  24. +0 −397 TSRM/tsrm_win32.c
  25. +0 −106 TSRM/tsrm_win32.h
  26. +0 −22,097 Zend/ChangeLog
  27. +0 −186 Zend/FlexLexer.h
  28. +0 −56 Zend/LICENSE
  29. +0 −54 Zend/Makefile.am
  30. +0 −1  Zend/Makefile.frag
  31. +0 −195 Zend/OBJECTS2_HOWTO
  32. +0 −34 Zend/README.ZEND_MM
  33. +0 −108 Zend/README.ZEND_VM
  34. +0 −136 Zend/RFCs/001.txt
  35. +0 −169 Zend/RFCs/002.txt
  36. +0 −72 Zend/RFCs/003.txt
  37. +0 −1,166 Zend/ZEND_CHANGES
  38. +0 −594 Zend/Zend.dsp
  39. +0 −390 Zend/Zend.m4
  40. +0 −258 Zend/ZendCore.dep
  41. +0 −728 Zend/ZendTS.dsp
  42. +0 −121 Zend/acconfig.h
  43. +0 −107 Zend/acinclude.m4
  44. +0 −420 Zend/bench.php
  45. +0 −43 Zend/build.mk
  46. +0 −33 Zend/buildconf
  47. +0 −51 Zend/configure.in
  48. +0 −1,648 Zend/flex.skl
  49. +0 −19 Zend/header
  50. +0 −54 Zend/tests/001.phpt
  51. +0 −108 Zend/tests/002.phpt
  52. +0 −81 Zend/tests/003.phpt
  53. +0 −25 Zend/tests/004.phpt
  54. +0 −27 Zend/tests/005.phpt
  55. +0 −31 Zend/tests/006.phpt
  56. +0 −63 Zend/tests/007.phpt
  57. +0 −53 Zend/tests/008.phpt
  58. +0 −46 Zend/tests/009.phpt
  59. +0 −59 Zend/tests/010.phpt
  60. +0 −89 Zend/tests/011.phpt
  61. +0 −34 Zend/tests/012.phpt
  62. +0 −34 Zend/tests/013.phpt
  63. +0 −3  Zend/tests/014.inc
  64. +0 −52 Zend/tests/014.phpt
  65. +0 −35 Zend/tests/015.phpt
  66. +0 −12 Zend/tests/016.phpt
  67. +0 −86 Zend/tests/017.phpt
  68. +0 −36 Zend/tests/018.phpt
  69. +0 −1,332 Zend/tests/019.phpt
  70. +0 −31 Zend/tests/020.phpt
  71. +0 −14 Zend/tests/abstract-static.phpt
  72. +0 −73 Zend/tests/add_001.phpt
  73. +0 −19 Zend/tests/add_002.phpt
  74. +0 −19 Zend/tests/add_003.phpt
  75. +0 −14 Zend/tests/add_004.phpt
  76. +0 −22 Zend/tests/add_005.phpt
  77. +0 −49 Zend/tests/add_006.phpt
  78. +0 −16 Zend/tests/add_007.phpt
  79. +0 −39 Zend/tests/and_001.phpt
  80. +0 −16 Zend/tests/array_append_COW.phpt
  81. +0 −15 Zend/tests/array_type_hint_001.phpt
  82. +0 −16 Zend/tests/array_unshift_COW.phpt
  83. +0 −22 Zend/tests/bug19859.phpt
  84. +0 −43 Zend/tests/bug20240.phpt
  85. +0 −26 Zend/tests/bug20242.phpt
  86. +0 −37 Zend/tests/bug21478.phpt
  87. +0 −36 Zend/tests/bug21888.phpt
  88. +0 −31 Zend/tests/bug22725.phpt
  89. +0 −34 Zend/tests/bug22836.phpt
  90. +0 −12 Zend/tests/bug23104.phpt
  91. +0 −24 Zend/tests/bug24436.phpt
  92. +0 −30 Zend/tests/bug24635.phpt
  93. +0 −13 Zend/tests/bug24699.phpt
  94. +0 −9 Zend/tests/bug24773.phpt
  95. +0 −28 Zend/tests/bug24884.phpt
  96. +0 −19 Zend/tests/bug26010.phpt
  97. +0 −9 Zend/tests/bug26077.phpt
  98. +0 −74 Zend/tests/bug26166.phpt
  99. +0 −29 Zend/tests/bug26229.phpt
  100. +0 −13 Zend/tests/bug26281.phpt
  101. +0 −22 Zend/tests/bug26696.phpt
  102. +0 −24 Zend/tests/bug26697.phpt
  103. +0 −73 Zend/tests/bug26698.phpt
  104. +0 −22 Zend/tests/bug26801.phpt
  105. +0 −37 Zend/tests/bug26802.phpt
  106. +0 −28 Zend/tests/bug27268.phpt
  107. +0 −23 Zend/tests/bug27304.phpt
  108. +0 −12 Zend/tests/bug27598.phpt
  109. +0 −18 Zend/tests/bug27669.phpt
  110. +0 −10 Zend/tests/bug27731.phpt
  111. +0 −72 Zend/tests/bug27798.phpt
  112. +0 −46 Zend/tests/bug28072.phpt
  113. +0 −23 Zend/tests/bug28377.phpt
  114. +0 −65 Zend/tests/bug28442.phpt
  115. +0 −81 Zend/tests/bug28444.phpt
  116. +0 −11 Zend/tests/bug29015.phpt
  117. +0 −27 Zend/tests/bug29104.phpt
  118. +0 −104 Zend/tests/bug29210.phpt
  119. +0 −34 Zend/tests/bug29368.phpt
  120. +0 −31 Zend/tests/bug29505.phpt
  121. +0 −41 Zend/tests/bug29674.phpt
  122. +0 −62 Zend/tests/bug29689.phpt
  123. +0 −13 Zend/tests/bug29883.phpt
  124. +0 −23 Zend/tests/bug29890.phpt
  125. +0 −28 Zend/tests/bug29896.phpt
  126. +0 −16 Zend/tests/bug29944.phpt
  127. +0 −18 Zend/tests/bug30080.phpt
  128. +0 −30 Zend/tests/bug30140.phpt
  129. +0 −34 Zend/tests/bug30161.phpt
  130. +0 −52 Zend/tests/bug30162.phpt
  131. +0 −40 Zend/tests/bug30332.phpt
  132. +0 −24 Zend/tests/bug30346.phpt
  133. +0 −30 Zend/tests/bug30394.phpt
  134. +0 −18 Zend/tests/bug30407.phpt
  135. +0 −36 Zend/tests/bug30451.phpt
  136. +0 −10 Zend/tests/bug30519.phpt
  137. +0 −39 Zend/tests/bug30702.phpt
  138. +0 −29 Zend/tests/bug30707.phpt
  139. +0 −32 Zend/tests/bug30725.phpt
  140. +0 −35 Zend/tests/bug30791.phpt
  141. +0 −27 Zend/tests/bug30820.phpt
  142. +0 −61 Zend/tests/bug30828.phpt
  143. +0 −31 Zend/tests/bug30889.phpt
  144. +0 −13 Zend/tests/bug30922.phpt
  145. +0 −21 Zend/tests/bug30998.phpt
  146. +0 −53 Zend/tests/bug31098.phpt
  147. +0 −48 Zend/tests/bug31102.phpt
  148. +0 −18 Zend/tests/bug31177-2.phpt
  149. +0 −44 Zend/tests/bug31177.phpt
  150. +0 −29 Zend/tests/bug31341.phpt
  151. +0 −22 Zend/tests/bug31525.phpt
  152. +0 −97 Zend/tests/bug31683.phpt
  153. +0 −16 Zend/tests/bug31720.phpt
  154. +0 −25 Zend/tests/bug31828.phpt
  155. +0 −18 Zend/tests/bug32080.phpt
  156. +0 −36 Zend/tests/bug32226.phpt
  157. +0 −47 Zend/tests/bug32252.phpt
  158. +0 −126 Zend/tests/bug32290.phpt
  159. +0 −60 Zend/tests/bug32296.phpt
  160. +0 −80 Zend/tests/bug32322.phpt
  161. +0 −19 Zend/tests/bug32427.phpt
  162. +0 −13 Zend/tests/bug32428.phpt
  163. +0 −28 Zend/tests/bug32429.phpt
  164. +0 −27 Zend/tests/bug32596.phpt
  165. +0 −39 Zend/tests/bug32660.phpt
  166. +0 −62 Zend/tests/bug32674.phpt
  167. +0 −21 Zend/tests/bug32799.phpt
  168. +0 −10 Zend/tests/bug32833.phpt
  169. +0 −38 Zend/tests/bug32852.phpt
  170. +0 −29 Zend/tests/bug32993.phpt
  171. +0 −22 Zend/tests/bug33116.phpt
  172. +0 −27 Zend/tests/bug33171.phpt
  173. +0 −25 Zend/tests/bug33243.phpt
  174. +0 −25 Zend/tests/bug33257.phpt
  175. +0 −28 Zend/tests/bug33277.phpt
  176. +0 −19 Zend/tests/bug33282.phpt
  177. +0 −8 Zend/tests/bug33318.phpt
  178. +0 −66 Zend/tests/bug33512.phpt
  179. +0 −21 Zend/tests/bug33558.phpt
  180. +0 −32 Zend/tests/bug33710.phpt
  181. +0 −45 Zend/tests/bug33732.phpt
  182. +0 −40 Zend/tests/bug33771.phpt
  183. +0 −22 Zend/tests/bug33802.phpt
  184. +0 −29 Zend/tests/bug33996.phpt
  185. +0 −30 Zend/tests/bug33999.phpt
  186. +0 −28 Zend/tests/bug34045.phpt
  187. +0 −24 Zend/tests/bug34062.phpt
  188. +0 −35 Zend/tests/bug34064.phpt
  189. +0 −15 Zend/tests/bug34065.phpt
  190. +0 −10 Zend/tests/bug34137.phpt
  191. +0 −18 Zend/tests/bug34199.phpt
  192. +0 −36 Zend/tests/bug34260.phpt
  193. +0 −34 Zend/tests/bug34310.phpt
  194. +0 −15 Zend/tests/bug34358.phpt
  195. +0 −27 Zend/tests/bug34467.phpt
  196. +0 −38 Zend/tests/bug34518.phpt
  197. +0 −18 Zend/tests/bug34617.phpt
  198. +0 −25 Zend/tests/bug34678.phpt
  199. +0 −28 Zend/tests/bug34712.phpt
  200. +0 −33 Zend/tests/bug34767.phpt
  201. +0 −22 Zend/tests/bug34786.phpt
  202. +0 −27 Zend/tests/bug34873.phpt
  203. +0 −11 Zend/tests/bug34879.phpt
  204. +0 −33 Zend/tests/bug34893.phpt
  205. +0 −21 Zend/tests/bug35017.phpt
  206. +0 −14 Zend/tests/bug35106.phpt
  207. +0 −41 Zend/tests/bug35239.phpt
  208. +0 −30 Zend/tests/bug35393.phpt
  209. +0 −19 Zend/tests/bug35411.phpt
  210. +0 −27 Zend/tests/bug35437.phpt
  211. +0 −11 Zend/tests/bug35470.phpt
  212. +0 −31 Zend/tests/bug35509.phpt
  213. +0 −36 Zend/tests/bug35634.phpt
  214. +0 −25 Zend/tests/bug35655.phpt
  215. +0 −30 Zend/tests/bug36006.phpt
  216. +0 −14 Zend/tests/bug36037.phpt
  217. +0 −11 Zend/tests/bug36071.phpt
  218. +0 −54 Zend/tests/bug36214.phpt
  219. +0 −14 Zend/tests/bug36268.phpt
  220. +0 −12 Zend/tests/bug36303.phpt
  221. +0 −22 Zend/tests/bug36513.phpt
  222. +0 −15 Zend/tests/bug36568.phpt
  223. +0 −27 Zend/tests/bug36759.phpt
  224. +0 −23 Zend/tests/bug37046.phpt
  225. +0 −21 Zend/tests/bug37138.phpt
  226. +0 −16 Zend/tests/bug37144.phpt
  227. +0 −55 Zend/tests/bug37212.phpt
  228. +0 −135 Zend/tests/bug37632.phpt
  229. +0 −53 Zend/tests/bug37667.phpt
  230. +0 −16 Zend/tests/bug37707.phpt
  231. +0 −29 Zend/tests/bug37715.phpt
  232. +0 −28 Zend/tests/bug37811.phpt
  233. +0 −50 Zend/tests/bug38047.phpt
  234. +0 −19 Zend/tests/bug38146.phpt
  235. +0 −10 Zend/tests/bug38211.phpt
  236. +0 −92 Zend/tests/bug38220.phpt
  237. +0 −18 Zend/tests/bug38234.phpt
  238. +0 −45 Zend/tests/bug38287.phpt
  239. +0 −25 Zend/tests/bug38461.phpt
  240. +0 −54 Zend/tests/bug38469.phpt
  241. +0 −16 Zend/tests/bug38623.phpt
  242. +0 −34 Zend/tests/bug38624.phpt
  243. +0 −42 Zend/tests/bug38772.phpt
  244. +0 −29 Zend/tests/bug38779.phpt
  245. +0 −45 Zend/tests/bug38779_1.phpt
  246. +0 −17 Zend/tests/bug38808.phpt
  247. +0 −17 Zend/tests/bug38942.phpt
  248. +0 −24 Zend/tests/bug39003.phpt
  249. +0 −11 Zend/tests/bug39017.phpt
  250. +0 −19 Zend/tests/bug39036.phpt
  251. +0 −45 Zend/tests/bug39297.phpt
  252. +0 −9 Zend/tests/bug39304.phpt
  253. +0 −45 Zend/tests/bug39438.phpt
  254. +0 −16 Zend/tests/bug39445.phpt
  255. +0 −40 Zend/tests/bug39449.phpt
  256. +0 −24 Zend/tests/bug39542.phpt
  257. +0 −7 Zend/tests/bug39542/bug39542.php
  258. +0 −15 Zend/tests/bug39602.phpt
  259. +0 −30 Zend/tests/bug39721.phpt
  260. +0 −20 Zend/tests/bug39775.phpt
  261. +0 −13 Zend/tests/bug39825.phpt
  262. +0 −88 Zend/tests/bug39944.phpt
  263. +0 −17 Zend/tests/bug39990.phpt
  264. +0 −10 Zend/tests/bug40236.inc
  265. +0 −17 Zend/tests/bug40236.phpt
  266. +0 −25 Zend/tests/bug40261.phpt
  267. +0 −26 Zend/tests/bug40509.phpt
  268. +0 −20 Zend/tests/bug40621.phpt
  269. +0 −26 Zend/tests/bug40705.phpt
  270. +0 −28 Zend/tests/bug40757.phpt
  271. +0 −22 Zend/tests/bug40770.phpt
  272. +0 −24 Zend/tests/bug40784.phpt
  273. +0 −33 Zend/tests/bug40809.phpt
  274. +0 −18 Zend/tests/bug40815.phpt
  275. +0 −72 Zend/tests/bug40833.phpt
  276. +0 −9 Zend/tests/bug40899.phpt
  277. +0 −26 Zend/tests/bug41026.phpt
  278. +0 −31 Zend/tests/bug41075.phpt
  279. +0 −14 Zend/tests/bug41117_1.phpt
  280. +0 −46 Zend/tests/bug41209.phpt
  281. +0 −14 Zend/tests/bug41351.phpt
  282. +0 −14 Zend/tests/bug41351_2.phpt
  283. +0 −14 Zend/tests/bug41351_3.phpt
  284. +0 −13 Zend/tests/bug41372.phpt
  285. +0 −10 Zend/tests/bug41401.phpt
  286. +0 −29 Zend/tests/bug41421.phpt
  287. +0 −12 Zend/tests/bug41633_1.phpt
  288. +0 −11 Zend/tests/bug41633_2.phpt
  289. +0 −12 Zend/tests/bug41633_3.phpt
  290. +0 −12 Zend/tests/bug41633_4.phpt
  291. +0 −15 Zend/tests/bug41640.phpt
  292. +0 −12 Zend/tests/bug41813.phpt
  293. +0 −11 Zend/tests/bug41919.phpt
  294. +0 −24 Zend/tests/bug41929.phpt
  295. +0 −29 Zend/tests/bug41961.phpt
  296. +0 −19 Zend/tests/bug42119.phpt
  297. +0 −30 Zend/tests/bug42211.phpt
  298. +0 −11 Zend/tests/bug42767.phpt
  299. +0 −18 Zend/tests/bug42772.phpt
  300. +0 −9 Zend/tests/bug42817.phpt
Sorry, we could not display the entire diff because too many files (9,485) changed.
View
26 TSRM/LICENSE
@@ -1,26 +0,0 @@
-Copyright (c) 1999-2006, Andi Gutmans, Sascha Schumann, Zeev Suraski.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-
-- Neither name of the copyright holders nor the names of their contributors
-may be used to endorse or promote products derived from this software
-without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
6 TSRM/Makefile.am
@@ -1,6 +0,0 @@
-## process this file with automake to produce Makefile.am
-AUTOMAKE_OPTIONS=foreign
-noinst_LTLIBRARIES=libtsrm.la
-libtsrm_la_SOURCES = TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c
-
-depend:
View
2  TSRM/TODO
@@ -1,2 +0,0 @@
-- Improve the lock in ts_resource_ex() in order to cover less code.
- This can probably be done by more careful hash table access
View
764 TSRM/TSRM.c
@@ -1,764 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Thread Safe Resource Manager |
- +----------------------------------------------------------------------+
- | Copyright (c) 1999-2008, Andi Gutmans, Sascha Schumann, Zeev Suraski |
- | This source file is subject to the TSRM license, that is bundled |
- | with this package in the file LICENSE |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "TSRM.h"
-
-#ifdef ZTS
-
-#include <stdio.h>
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-typedef struct _tsrm_tls_entry tsrm_tls_entry;
-
-struct _tsrm_tls_entry {
- void **storage;
- int count;
- THREAD_T thread_id;
- tsrm_tls_entry *next;
-};
-
-
-typedef struct {
- size_t size;
- ts_allocate_ctor ctor;
- ts_allocate_dtor dtor;
- int done;
-} tsrm_resource_type;
-
-
-/* The memory manager table */
-static tsrm_tls_entry **tsrm_tls_table=NULL;
-static int tsrm_tls_table_size;
-static ts_rsrc_id id_count;
-
-/* The resource sizes table */
-static tsrm_resource_type *resource_types_table=NULL;
-static int resource_types_table_size;
-
-
-static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */
-
-/* New thread handlers */
-static tsrm_thread_begin_func_t tsrm_new_thread_begin_handler;
-static tsrm_thread_end_func_t tsrm_new_thread_end_handler;
-
-/* Debug support */
-int tsrm_error(int level, const char *format, ...);
-
-/* Read a resource from a thread's resource storage */
-static int tsrm_error_level;
-static FILE *tsrm_error_file;
-
-#if TSRM_DEBUG
-#define TSRM_ERROR(args) tsrm_error args
-#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
- { \
- int unshuffled_offset = TSRM_UNSHUFFLE_RSRC_ID(offset); \
- \
- if (offset==0) { \
- return &array; \
- } else if ((unshuffled_offset)>=0 && (unshuffled_offset)<(range)) { \
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Successfully fetched resource id %d for thread id %ld - 0x%0.8X", \
- unshuffled_offset, (long) thread_resources->thread_id, array[unshuffled_offset])); \
- return array[unshuffled_offset]; \
- } else { \
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Resource id %d is out of range (%d..%d)", \
- unshuffled_offset, TSRM_SHUFFLE_RSRC_ID(0), TSRM_SHUFFLE_RSRC_ID(thread_resources->count-1))); \
- return NULL; \
- } \
- }
-#else
-#define TSRM_ERROR(args)
-#define TSRM_SAFE_RETURN_RSRC(array, offset, range) \
- if (offset==0) { \
- return &array; \
- } else { \
- return array[TSRM_UNSHUFFLE_RSRC_ID(offset)]; \
- }
-#endif
-
-#if defined(PTHREADS)
-/* Thread local storage */
-static pthread_key_t tls_key;
-# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what))
-# define tsrm_tls_get() pthread_getspecific(tls_key)
-
-#elif defined(TSRM_ST)
-static int tls_key;
-# define tsrm_tls_set(what) st_thread_setspecific(tls_key, (void*)(what))
-# define tsrm_tls_get() st_thread_getspecific(tls_key)
-
-#elif defined(TSRM_WIN32)
-static DWORD tls_key;
-# define tsrm_tls_set(what) TlsSetValue(tls_key, (void*)(what))
-# define tsrm_tls_get() TlsGetValue(tls_key)
-
-#elif defined(BETHREADS)
-static int32 tls_key;
-# define tsrm_tls_set(what) tls_set(tls_key, (void*)(what))
-# define tsrm_tls_get() (tsrm_tls_entry*)tls_get(tls_key)
-
-#else
-# define tsrm_tls_set(what)
-# define tsrm_tls_get() NULL
-# warning tsrm_set_interpreter_context is probably broken on this platform
-#endif
-
-/* Startup TSRM (call once for the entire process) */
-TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
-{
-#if defined(GNUPTH)
- pth_init();
-#elif defined(PTHREADS)
- pthread_key_create( &tls_key, 0 );
-#elif defined(TSRM_ST)
- st_init();
- st_key_create(&tls_key, 0);
-#elif defined(TSRM_WIN32)
- tls_key = TlsAlloc();
-#elif defined(BETHREADS)
- tls_key = tls_allocate();
-#endif
-
- tsrm_error_file = stderr;
- tsrm_error_set(debug_level, debug_filename);
- tsrm_tls_table_size = expected_threads;
-
- tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *));
- if (!tsrm_tls_table) {
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate TLS table"));
- return 0;
- }
- id_count=0;
-
- resource_types_table_size = expected_resources;
- resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type));
- if (!resource_types_table) {
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate resource types table"));
- free(tsrm_tls_table);
- tsrm_tls_table = NULL;
- return 0;
- }
-
- tsmm_mutex = tsrm_mutex_alloc();
-
- tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL;
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Started up TSRM, %d expected threads, %d expected resources", expected_threads, expected_resources));
- return 1;
-}
-
-
-/* Shutdown TSRM (call once for the entire process) */
-TSRM_API void tsrm_shutdown(void)
-{
- int i;
-
- if (tsrm_tls_table) {
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;
-
- while (p) {
- int j;
-
- next_p = p->next;
- for (j=0; j<p->count; j++) {
- if (p->storage[j]) {
- if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
- resource_types_table[j].dtor(p->storage[j], &p->storage);
- }
- free(p->storage[j]);
- }
- }
- free(p->storage);
- free(p);
- p = next_p;
- }
- }
- free(tsrm_tls_table);
- tsrm_tls_table = NULL;
- }
- if (resource_types_table) {
- free(resource_types_table);
- resource_types_table=NULL;
- }
- tsrm_mutex_free(tsmm_mutex);
- tsmm_mutex = NULL;
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM"));
- if (tsrm_error_file!=stderr) {
- fclose(tsrm_error_file);
- }
-#if defined(GNUPTH)
- pth_kill();
-#elif defined(PTHREADS)
- pthread_setspecific(tls_key, 0);
- pthread_key_delete(tls_key);
-#elif defined(TSRM_WIN32)
- TlsFree(tls_key);
-#endif
-}
-
-
-/* allocates a new thread-safe-resource id */
-TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
-{
- int i;
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size));
-
- tsrm_mutex_lock(tsmm_mutex);
-
- /* obtain a resource id */
- *rsrc_id = TSRM_SHUFFLE_RSRC_ID(id_count++);
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtained resource id %d", *rsrc_id));
-
- /* store the new resource type in the resource sizes table */
- if (resource_types_table_size < id_count) {
- resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count);
- if (!resource_types_table) {
- tsrm_mutex_unlock(tsmm_mutex);
- TSRM_ERROR((TSRM_ERROR_LEVEL_ERROR, "Unable to allocate storage for resource"));
- *rsrc_id = 0;
- return 0;
- }
- resource_types_table_size = id_count;
- }
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].size = size;
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].ctor = ctor;
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].dtor = dtor;
- resource_types_table[TSRM_UNSHUFFLE_RSRC_ID(*rsrc_id)].done = 0;
-
- /* enlarge the arrays for the already active threads */
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i];
-
- while (p) {
- if (p->count < id_count) {
- int j;
-
- p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count);
- for (j=p->count; j<id_count; j++) {
- p->storage[j] = (void *) malloc(resource_types_table[j].size);
- if (resource_types_table[j].ctor) {
- resource_types_table[j].ctor(p->storage[j], &p->storage);
- }
- }
- p->count = id_count;
- }
- p = p->next;
- }
- }
- tsrm_mutex_unlock(tsmm_mutex);
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
- return *rsrc_id;
-}
-
-
-static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
-{
- int i;
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
- (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry));
- (*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count);
- (*thread_resources_ptr)->count = id_count;
- (*thread_resources_ptr)->thread_id = thread_id;
- (*thread_resources_ptr)->next = NULL;
-
- /* Set thread local storage to this new thread resources structure */
- tsrm_tls_set(*thread_resources_ptr);
-
- if (tsrm_new_thread_begin_handler) {
- tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
- }
- for (i=0; i<id_count; i++) {
- if (resource_types_table[i].done) {
- (*thread_resources_ptr)->storage[i] = NULL;
- } else
- {
- (*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
- if (resource_types_table[i].ctor) {
- resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
- }
- }
- }
-
- if (tsrm_new_thread_end_handler) {
- tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
- }
-
- tsrm_mutex_unlock(tsmm_mutex);
-}
-
-
-/* fetches the requested resource for the current thread */
-TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
-{
- THREAD_T thread_id;
- int hash_value;
- tsrm_tls_entry *thread_resources;
-
-#ifdef NETWARE
- /* The below if loop is added for NetWare to fix an abend while unloading PHP
- * when an Apache unload command is issued on the system console.
- * While exiting from PHP, at the end for some reason, this function is called
- * with tsrm_tls_table = NULL. When this happened, the server abends when
- * tsrm_tls_table is accessed since it is NULL.
- */
- if(tsrm_tls_table) {
-#endif
- if (!th_id) {
- /* Fast path for looking up the resources for the current
- * thread. Its used by just about every call to
- * ts_resource_ex(). This avoids the need for a mutex lock
- * and our hashtable lookup.
- */
- thread_resources = tsrm_tls_get();
-
- if (thread_resources) {
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for current thread %d", id, (long) thread_resources->thread_id));
- /* Read a specific resource from the thread's resources.
- * This is called outside of a mutex, so have to be aware about external
- * changes to the structure as we read it.
- */
- TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
- }
- thread_id = tsrm_thread_id();
- } else {
- thread_id = *th_id;
- }
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Fetching resource id %d for thread %ld", id, (long) thread_id));
- tsrm_mutex_lock(tsmm_mutex);
-
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- if (!thread_resources) {
- allocate_new_resource(&tsrm_tls_table[hash_value], thread_id);
- return ts_resource_ex(id, &thread_id);
- } else {
- do {
- if (thread_resources->thread_id == thread_id) {
- break;
- }
- if (thread_resources->next) {
- thread_resources = thread_resources->next;
- } else {
- allocate_new_resource(&thread_resources->next, thread_id);
- return ts_resource_ex(id, &thread_id);
- /*
- * thread_resources = thread_resources->next;
- * break;
- */
- }
- } while (thread_resources);
- }
- tsrm_mutex_unlock(tsmm_mutex);
- /* Read a specific resource from the thread's resources.
- * This is called outside of a mutex, so have to be aware about external
- * changes to the structure as we read it.
- */
- TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
-#ifdef NETWARE
- } /* if(tsrm_tls_table) */
-#endif
-}
-
-/* frees an interpreter context. You are responsible for making sure that
- * it is not linked into the TSRM hash, and not marked as the current interpreter */
-void tsrm_free_interpreter_context(void *context)
-{
- tsrm_tls_entry *next, *thread_resources = (tsrm_tls_entry*)context;
- int i;
-
- while (thread_resources) {
- next = thread_resources->next;
-
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- free(thread_resources->storage[i]);
- }
- free(thread_resources->storage);
- free(thread_resources);
- thread_resources = next;
- }
-}
-
-void *tsrm_set_interpreter_context(void *new_ctx)
-{
- tsrm_tls_entry *current;
-
- current = tsrm_tls_get();
-
- /* TODO: unlink current from the global linked list, and replace it
- * it with the new context, protected by mutex where/if appropriate */
-
- /* Set thread local storage to this new thread resources structure */
- tsrm_tls_set(new_ctx);
-
- /* return old context, so caller can restore it when they're done */
- return current;
-}
-
-
-/* allocates a new interpreter context */
-void *tsrm_new_interpreter_context(void)
-{
- tsrm_tls_entry *new_ctx, *current;
- THREAD_T thread_id;
-
- thread_id = tsrm_thread_id();
- tsrm_mutex_lock(tsmm_mutex);
-
- current = tsrm_tls_get();
-
- allocate_new_resource(&new_ctx, thread_id);
-
- /* switch back to the context that was in use prior to our creation
- * of the new one */
- return tsrm_set_interpreter_context(current);
-}
-
-
-/* frees all resources allocated for the current thread */
-void ts_free_thread(void)
-{
- tsrm_tls_entry *thread_resources;
- int i;
- THREAD_T thread_id = tsrm_thread_id();
- int hash_value;
- tsrm_tls_entry *last=NULL;
-
- tsrm_mutex_lock(tsmm_mutex);
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- while (thread_resources) {
- if (thread_resources->thread_id == thread_id) {
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- free(thread_resources->storage[i]);
- }
- free(thread_resources->storage);
- if (last) {
- last->next = thread_resources->next;
- } else {
- tsrm_tls_table[hash_value] = thread_resources->next;
- }
- tsrm_tls_set(0);
- free(thread_resources);
- break;
- }
- if (thread_resources->next) {
- last = thread_resources;
- }
- thread_resources = thread_resources->next;
- }
- tsrm_mutex_unlock(tsmm_mutex);
-}
-
-
-/* frees all resources allocated for all threads except current */
-void ts_free_worker_threads(void)
-{
- tsrm_tls_entry *thread_resources;
- int i;
- THREAD_T thread_id = tsrm_thread_id();
- int hash_value;
- tsrm_tls_entry *last=NULL;
-
- tsrm_mutex_lock(tsmm_mutex);
- hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
- thread_resources = tsrm_tls_table[hash_value];
-
- while (thread_resources) {
- if (thread_resources->thread_id != thread_id) {
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- free(thread_resources->storage[i]);
- }
- free(thread_resources->storage);
- if (last) {
- last->next = thread_resources->next;
- } else {
- tsrm_tls_table[hash_value] = thread_resources->next;
- }
- free(thread_resources);
- if (last) {
- thread_resources = last->next;
- } else {
- thread_resources = tsrm_tls_table[hash_value];
- }
- } else {
- if (thread_resources->next) {
- last = thread_resources;
- }
- thread_resources = thread_resources->next;
- }
- }
- tsrm_mutex_unlock(tsmm_mutex);
-}
-
-
-/* deallocates all occurrences of a given id */
-void ts_free_id(ts_rsrc_id id)
-{
- int i;
- int j = TSRM_UNSHUFFLE_RSRC_ID(id);
-
- tsrm_mutex_lock(tsmm_mutex);
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Freeing resource id %d", id));
-
- if (tsrm_tls_table) {
- for (i=0; i<tsrm_tls_table_size; i++) {
- tsrm_tls_entry *p = tsrm_tls_table[i];
-
- while (p) {
- if (p->count > j && p->storage[j]) {
- if (resource_types_table && resource_types_table[j].dtor) {
- resource_types_table[j].dtor(p->storage[j], &p->storage);
- }
- free(p->storage[j]);
- p->storage[j] = NULL;
- }
- p = p->next;
- }
- }
- }
- resource_types_table[j].done = 1;
-
- tsrm_mutex_unlock(tsmm_mutex);
-
- TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully freed resource id %d", id));
-}
-
-
-
-
-/*
- * Utility Functions
- */
-
-/* Obtain the current thread id */
-TSRM_API THREAD_T tsrm_thread_id(void)
-{
-#ifdef TSRM_WIN32
- return GetCurrentThreadId();
-#elif defined(GNUPTH)
- return pth_self();
-#elif defined(PTHREADS)
- return pthread_self();
-#elif defined(NSAPI)
- return systhread_current();
-#elif defined(PI3WEB)
- return PIThread_getCurrent();
-#elif defined(TSRM_ST)
- return st_thread_self();
-#elif defined(BETHREADS)
- return find_thread(NULL);
-#endif
-}
-
-
-/* Allocate a mutex */
-TSRM_API MUTEX_T tsrm_mutex_alloc(void)
-{
- MUTEX_T mutexp;
-#ifdef TSRM_WIN32
- mutexp = malloc(sizeof(CRITICAL_SECTION));
- InitializeCriticalSection(mutexp);
-#elif defined(GNUPTH)
- mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
- pth_mutex_init(mutexp);
-#elif defined(PTHREADS)
- mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init(mutexp,NULL);
-#elif defined(NSAPI)
- mutexp = crit_init();
-#elif defined(PI3WEB)
- mutexp = PIPlatform_allocLocalMutex();
-#elif defined(TSRM_ST)
- mutexp = st_mutex_new();
-#elif defined(BETHREADS)
- mutexp = (beos_ben*)malloc(sizeof(beos_ben));
- mutexp->ben = 0;
- mutexp->sem = create_sem(1, "PHP sempahore");
-#endif
-#ifdef THR_DEBUG
- printf("Mutex created thread: %d\n",mythreadid());
-#endif
- return( mutexp );
-}
-
-
-/* Free a mutex */
-TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
-{
- if (mutexp) {
-#ifdef TSRM_WIN32
- DeleteCriticalSection(mutexp);
- free(mutexp);
-#elif defined(GNUPTH)
- free(mutexp);
-#elif defined(PTHREADS)
- pthread_mutex_destroy(mutexp);
- free(mutexp);
-#elif defined(NSAPI)
- crit_terminate(mutexp);
-#elif defined(PI3WEB)
- PISync_delete(mutexp);
-#elif defined(TSRM_ST)
- st_mutex_destroy(mutexp);
-#elif defined(BETHREADS)
- delete_sem(mutexp->sem);
- free(mutexp);
-#endif
- }
-#ifdef THR_DEBUG
- printf("Mutex freed thread: %d\n",mythreadid());
-#endif
-}
-
-
-/* Lock a mutex */
-TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
-{
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
-#ifdef TSRM_WIN32
- EnterCriticalSection(mutexp);
- return 1;
-#elif defined(GNUPTH)
- return pth_mutex_acquire(mutexp, 0, NULL);
-#elif defined(PTHREADS)
- return pthread_mutex_lock(mutexp);
-#elif defined(NSAPI)
- return crit_enter(mutexp);
-#elif defined(PI3WEB)
- return PISync_lock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_lock(mutexp);
-#elif defined(BETHREADS)
- if (atomic_add(&mutexp->ben, 1) != 0)
- return acquire_sem(mutexp->sem);
- return 0;
-#endif
-}
-
-
-/* Unlock a mutex */
-TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
-{
- TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
-#ifdef TSRM_WIN32
- LeaveCriticalSection(mutexp);
- return 1;
-#elif defined(GNUPTH)
- return pth_mutex_release(mutexp);
-#elif defined(PTHREADS)
- return pthread_mutex_unlock(mutexp);
-#elif defined(NSAPI)
- return crit_exit(mutexp);
-#elif defined(PI3WEB)
- return PISync_unlock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_unlock(mutexp);
-#elif defined(BETHREADS)
- if (atomic_add(&mutexp->ben, -1) != 1)
- return release_sem(mutexp->sem);
- return 0;
-#endif
-}
-
-
-TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
-{
- void *retval = (void *) tsrm_new_thread_begin_handler;
-
- tsrm_new_thread_begin_handler = new_thread_begin_handler;
- return retval;
-}
-
-
-TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler)
-{
- void *retval = (void *) tsrm_new_thread_end_handler;
-
- tsrm_new_thread_end_handler = new_thread_end_handler;
- return retval;
-}
-
-
-
-/*
- * Debug support
- */
-
-#if TSRM_DEBUG
-int tsrm_error(int level, const char *format, ...)
-{
- if (level<=tsrm_error_level) {
- va_list args;
- int size;
-
- fprintf(tsrm_error_file, "TSRM: ");
- va_start(args, format);
- size = vfprintf(tsrm_error_file, format, args);
- va_end(args);
- fprintf(tsrm_error_file, "\n");
- fflush(tsrm_error_file);
- return size;
- } else {
- return 0;
- }
-}
-#endif
-
-
-void tsrm_error_set(int level, char *debug_filename)
-{
- tsrm_error_level = level;
-
-#if TSRM_DEBUG
- if (tsrm_error_file!=stderr) { /* close files opened earlier */
- fclose(tsrm_error_file);
- }
-
- if (debug_filename) {
- tsrm_error_file = fopen(debug_filename, "w");
- if (!tsrm_error_file) {
- tsrm_error_file = stderr;
- }
- } else {
- tsrm_error_file = stderr;
- }
-#endif
-}
-
-#endif /* ZTS */
View
186 TSRM/TSRM.dsp
@@ -1,186 +0,0 @@
-# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=TSRM - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TS_inline" (based on "Win32 (x86) Static Library")
-!MESSAGE "TSRM - Win32 Release_TSDbg" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "TSRM - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=1 /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_DEBUG"
-# ADD RSC /l 0x40d /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS_inline"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS_inline"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TS_inline"
-# PROP Intermediate_Dir "Release_TS_inline"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TSDbg"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TSDbg"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_TSDbg"
-# PROP Intermediate_Dir "Release_TSDbg"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /Od /I "." /D "NDEBUG" /D "ZTS" /D "_LIB" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D TSRM_DEBUG=0 /YX /FD /c
-# ADD BASE RSC /l 0x40d /d "NDEBUG"
-# ADD RSC /l 0x40d /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "TSRM - Win32 Debug_TS"
-# Name "TSRM - Win32 Release_TS"
-# Name "TSRM - Win32 Release_TS_inline"
-# Name "TSRM - Win32 Release_TSDbg"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\TSRM.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_virtual_cwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\TSRM.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_config_common.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_strtok_r.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_virtual_cwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\tsrm_win32.h
-# End Source File
-# End Group
-# End Target
-# End Project
View
177 TSRM/TSRM.h
@@ -1,177 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Thread Safe Resource Manager |
- +----------------------------------------------------------------------+
- | Copyright (c) 1999-2008, Andi Gutmans, Sascha Schumann, Zeev Suraski |
- | This source file is subject to the TSRM license, that is bundled |
- | with this package in the file LICENSE |
- +----------------------------------------------------------------------+
- | Authors: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef TSRM_H
-#define TSRM_H
-
-#if !defined(__CYGWIN__) && defined(WIN32)
-# define TSRM_WIN32
-# include "tsrm_config.w32.h"
-#else
-# include <tsrm_config.h>
-#endif
-
-#ifdef TSRM_WIN32
-# ifdef TSRM_EXPORTS
-# define TSRM_API __declspec(dllexport)
-# else
-# define TSRM_API __declspec(dllimport)
-# endif
-#else
-# define TSRM_API
-#endif
-
-#ifdef _WIN64
-typedef __int64 tsrm_intptr_t;
-typedef unsigned __int64 tsrm_uintptr_t;
-#else
-typedef long tsrm_intptr_t;
-typedef unsigned long tsrm_uintptr_t;
-#endif
-
-/* Only compile multi-threading functions if we're in ZTS mode */
-#ifdef ZTS
-
-#ifdef TSRM_WIN32
-# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS
-# define WIN32_LEAN_AND_MEAN
-# endif
-# include <windows.h>
-# include <shellapi.h>
-#elif defined(GNUPTH)
-# include <pth.h>
-#elif defined(PTHREADS)
-# include <pthread.h>
-#elif defined(TSRM_ST)
-# include <st.h>
-#elif defined(BETHREADS)
-#include <kernel/OS.h>
-#include <TLS.h>
-#endif
-
-typedef int ts_rsrc_id;
-
-/* Define THREAD_T and MUTEX_T */
-#ifdef TSRM_WIN32
-# define THREAD_T DWORD
-# define MUTEX_T CRITICAL_SECTION *
-#elif defined(GNUPTH)
-# define THREAD_T pth_t
-# define MUTEX_T pth_mutex_t *
-#elif defined(PTHREADS)
-# define THREAD_T pthread_t
-# define MUTEX_T pthread_mutex_t *
-#elif defined(NSAPI)
-# define THREAD_T SYS_THREAD
-# define MUTEX_T CRITICAL
-#elif defined(PI3WEB)
-# define THREAD_T PIThread *
-# define MUTEX_T PISync *
-#elif defined(TSRM_ST)
-# define THREAD_T st_thread_t
-# define MUTEX_T st_mutex_t
-#elif defined(BETHREADS)
-# define THREAD_T thread_id
-typedef struct {
- sem_id sem;
- int32 ben;
-} beos_ben;
-# define MUTEX_T beos_ben *
-#endif
-
-typedef void (*ts_allocate_ctor)(void *, void ***);
-typedef void (*ts_allocate_dtor)(void *, void ***);
-
-#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* startup/shutdown */
-TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename);
-TSRM_API void tsrm_shutdown(void);
-
-/* allocates a new thread-safe-resource id */
-TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor);
-
-/* fetches the requested resource for the current thread */
-TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
-#define ts_resource(id) ts_resource_ex(id, NULL)
-
-/* frees all resources allocated for the current thread */
-TSRM_API void ts_free_thread(void);
-
-/* frees all resources allocated for all threads except current */
-void ts_free_worker_threads(void);
-
-/* deallocates all occurrences of a given id */
-TSRM_API void ts_free_id(ts_rsrc_id id);
-
-
-/* Debug support */
-#define TSRM_ERROR_LEVEL_ERROR 1
-#define TSRM_ERROR_LEVEL_CORE 2
-#define TSRM_ERROR_LEVEL_INFO 3
-
-typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
-typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
-
-
-TSRM_API int tsrm_error(int level, const char *format, ...);
-TSRM_API void tsrm_error_set(int level, char *debug_filename);
-
-/* utility functions */
-TSRM_API THREAD_T tsrm_thread_id(void);
-TSRM_API MUTEX_T tsrm_mutex_alloc(void);
-TSRM_API void tsrm_mutex_free(MUTEX_T mutexp);
-TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp);
-TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp);
-
-TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler);
-TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
-
-/* these 3 APIs should only be used by people that fully understand the threading model
- * used by PHP/Zend and the selected SAPI. */
-TSRM_API void *tsrm_new_interpreter_context(void);
-TSRM_API void *tsrm_set_interpreter_context(void *new_ctx);
-TSRM_API void tsrm_free_interpreter_context(void *context);
-
-#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
-#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
-
-#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
-#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
-#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
-#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
-#define TSRMLS_D void ***tsrm_ls
-#define TSRMLS_DC , TSRMLS_D
-#define TSRMLS_C tsrm_ls
-#define TSRMLS_CC , TSRMLS_C
-
-#ifdef __cplusplus
-}
-#endif
-
-#else /* non ZTS */
-
-#define TSRMLS_FETCH()
-#define TSRMLS_FETCH_FROM_CTX(ctx)
-#define TSRMLS_SET_CTX(ctx)
-#define TSRMLS_D void
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-
-#endif /* ZTS */
-
-#endif /* TSRM_H */
View
1  TSRM/acconfig.h
@@ -1 +0,0 @@
-#undef PTHREADS
View
5 TSRM/acinclude.m4
@@ -1,5 +0,0 @@
-
-AC_DEFUN([AM_SET_LIBTOOL_VARIABLE],[
- LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
-])
-
View
43 TSRM/build.mk
@@ -1,43 +0,0 @@
-# Makefile to generate build tools
-#
-# Standard usage:
-# make -f build.mk
-#
-# Written by Sascha Schumann
-#
-# $Id$
-
-
-LT_TARGETS = ltmain.sh ltconfig
-
-config_h_in = tsrm_config.h.in
-
-makefile_am_files = Makefile.am
-makefile_in_files = $(makefile_am_files:.am=.in)
-makefile_files = $(makefile_am_files:e.am=e)
-
-targets = $(makefile_in_files) $(LT_TARGETS) configure $(config_h_in)
-
-all: $(targets)
-
-clean:
- rm -f $(targets)
-
-$(LT_TARGETS):
- rm -f $(LT_TARGETS)
- libtoolize --automake $(AMFLAGS) -f
-
-$(makefile_in_files): $(makefile_am_files)
- automake -a -i $(AMFLAGS) $(makefile_files)
-
-aclocal.m4: configure.in acinclude.m4
- aclocal
-
-$(config_h_in): configure.in acconfig.h
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
- @rm -f $@
- autoheader
-
-configure: aclocal.m4 configure.in
- autoconf
View
33 TSRM/buildconf
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-case "$1" in
---copy)
- automake_flags=--copy
- shift
-;;
-esac
-
-libtoolize --force --automake $automake_flags
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}aclocal.m4"
- mv aclocal.m4.old aclocal.m4
-else
- echo "buildconf: created or modified ${1}aclocal.m4"
-fi
-
-autoheader
-
-automake --add-missing --include-deps $automake_flags
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}configure"
- mv configure.old configure
-else
- echo "buildconf: created or modified ${1}configure"
-fi
-
View
10 TSRM/config.w32
@@ -1,10 +0,0 @@
-// vim:ft=javascript
-// $Id$
-
-if (CHECK_HEADER_ADD_INCLUDE("NewAPIs.h", "CFLAGS_PHP", php_usual_include_suspects)) {
- // Need to add the flag directly, since TSRM doesn't include the config
- // header
- ADD_FLAG("CFLAGS_PHP", "/DHAVE_NEWAPIS_H=1");
-}
-ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c tsrm_win32.c");
-
View
31 TSRM/configure.in
@@ -1,31 +0,0 @@
-dnl $Id$
-dnl
-dnl Minimalistic configure.in for TSRM.
-dnl
-
-AC_INIT(TSRM.c)
-AM_INIT_AUTOMAKE(TSRM, 1.0, nodefine)
-AM_CONFIG_HEADER(tsrm_config.h)
-
-sinclude(tsrm.m4)
-
-TSRM_BASIC_CHECKS
-TSRM_THREADS_CHECKS
-
-AM_PROG_LIBTOOL
-if test "$enable_debug" != "yes"; then
- AM_SET_LIBTOOL_VARIABLE([--silent])
-fi
-
-dnl TSRM_PTHREAD
-
-AC_CHECK_HEADERS(
-utime.h \
-dirent.h \
-stdarg.h \
-alloca.h \
-unistd.h \
-limits.h
-)
-
-AC_OUTPUT(Makefile)
View
47 TSRM/readdir.h
@@ -1,47 +0,0 @@
-#ifndef READDIR_H
-#define READDIR_H
-
-
-/*
- * Structures and types used to implement opendir/readdir/closedir
- * on Windows 95/NT.
- */
-
-#define _WIN32_WINNT 0x0400
-
-#include <windows.h>
-
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <direct.h>
-
-/* struct dirent - same as Unix */
-
-struct dirent {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
-};
-
-
-/* typedef DIR - not the same as Unix */
-typedef struct {
- HANDLE handle; /* _findfirst/_findnext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- WIN32_FIND_DATA fileinfo; /* from _findfirst/_findnext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
-} DIR;
-
-/* Function prototypes */
-DIR *opendir(const char *);
-struct dirent *readdir(DIR *);
-int readdir_r(DIR *, struct dirent *, struct dirent **);
-int closedir(DIR *);
-int rewinddir(DIR *);
-
-#endif /* READDIR_H */
View
173 TSRM/threads.m4
@@ -1,173 +0,0 @@
-dnl Copyright (c) 1999, 2000 Sascha Schumann. All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions
-dnl are met:
-dnl
-dnl 1. Redistributions of source code must retain the above copyright
-dnl notice, this list of conditions and the following disclaimer.
-dnl
-dnl 2. Redistributions in binary form must reproduce the above copyright
-dnl notice, this list of conditions and the following disclaimer in
-dnl the documentation and/or other materials provided with the
-dnl distribution.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY SASCHA SCHUMANN ``AS IS'' AND ANY
-dnl EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-dnl PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SASCHA SCHUMANN OR
-dnl HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-dnl NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-dnl OF THE POSSIBILITY OF SUCH DAMAGE.
-
-dnl
-dnl PTHREADS_FLAGS
-dnl
-dnl Set some magic defines to achieve POSIX threads conformance
-dnl
-AC_DEFUN([PTHREADS_FLAGS],[
- if test -z "$host_alias" && test -n "$host"; then
- host_alias=$host
- fi
- if test -z "$host_alias"; then
- AC_MSG_ERROR(host_alias is not set. Make sure to run config.guess)
- fi
- case $host_alias in
- *solaris*)
- PTHREAD_FLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT";;
- *freebsd*)
- PTHREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE";;
- *linux*)
- PTHREAD_FLAGS=-D_REENTRANT;;
- *aix*)
- PTHREAD_FLAGS=-D_THREAD_SAFE;;
- *irix*)
- PTHREAD_FLAGS=-D_POSIX_THREAD_SAFE_FUNCTIONS;;
- *hpux*)
- PTHREAD_FLAGS=-D_REENTRANT;;
- *sco*)
- PTHREAD_FLAGS=-D_REENTRANT;;
-dnl Solves sigwait() problem, creates problems with u_long etc.
-dnl PTHREAD_FLAGS="-D_REENTRANT -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE_EXTENDED=1";;
- esac
-
- if test -n "$PTHREAD_FLAGS"; then
- CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
- fi
-])dnl
-dnl
-dnl PTHREADS_CHECK_COMPILE
-dnl
-dnl Check whether the current setup can use POSIX threads calls
-dnl
-AC_DEFUN([PTHREADS_CHECK_COMPILE], [
-AC_TRY_RUN( [
-#include <pthread.h>
-#include <stddef.h>
-
-void *thread_routine(void *data) {
- return data;
-}
-
-int main() {
- pthread_t thd;
- pthread_mutexattr_t mattr;
- int data = 1;
- pthread_mutexattr_init(&mattr);
- return pthread_create(&thd, NULL, thread_routine, &data);
-} ], [
- pthreads_working=yes
- ], [
- pthreads_working=no
- ], [
- dnl For cross compiling running this test is of no use. NetWare supports pthreads
- pthreads_working=no
- case $host_alias in
- *netware*)
- pthreads_working=yes
- esac
-]
-) ] )dnl
-dnl
-dnl PTHREADS_CHECK()
-dnl
-dnl Try to find a way to enable POSIX threads
-dnl
-dnl Magic flags
-dnl -kthread gcc (FreeBSD)
-dnl -Kthread UDK cc (UnixWare)
-dnl -mt WorkShop cc (Solaris)
-dnl -mthreads gcc (AIX)
-dnl -pthread gcc (Linux, FreeBSD, NetBSD, OpenBSD)
-dnl -pthreads gcc (Solaris)
-dnl -qthreaded AIX cc V5
-dnl -threads gcc (HP-UX)
-dnl
-AC_DEFUN([PTHREADS_CHECK],[
-
-if test "$beos_threads" = "1"; then
- pthreads_working="yes"
- ac_cv_pthreads_cflags=""
-else
- save_CFLAGS=$CFLAGS
- save_LIBS=$LIBS
- PTHREADS_ASSIGN_VARS
- PTHREADS_CHECK_COMPILE
- LIBS=$save_LIBS
- CFLAGS=$save_CFLAGS
-
- AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
- ac_cv_pthreads_cflags=
- if test "$pthreads_working" != "yes"; then
- for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads -mt -qthreaded; do
- ac_save=$CFLAGS
- CFLAGS="$CFLAGS $flag"
- PTHREADS_CHECK_COMPILE
- CFLAGS=$ac_save
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_cflags=$flag
- break
- fi
- done
- fi
-fi
-])
-
-AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
-ac_cv_pthreads_lib=
-if test "$pthreads_working" != "yes"; then
- for lib in pthread pthreads c_r; do
- ac_save=$LIBS
- LIBS="$LIBS -l$lib"
- PTHREADS_CHECK_COMPILE
- LIBS=$ac_save
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_lib=$lib
- break
- fi
- done
-fi
-])
-
-if test "$pthreads_working" = "yes"; then
- threads_result="POSIX-Threads found"
-else
- threads_result="POSIX-Threads not found"
-fi
-])dnl
-dnl
-dnl
-AC_DEFUN([PTHREADS_ASSIGN_VARS],[
-if test -n "$ac_cv_pthreads_lib"; then
- LIBS="$LIBS -l$ac_cv_pthreads_lib"
-fi
-
-if test -n "$ac_cv_pthreads_cflags"; then
- CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
-fi
-])dnl
View
128 TSRM/tsrm.m4
@@ -1,128 +0,0 @@
-
-dnl TSRM_CHECK_GCC_ARG(ARG, ACTION-IF-FOUND, ACTION-IF-NOT_FOUND)
-AC_DEFUN([TSRM_CHECK_GCC_ARG],[
- gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
- AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
- echo 'void somefunc() { };' > conftest.c
- cmd='$CC $1 -c conftest.c'
- if eval $cmd 2>&1 | egrep -e $1 >/dev/null ; then
- ac_result=no
- else
- ac_result=yes
- fi
- eval $gcc_arg_name=$ac_result
- rm -f conftest.*
- ])
- if eval test "\$$gcc_arg_name" = "yes"; then
- $2
- else
- :
- $3
- fi
-])
-
-AC_DEFUN([TSRM_BASIC_CHECKS],[
-
-AC_REQUIRE([AC_PROG_CC])dnl
-dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
-AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AC_PROG_RANLIB])dnl
-
-AC_CHECK_HEADERS(stdarg.h)
-
-])
-
-
-AC_DEFUN([TSRM_CHECK_PTH],[
-
-AC_MSG_CHECKING(for GNU Pth)
-PTH_PREFIX="`$1 --prefix`"
-if test -z "$PTH_PREFIX"; then
- AC_MSG_RESULT(Please check your Pth installation)
-fi
-
-CPPFLAGS="$CPPFLAGS `$1 --cflags`"
-LDFLAGS="$LDFLAGS `$1 --ldflags`"
-LIBS="$LIBS `$1 --libs`"
-
-AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
-AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
-
-])
-
-AC_DEFUN([TSRM_CHECK_ST],[
- if test -r "$1/include/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1/include"
- LDFLAGS="$LDFLAGS -L$1/lib"
- elif test -r "$1/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1"
- LDFLAGS="$LDFLAGS -L$1"
- fi
- AC_CHECK_HEADERS(st.h,[],[
- AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
- ])
- LIBS="$LIBS -lst"
- AC_MSG_CHECKING(for SGI's State Threads)
- AC_MSG_RESULT(yes)
- AC_DEFINE(TSRM_ST, 1, [ ])
-])
-
-sinclude(threads.m4)
-
-AC_DEFUN([TSRM_CHECK_PTHREADS],[
-
-PTHREADS_CHECK
-
-if test "$beos_threads" = "1"; then
- AC_DEFINE(BETHREADS, 1, Whether to use native BeOS threads)
-else
- if test "$pthreads_working" != "yes"; then
- AC_MSG_ERROR(Your system seems to lack POSIX threads.)
- fi
-
- AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
-
- AC_MSG_CHECKING(for POSIX threads)
- AC_MSG_RESULT(yes)
-fi
-])
-
-
-AC_DEFUN([TSRM_THREADS_CHECKS],[
-
-dnl For the thread implementations, we always use --with-*
-dnl to maintain consistency
-
-AC_ARG_WITH(tsrm-pth,
-[ --with-tsrm-pth[=pth-config]
- Use GNU Pth],[
- TSRM_PTH=$withval
-],[
- TSRM_PTH=no
-])
-
-AC_ARG_WITH(tsrm-st,
-[ --with-tsrm-st Use SGI's State Threads],[
- TSRM_ST=$withval
-],[
- TSRM_ST=no
-])
-
-AC_ARG_WITH(tsrm-pthreads,
-[ --with-tsrm-pthreads Use POSIX threads (default)],[
- TSRM_PTHREADS=$withval
-],[
- TSRM_PTHREADS=yes
-])
-
-test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
-
-if test "$TSRM_PTH" != "no"; then
- TSRM_CHECK_PTH($TSRM_PTH)
-elif test "$TSRM_ST" != "no"; then
- TSRM_CHECK_ST($TSRM_ST)
-elif test "$TSRM_PTHREADS" != "no"; then
- TSRM_CHECK_PTHREADS
-fi
-
-])
View
20 TSRM/tsrm_config.w32.h
@@ -1,20 +0,0 @@
-#ifndef TSRM_CONFIG_W32_H
-#define TSRM_CONFIG_W32_H
-
-#define HAVE_UTIME 1
-#define HAVE_ALLOCA 1
-#define HAVE_REALPATH 1
-
-#include <malloc.h>
-#include <stdlib.h>
-#include <crtdbg.h>
-
-#undef inline
-#ifdef ZEND_WIN32_FORCE_INLINE
-# define inline __forceinline
-#else
-# define inline
-#endif
-
-
-#endif
View
62 TSRM/tsrm_config_common.h
@@ -1,62 +0,0 @@
-#ifndef TSRM_CONFIG_COMMON_H
-#define TSRM_CONFIG_COMMON_H
-
-#ifndef __CYGWIN__
-# if WINNT|WIN32
-# define TSRM_WIN32
-# endif
-#endif
-
-#ifdef TSRM_WIN32
-# include "tsrm_config.w32.h"
-#else
-# include <tsrm_config.h>
-# include <sys/param.h>
-#endif
-
-#if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
-# include <alloca.h>
-#endif
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# ifndef HAVE_ALLOCA_H
-# ifdef _AIX
-#pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-# ifndef NETWARE
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef MAXPATHLEN
-# ifdef PATH_MAX
-# define MAXPATHLEN PATH_MAX
-# elif defined(MAX_PATH)
-# define MAXPATHLEN MAX_PATH
-# else
-# define MAXPATHLEN 256
-# endif
-#endif
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
-# define tsrm_do_alloca(p) alloca(p)
-# define tsrm_free_alloca(p)
-#else
-# define tsrm_do_alloca(p) malloc(p)
-# define tsrm_free_alloca(p) free(p)
-#endif
-
-#endif /* TSRM_CONFIG_COMMON_H */
View
240 TSRM/tsrm_nw.c
@@ -1,240 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Venkat Raghavan S <rvenkat@novell.com> |
- | Anantha Kesari H Y <hyanantha@novell.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "TSRM.h"
-
-#ifdef NETWARE
-
-#ifdef USE_MKFIFO
-#include <sys/stat.h>
-#elif !defined(USE_PIPE_OPEN) /* NXFifoOpen */
-#include <nks/fsio.h>
-#endif
-
-#include <nks/vm.h>
-#include <nks/memory.h>
-
-#include <string.h>
-
-#include "mktemp.h"
-
-/* strtok() call in LibC is abending when used in a different address space
- * -- hence using PHP's version itself for now
- */
-#include "tsrm_strtok_r.h"
-#define tsrm_strtok_r(a,b,c) strtok((a),(b))
-
-#define WHITESPACE " \t"
-#define MAX_ARGS 10
-
-
-TSRM_API FILE* popen(const char *commandline, const char *type)
-{
- char *command = NULL, *argv[MAX_ARGS] = {'\0'}, **env = NULL;
- char *tempName = "sys:/php/temp/phpXXXXXX.tmp";
- char *filePath = NULL;
- char *ptr = NULL;
- int ptrLen = 0, argc = 0, i = 0, envCount = 0, err = 0;
- FILE *stream = NULL;
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- int pipe_handle;
- int mode = O_RDONLY;
-#else
- NXHandle_t pipe_handle;
- NXMode_t mode = NX_O_RDONLY;
-#endif
- NXExecEnvSpec_t envSpec;
- NXNameSpec_t nameSpec;
- NXVmId_t newVM = 0;
-
- /* Check for validity of input parameters */
- if (!commandline || !type)
- return NULL;
-
- /* Get temporary file name */
- filePath = mktemp(tempName);
- if (!filePath)
- return NULL;
-
- /* Set pipe mode according to type -- for now allow only "r" or "w" */
- if (strcmp(type, "r") == 0)
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- mode = O_RDONLY;
-#else
- mode = NX_O_RDONLY;
-#endif
- else if (strcmp(type, "w") == 0)
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- mode = O_WRONLY;
-#else
- mode = NX_O_WRONLY;
-#endif
- else
- return NULL;
-
-#ifdef USE_PIPE_OPEN
- pipe_handle = pipe_open(filePath, mode);
- if (pipe_handle == -1)
- return NULL;
-#elif defined(USE_MKFIFO)
- pipe_handle = mkfifo(filePath, mode);
- if (pipe_handle == -1)
- return NULL;
-#else
- /* - NetWare doesn't require first parameter
- * - Allowing LibC to choose the buffer size for now
- */
- err = NXFifoOpen(0, filePath, mode, 0, &pipe_handle);
- if (err)
- return NULL;
-#endif
-
- /* Copy the environment variables in preparation for the spawn call */
- envCount = NXGetEnvCount() + 1; /* add one for NULL */
- env = (char **) NXMemAlloc(sizeof(char *) * envCount, 0);
- if (!env)
- return NULL;
-
- err = NXCopyEnv(env, envCount);
- if (err) {
- NXMemFree (env);
- return NULL;
- }
-
- /* Separate commandline string into words */
- ptr = tsrm_strtok_r((char*)commandline, WHITESPACE, NULL);
- ptrLen = strlen(ptr);
-
- command = (char*)malloc(ptrLen + 1);
- if (!command) {
- NXMemFree (env);
- return NULL;
- }
-
- strcpy (command, ptr);
-
- ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
- while (ptr && (argc < MAX_ARGS)) {
- ptrLen = strlen(ptr);
-
- argv[argc] = (char*)malloc(ptrLen + 1);
- if (!argv[argc]) {
- NXMemFree (env);
- if (command)
- free (command);
-
- for (i = 0; i < argc; i++) {
- if (argv[i])
- free (argv[i]);
- }
-
- return NULL;
- }
-
- strcpy (argv[argc], ptr);
- argc++;
- ptr = tsrm_strtok_r(NULL, WHITESPACE, NULL);
- }
-
- /* Setup the execution environment and spawn new process */
- envSpec.esFlags = 0; /* Not used */
- envSpec.esArgc = argc;
- envSpec.esArgv = (void **) argv;
- envSpec.esEnv = (void **) env;
-
-/* envSpec.esStdin.ssType = */
- envSpec.esStdout.ssType = NX_OBJ_FIFO;
- envSpec.esStderr.ssType = NX_OBJ_FILE;
-
- /* 'ssHandle' is not a struct/union/class member */
-/*
- envSpec.esStdin.ssHandle =
- envSpec.esStdout.ssHandle =
- envSpec.esStderr.ssHandle = -1;
-*/
- envSpec.esStdin.ssPathCtx = NULL;
- envSpec.esStdout.ssPathCtx = NULL;
- envSpec.esStderr.ssPathCtx = NULL;
-
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- if (mode == O_RDONLY) {
-#else
- if (mode == NX_O_RDONLY) {
-#endif
- envSpec.esStdin.ssPath = filePath;
- envSpec.esStdout.ssPath = stdout;
- } else { /* Write Only */
- envSpec.esStdin.ssPath = stdin;
- envSpec.esStdout.ssPath = filePath;
- }
-
- envSpec.esStderr.ssPath = stdout;
-
- nameSpec.ssType = NX_OBJ_FIFO;
-/* nameSpec.ssHandle = 0; */ /* 'ssHandle' is not a struct/union/class member */
- nameSpec.ssPathCtx = NULL; /* Not used */
- nameSpec.ssPath = argv[0];
- err = NXVmSpawn(&nameSpec, &envSpec, 0, &newVM);
- if (!err)
- /* Get file pointer corresponding to the pipe (file) opened */
- stream = fdopen(pipe_handle, type);
-
- /* Clean-up */
- if (env)
- NXMemFree (env);
-
- if (pipe_handle)
-#if defined(USE_PIPE_OPEN) || defined(USE_MKFIFO)
- close(pipe_handle);
-#else
- NXClose(pipe_handle);
-#endif
-
- if (command)
- free (command);
-
- for (i = 0; i < argc; i++) {
- if (argv[i])
- free (argv[i]);
- }
-
- return stream;
-}
-
-TSRM_API int pclose(FILE* stream)
-{
- int err = 0;
- NXHandle_t fd = 0;
-
- /* Get the process associated with this pipe (file) handle and terminate it */
- fd = fileno(stream);
- NXClose (fd);
-
- err = fclose(stream);
-
- return err;
-}
-
-#endif /* NETWARE */
View
29 TSRM/tsrm_nw.h
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 5 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Venkat Raghavan S <rvenkat@novell.com> |
- | Anantha Kesari H Y <hyanantha@novell.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef TSRM_NW_H
-#define TSRM_NW_H
-
-#include "TSRM.h"
-
-TSRM_API FILE* popen(const char *command, const char *type);
-TSRM_API int pclose<