system.h 18 KB

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