You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

system.h 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. #ifndef __CURL_SYSTEM_H
  2. #define __CURL_SYSTEM_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.haxx.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. /*
  25. * Try to keep one section per platform, compiler and architecture, otherwise,
  26. * if an existing section is reused for a different one and later on the
  27. * original is adjusted, probably the piggybacking one can be adversely
  28. * changed.
  29. *
  30. * In order to differentiate between platforms/compilers/architectures use
  31. * only compiler built in predefined preprocessor symbols.
  32. *
  33. * curl_off_t
  34. * ----------
  35. *
  36. * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
  37. * wide signed integral data type. The width of this data type must remain
  38. * constant and independent of any possible large file support settings.
  39. *
  40. * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
  41. * wide signed integral data type if there is no 64-bit type.
  42. *
  43. * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
  44. * only be violated if off_t is the only 64-bit data type available and the
  45. * size of off_t is independent of large file support settings. Keep your
  46. * build on the safe side avoiding an off_t gating. If you have a 64-bit
  47. * off_t then take for sure that another 64-bit data type exists, dig deeper
  48. * and you will find it.
  49. *
  50. */
  51. #if defined(__DJGPP__) || defined(__GO32__)
  52. # if defined(__DJGPP__) && (__DJGPP__ > 1)
  53. # define CURL_SIZEOF_LONG 4
  54. # define CURL_TYPEOF_CURL_OFF_T long long
  55. # define CURL_FORMAT_CURL_OFF_T "lld"
  56. # define CURL_FORMAT_CURL_OFF_TU "llu"
  57. # define CURL_SIZEOF_CURL_OFF_T 8
  58. # define CURL_SUFFIX_CURL_OFF_T LL
  59. # define CURL_SUFFIX_CURL_OFF_TU ULL
  60. # else
  61. # define CURL_SIZEOF_LONG 4
  62. # define CURL_TYPEOF_CURL_OFF_T long
  63. # define CURL_FORMAT_CURL_OFF_T "ld"
  64. # define CURL_FORMAT_CURL_OFF_TU "lu"
  65. # define CURL_SIZEOF_CURL_OFF_T 4
  66. # define CURL_SUFFIX_CURL_OFF_T L
  67. # define CURL_SUFFIX_CURL_OFF_TU UL
  68. # endif
  69. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  70. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  71. #elif defined(__SALFORDC__)
  72. # define CURL_SIZEOF_LONG 4
  73. # define CURL_TYPEOF_CURL_OFF_T long
  74. # define CURL_FORMAT_CURL_OFF_T "ld"
  75. # define CURL_FORMAT_CURL_OFF_TU "lu"
  76. # define CURL_SIZEOF_CURL_OFF_T 4
  77. # define CURL_SUFFIX_CURL_OFF_T L
  78. # define CURL_SUFFIX_CURL_OFF_TU UL
  79. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  80. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  81. #elif defined(__BORLANDC__)
  82. # if (__BORLANDC__ < 0x520)
  83. # define CURL_SIZEOF_LONG 4
  84. # define CURL_TYPEOF_CURL_OFF_T long
  85. # define CURL_FORMAT_CURL_OFF_T "ld"
  86. # define CURL_FORMAT_CURL_OFF_TU "lu"
  87. # define CURL_SIZEOF_CURL_OFF_T 4
  88. # define CURL_SUFFIX_CURL_OFF_T L
  89. # define CURL_SUFFIX_CURL_OFF_TU UL
  90. # else
  91. # define CURL_SIZEOF_LONG 4
  92. # define CURL_TYPEOF_CURL_OFF_T __int64
  93. # define CURL_FORMAT_CURL_OFF_T "I64d"
  94. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  95. # define CURL_SIZEOF_CURL_OFF_T 8
  96. # define CURL_SUFFIX_CURL_OFF_T i64
  97. # define CURL_SUFFIX_CURL_OFF_TU ui64
  98. # endif
  99. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  100. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  101. #elif defined(__TURBOC__)
  102. # define CURL_SIZEOF_LONG 4
  103. # define CURL_TYPEOF_CURL_OFF_T long
  104. # define CURL_FORMAT_CURL_OFF_T "ld"
  105. # define CURL_FORMAT_CURL_OFF_TU "lu"
  106. # define CURL_SIZEOF_CURL_OFF_T 4
  107. # define CURL_SUFFIX_CURL_OFF_T L
  108. # define CURL_SUFFIX_CURL_OFF_TU UL
  109. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  110. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  111. #elif defined(__WATCOMC__)
  112. # if defined(__386__)
  113. # define CURL_SIZEOF_LONG 4
  114. # define CURL_TYPEOF_CURL_OFF_T __int64
  115. # define CURL_FORMAT_CURL_OFF_T "I64d"
  116. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  117. # define CURL_SIZEOF_CURL_OFF_T 8
  118. # define CURL_SUFFIX_CURL_OFF_T i64
  119. # define CURL_SUFFIX_CURL_OFF_TU ui64
  120. # else
  121. # define CURL_SIZEOF_LONG 4
  122. # define CURL_TYPEOF_CURL_OFF_T long
  123. # define CURL_FORMAT_CURL_OFF_T "ld"
  124. # define CURL_FORMAT_CURL_OFF_TU "lu"
  125. # define CURL_SIZEOF_CURL_OFF_T 4
  126. # define CURL_SUFFIX_CURL_OFF_T L
  127. # define CURL_SUFFIX_CURL_OFF_TU UL
  128. # endif
  129. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  130. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  131. #elif defined(__POCC__)
  132. # if (__POCC__ < 280)
  133. # define CURL_SIZEOF_LONG 4
  134. # define CURL_TYPEOF_CURL_OFF_T long
  135. # define CURL_FORMAT_CURL_OFF_T "ld"
  136. # define CURL_FORMAT_CURL_OFF_TU "lu"
  137. # define CURL_SIZEOF_CURL_OFF_T 4
  138. # define CURL_SUFFIX_CURL_OFF_T L
  139. # define CURL_SUFFIX_CURL_OFF_TU UL
  140. # elif defined(_MSC_VER)
  141. # define CURL_SIZEOF_LONG 4
  142. # define CURL_TYPEOF_CURL_OFF_T __int64
  143. # define CURL_FORMAT_CURL_OFF_T "I64d"
  144. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  145. # define CURL_SIZEOF_CURL_OFF_T 8
  146. # define CURL_SUFFIX_CURL_OFF_T i64
  147. # define CURL_SUFFIX_CURL_OFF_TU ui64
  148. # else
  149. # define CURL_SIZEOF_LONG 4
  150. # define CURL_TYPEOF_CURL_OFF_T long long
  151. # define CURL_FORMAT_CURL_OFF_T "lld"
  152. # define CURL_FORMAT_CURL_OFF_TU "llu"
  153. # define CURL_SIZEOF_CURL_OFF_T 8
  154. # define CURL_SUFFIX_CURL_OFF_T LL
  155. # define CURL_SUFFIX_CURL_OFF_TU ULL
  156. # endif
  157. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  158. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  159. #elif defined(__LCC__)
  160. # define CURL_SIZEOF_LONG 4
  161. # define CURL_TYPEOF_CURL_OFF_T long
  162. # define CURL_FORMAT_CURL_OFF_T "ld"
  163. # define CURL_FORMAT_CURL_OFF_TU "lu"
  164. # define CURL_SIZEOF_CURL_OFF_T 4
  165. # define CURL_SUFFIX_CURL_OFF_T L
  166. # define CURL_SUFFIX_CURL_OFF_TU UL
  167. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  168. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  169. #elif defined(__SYMBIAN32__)
  170. # if defined(__EABI__) /* Treat all ARM compilers equally */
  171. # define CURL_SIZEOF_LONG 4
  172. # define CURL_TYPEOF_CURL_OFF_T long long
  173. # define CURL_FORMAT_CURL_OFF_T "lld"
  174. # define CURL_FORMAT_CURL_OFF_TU "llu"
  175. # define CURL_SIZEOF_CURL_OFF_T 8
  176. # define CURL_SUFFIX_CURL_OFF_T LL
  177. # define CURL_SUFFIX_CURL_OFF_TU ULL
  178. # elif defined(__CW32__)
  179. # pragma longlong on
  180. # define CURL_SIZEOF_LONG 4
  181. # define CURL_TYPEOF_CURL_OFF_T long long
  182. # define CURL_FORMAT_CURL_OFF_T "lld"
  183. # define CURL_FORMAT_CURL_OFF_TU "llu"
  184. # define CURL_SIZEOF_CURL_OFF_T 8
  185. # define CURL_SUFFIX_CURL_OFF_T LL
  186. # define CURL_SUFFIX_CURL_OFF_TU ULL
  187. # elif defined(__VC32__)
  188. # define CURL_SIZEOF_LONG 4
  189. # define CURL_TYPEOF_CURL_OFF_T __int64
  190. # define CURL_FORMAT_CURL_OFF_T "lld"
  191. # define CURL_FORMAT_CURL_OFF_TU "llu"
  192. # define CURL_SIZEOF_CURL_OFF_T 8
  193. # define CURL_SUFFIX_CURL_OFF_T LL
  194. # define CURL_SUFFIX_CURL_OFF_TU ULL
  195. # endif
  196. # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
  197. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  198. #elif defined(__MWERKS__)
  199. # define CURL_SIZEOF_LONG 4
  200. # define CURL_TYPEOF_CURL_OFF_T long long
  201. # define CURL_FORMAT_CURL_OFF_T "lld"
  202. # define CURL_FORMAT_CURL_OFF_TU "llu"
  203. # define CURL_SIZEOF_CURL_OFF_T 8
  204. # define CURL_SUFFIX_CURL_OFF_T LL
  205. # define CURL_SUFFIX_CURL_OFF_TU ULL
  206. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  207. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  208. #elif defined(_WIN32_WCE)
  209. # define CURL_SIZEOF_LONG 4
  210. # define CURL_TYPEOF_CURL_OFF_T __int64
  211. # define CURL_FORMAT_CURL_OFF_T "I64d"
  212. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  213. # define CURL_SIZEOF_CURL_OFF_T 8
  214. # define CURL_SUFFIX_CURL_OFF_T i64
  215. # define CURL_SUFFIX_CURL_OFF_TU ui64
  216. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  217. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  218. #elif defined(__MINGW32__)
  219. # define CURL_SIZEOF_LONG 4
  220. # define CURL_TYPEOF_CURL_OFF_T long long
  221. # define CURL_FORMAT_CURL_OFF_T "I64d"
  222. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  223. # define CURL_SIZEOF_CURL_OFF_T 8
  224. # define CURL_SUFFIX_CURL_OFF_T LL
  225. # define CURL_SUFFIX_CURL_OFF_TU ULL
  226. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  227. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  228. # define CURL_PULL_SYS_TYPES_H 1
  229. # define CURL_PULL_WS2TCPIP_H 1
  230. #elif defined(__VMS)
  231. # if defined(__VAX)
  232. # define CURL_SIZEOF_LONG 4
  233. # define CURL_TYPEOF_CURL_OFF_T long
  234. # define CURL_FORMAT_CURL_OFF_T "ld"
  235. # define CURL_FORMAT_CURL_OFF_TU "lu"
  236. # define CURL_SIZEOF_CURL_OFF_T 4
  237. # define CURL_SUFFIX_CURL_OFF_T L
  238. # define CURL_SUFFIX_CURL_OFF_TU UL
  239. # else
  240. # define CURL_SIZEOF_LONG 4
  241. # define CURL_TYPEOF_CURL_OFF_T long long
  242. # define CURL_FORMAT_CURL_OFF_T "lld"
  243. # define CURL_FORMAT_CURL_OFF_TU "llu"
  244. # define CURL_SIZEOF_CURL_OFF_T 8
  245. # define CURL_SUFFIX_CURL_OFF_T LL
  246. # define CURL_SUFFIX_CURL_OFF_TU ULL
  247. # endif
  248. # define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
  249. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  250. #elif defined(__OS400__)
  251. # if defined(__ILEC400__)
  252. # define CURL_SIZEOF_LONG 4
  253. # define CURL_TYPEOF_CURL_OFF_T long long
  254. # define CURL_FORMAT_CURL_OFF_T "lld"
  255. # define CURL_FORMAT_CURL_OFF_TU "llu"
  256. # define CURL_SIZEOF_CURL_OFF_T 8
  257. # define CURL_SUFFIX_CURL_OFF_T LL
  258. # define CURL_SUFFIX_CURL_OFF_TU ULL
  259. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  260. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  261. # define CURL_PULL_SYS_TYPES_H 1
  262. # define CURL_PULL_SYS_SOCKET_H 1
  263. # endif
  264. #elif defined(__MVS__)
  265. # if defined(__IBMC__) || defined(__IBMCPP__)
  266. # if defined(_ILP32)
  267. # define CURL_SIZEOF_LONG 4
  268. # elif defined(_LP64)
  269. # define CURL_SIZEOF_LONG 8
  270. # endif
  271. # if defined(_LONG_LONG)
  272. # define CURL_TYPEOF_CURL_OFF_T long long
  273. # define CURL_FORMAT_CURL_OFF_T "lld"
  274. # define CURL_FORMAT_CURL_OFF_TU "llu"
  275. # define CURL_SIZEOF_CURL_OFF_T 8
  276. # define CURL_SUFFIX_CURL_OFF_T LL
  277. # define CURL_SUFFIX_CURL_OFF_TU ULL
  278. # elif defined(_LP64)
  279. # define CURL_TYPEOF_CURL_OFF_T long
  280. # define CURL_FORMAT_CURL_OFF_T "ld"
  281. # define CURL_FORMAT_CURL_OFF_TU "lu"
  282. # define CURL_SIZEOF_CURL_OFF_T 8
  283. # define CURL_SUFFIX_CURL_OFF_T L
  284. # define CURL_SUFFIX_CURL_OFF_TU UL
  285. # else
  286. # define CURL_TYPEOF_CURL_OFF_T long
  287. # define CURL_FORMAT_CURL_OFF_T "ld"
  288. # define CURL_FORMAT_CURL_OFF_TU "lu"
  289. # define CURL_SIZEOF_CURL_OFF_T 4
  290. # define CURL_SUFFIX_CURL_OFF_T L
  291. # define CURL_SUFFIX_CURL_OFF_TU UL
  292. # endif
  293. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  294. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  295. # define CURL_PULL_SYS_TYPES_H 1
  296. # define CURL_PULL_SYS_SOCKET_H 1
  297. # endif
  298. #elif defined(__370__)
  299. # if defined(__IBMC__) || defined(__IBMCPP__)
  300. # if defined(_ILP32)
  301. # define CURL_SIZEOF_LONG 4
  302. # elif defined(_LP64)
  303. # define CURL_SIZEOF_LONG 8
  304. # endif
  305. # if defined(_LONG_LONG)
  306. # define CURL_TYPEOF_CURL_OFF_T long long
  307. # define CURL_FORMAT_CURL_OFF_T "lld"
  308. # define CURL_FORMAT_CURL_OFF_TU "llu"
  309. # define CURL_SIZEOF_CURL_OFF_T 8
  310. # define CURL_SUFFIX_CURL_OFF_T LL
  311. # define CURL_SUFFIX_CURL_OFF_TU ULL
  312. # elif defined(_LP64)
  313. # define CURL_TYPEOF_CURL_OFF_T long
  314. # define CURL_FORMAT_CURL_OFF_T "ld"
  315. # define CURL_FORMAT_CURL_OFF_TU "lu"
  316. # define CURL_SIZEOF_CURL_OFF_T 8
  317. # define CURL_SUFFIX_CURL_OFF_T L
  318. # define CURL_SUFFIX_CURL_OFF_TU UL
  319. # else
  320. # define CURL_TYPEOF_CURL_OFF_T long
  321. # define CURL_FORMAT_CURL_OFF_T "ld"
  322. # define CURL_FORMAT_CURL_OFF_TU "lu"
  323. # define CURL_SIZEOF_CURL_OFF_T 4
  324. # define CURL_SUFFIX_CURL_OFF_T L
  325. # define CURL_SUFFIX_CURL_OFF_TU UL
  326. # endif
  327. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  328. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  329. # define CURL_PULL_SYS_TYPES_H 1
  330. # define CURL_PULL_SYS_SOCKET_H 1
  331. # endif
  332. #elif defined(TPF)
  333. # define CURL_SIZEOF_LONG 8
  334. # define CURL_TYPEOF_CURL_OFF_T long
  335. # define CURL_FORMAT_CURL_OFF_T "ld"
  336. # define CURL_FORMAT_CURL_OFF_TU "lu"
  337. # define CURL_SIZEOF_CURL_OFF_T 8
  338. # define CURL_SUFFIX_CURL_OFF_T L
  339. # define CURL_SUFFIX_CURL_OFF_TU UL
  340. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  341. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  342. #elif defined(__TINYC__) /* also known as tcc */
  343. # define CURL_SIZEOF_LONG 4
  344. # define CURL_TYPEOF_CURL_OFF_T long long
  345. # define CURL_FORMAT_CURL_OFF_T "lld"
  346. # define CURL_FORMAT_CURL_OFF_TU "llu"
  347. # define CURL_SIZEOF_CURL_OFF_T 8
  348. # define CURL_SUFFIX_CURL_OFF_T LL
  349. # define CURL_SUFFIX_CURL_OFF_TU ULL
  350. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  351. # define CURL_PULL_SYS_TYPES_H 1
  352. # define CURL_PULL_SYS_SOCKET_H 1
  353. /* ===================================== */
  354. /* KEEP MSVC THE PENULTIMATE ENTRY */
  355. /* ===================================== */
  356. #elif defined(_MSC_VER)
  357. # if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
  358. # define CURL_SIZEOF_LONG 4
  359. # define CURL_TYPEOF_CURL_OFF_T __int64
  360. # define CURL_FORMAT_CURL_OFF_T "I64d"
  361. # define CURL_FORMAT_CURL_OFF_TU "I64u"
  362. # define CURL_SIZEOF_CURL_OFF_T 8
  363. # define CURL_SUFFIX_CURL_OFF_T i64
  364. # define CURL_SUFFIX_CURL_OFF_TU ui64
  365. # else
  366. # define CURL_SIZEOF_LONG 4
  367. # define CURL_TYPEOF_CURL_OFF_T long
  368. # define CURL_FORMAT_CURL_OFF_T "ld"
  369. # define CURL_FORMAT_CURL_OFF_TU "lu"
  370. # define CURL_SIZEOF_CURL_OFF_T 4
  371. # define CURL_SUFFIX_CURL_OFF_T L
  372. # define CURL_SUFFIX_CURL_OFF_TU UL
  373. # endif
  374. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  375. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  376. /* ===================================== */
  377. /* KEEP GENERIC GCC THE LAST ENTRY */
  378. /* ===================================== */
  379. #elif defined(__GNUC__)
  380. # if !defined(__LP64__) && (defined(__ILP32__) || \
  381. defined(__i386__) || defined(__ppc__) || defined(__arm__) || \
  382. defined(__sparc__) || defined(__mips__) || defined(__sh__))
  383. # define CURL_SIZEOF_LONG 4
  384. # define CURL_TYPEOF_CURL_OFF_T long long
  385. # define CURL_FORMAT_CURL_OFF_T "lld"
  386. # define CURL_FORMAT_CURL_OFF_TU "llu"
  387. # define CURL_SIZEOF_CURL_OFF_T 8
  388. # define CURL_SUFFIX_CURL_OFF_T LL
  389. # define CURL_SUFFIX_CURL_OFF_TU ULL
  390. # elif defined(__LP64__) || \
  391. defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__)
  392. # define CURL_SIZEOF_LONG 8
  393. # define CURL_TYPEOF_CURL_OFF_T long
  394. # define CURL_FORMAT_CURL_OFF_T "ld"
  395. # define CURL_FORMAT_CURL_OFF_TU "lu"
  396. # define CURL_SIZEOF_CURL_OFF_T 8
  397. # define CURL_SUFFIX_CURL_OFF_T L
  398. # define CURL_SUFFIX_CURL_OFF_TU UL
  399. # endif
  400. # define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
  401. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  402. # define CURL_PULL_SYS_TYPES_H 1
  403. # define CURL_PULL_SYS_SOCKET_H 1
  404. #else
  405. /* generic "safe guess" on old 32 bit style */
  406. # define CURL_SIZEOF_LONG 4
  407. # define CURL_SIZEOF_CURL_SOCKLEN_T 4
  408. # define CURL_SIZEOF_CURL_OFF_T 4
  409. # define CURL_TYPEOF_CURL_OFF_T long
  410. # define CURL_FORMAT_CURL_OFF_T "ld"
  411. # define CURL_FORMAT_CURL_OFF_TU "lu"
  412. # define CURL_SUFFIX_CURL_OFF_T L
  413. # define CURL_SUFFIX_CURL_OFF_TU UL
  414. # define CURL_TYPEOF_CURL_SOCKLEN_T int
  415. #endif
  416. /* CURLSYS_PULL_WS2TCPIP_H is defined above when inclusion of header file */
  417. /* ws2tcpip.h is required here to properly make type definitions below. */
  418. #ifdef CURLSYS_PULL_WS2TCPIP_H
  419. # ifndef WIN32_LEAN_AND_MEAN
  420. # define WIN32_LEAN_AND_MEAN
  421. # endif
  422. # include <windows.h>
  423. # include <winsock2.h>
  424. # include <ws2tcpip.h>
  425. #endif
  426. /* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
  427. /* sys/types.h is required here to properly make type definitions below. */
  428. #ifdef CURL_PULL_SYS_TYPES_H
  429. # include <sys/types.h>
  430. #endif
  431. /* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
  432. /* sys/socket.h is required here to properly make type definitions below. */
  433. #ifdef CURL_PULL_SYS_SOCKET_H
  434. # include <sys/socket.h>
  435. #endif
  436. /* Data type definition of curl_socklen_t. */
  437. #ifdef CURL_TYPEOF_CURL_SOCKLEN_T
  438. typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
  439. #endif
  440. /* Data type definition of curl_off_t. */
  441. #ifdef CURL_TYPEOF_CURL_OFF_T
  442. typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
  443. #endif
  444. /*
  445. * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
  446. * these to be visible and exported by the external libcurl interface API,
  447. * while also making them visible to the library internals, simply including
  448. * curl_setup.h, without actually needing to include curl.h internally.
  449. * If some day this section would grow big enough, all this should be moved
  450. * to its own header file.
  451. */
  452. /*
  453. * Figure out if we can use the ## preprocessor operator, which is supported
  454. * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
  455. * or __cplusplus so we need to carefully check for them too.
  456. */
  457. #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
  458. defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
  459. defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
  460. defined(__ILEC400__)
  461. /* This compiler is believed to have an ISO compatible preprocessor */
  462. #define CURL_ISOCPP
  463. #else
  464. /* This compiler is believed NOT to have an ISO compatible preprocessor */
  465. #undef CURL_ISOCPP
  466. #endif
  467. /*
  468. * Macros for minimum-width signed and unsigned curl_off_t integer constants.
  469. */
  470. #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
  471. # define __CURL_OFF_T_C_HLPR2(x) x
  472. # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
  473. # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
  474. __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
  475. # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
  476. __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
  477. #else
  478. # ifdef CURL_ISOCPP
  479. # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
  480. # else
  481. # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
  482. # endif
  483. # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
  484. # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
  485. # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
  486. #endif
  487. #endif /* __CURL_SYSTEM_H */