113498266Sopenharmony_ci#ifndef CURLINC_SYSTEM_H
213498266Sopenharmony_ci#define CURLINC_SYSTEM_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci/*
2813498266Sopenharmony_ci * Try to keep one section per platform, compiler and architecture, otherwise,
2913498266Sopenharmony_ci * if an existing section is reused for a different one and later on the
3013498266Sopenharmony_ci * original is adjusted, probably the piggybacking one can be adversely
3113498266Sopenharmony_ci * changed.
3213498266Sopenharmony_ci *
3313498266Sopenharmony_ci * In order to differentiate between platforms/compilers/architectures use
3413498266Sopenharmony_ci * only compiler built in predefined preprocessor symbols.
3513498266Sopenharmony_ci *
3613498266Sopenharmony_ci * curl_off_t
3713498266Sopenharmony_ci * ----------
3813498266Sopenharmony_ci *
3913498266Sopenharmony_ci * For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
4013498266Sopenharmony_ci * wide signed integral data type. The width of this data type must remain
4113498266Sopenharmony_ci * constant and independent of any possible large file support settings.
4213498266Sopenharmony_ci *
4313498266Sopenharmony_ci * As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
4413498266Sopenharmony_ci * wide signed integral data type if there is no 64-bit type.
4513498266Sopenharmony_ci *
4613498266Sopenharmony_ci * As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
4713498266Sopenharmony_ci * only be violated if off_t is the only 64-bit data type available and the
4813498266Sopenharmony_ci * size of off_t is independent of large file support settings. Keep your
4913498266Sopenharmony_ci * build on the safe side avoiding an off_t gating.  If you have a 64-bit
5013498266Sopenharmony_ci * off_t then take for sure that another 64-bit data type exists, dig deeper
5113498266Sopenharmony_ci * and you will find it.
5213498266Sopenharmony_ci *
5313498266Sopenharmony_ci */
5413498266Sopenharmony_ci
5513498266Sopenharmony_ci#if defined(__DJGPP__) || defined(__GO32__)
5613498266Sopenharmony_ci#  if defined(__DJGPP__) && (__DJGPP__ > 1)
5713498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
5813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
5913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
6013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
6113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
6213498266Sopenharmony_ci#  else
6313498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
6413498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
6513498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
6613498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
6713498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
6813498266Sopenharmony_ci#  endif
6913498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
7013498266Sopenharmony_ci
7113498266Sopenharmony_ci#elif defined(__SALFORDC__)
7213498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long
7313498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "ld"
7413498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "lu"
7513498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     L
7613498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    UL
7713498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
7813498266Sopenharmony_ci
7913498266Sopenharmony_ci#elif defined(__BORLANDC__)
8013498266Sopenharmony_ci#  if (__BORLANDC__ < 0x520)
8113498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
8213498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
8313498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
8413498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
8513498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
8613498266Sopenharmony_ci#  else
8713498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     __int64
8813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "I64d"
8913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
9013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     i64
9113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ui64
9213498266Sopenharmony_ci#  endif
9313498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
9413498266Sopenharmony_ci
9513498266Sopenharmony_ci#elif defined(__TURBOC__)
9613498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long
9713498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "ld"
9813498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "lu"
9913498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     L
10013498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    UL
10113498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
10213498266Sopenharmony_ci
10313498266Sopenharmony_ci#elif defined(__POCC__)
10413498266Sopenharmony_ci#  if (__POCC__ < 280)
10513498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
10613498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
10713498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
10813498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
10913498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
11013498266Sopenharmony_ci#  elif defined(_MSC_VER)
11113498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     __int64
11213498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "I64d"
11313498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
11413498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     i64
11513498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ui64
11613498266Sopenharmony_ci#  else
11713498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
11813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
11913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
12013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
12113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
12213498266Sopenharmony_ci#  endif
12313498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
12413498266Sopenharmony_ci
12513498266Sopenharmony_ci#elif defined(__LCC__)
12613498266Sopenharmony_ci#  if defined(__MCST__) /* MCST eLbrus Compiler Collection */
12713498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
12813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
12913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
13013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
13113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
13213498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
13313498266Sopenharmony_ci#    define CURL_PULL_SYS_TYPES_H      1
13413498266Sopenharmony_ci#    define CURL_PULL_SYS_SOCKET_H     1
13513498266Sopenharmony_ci#  else                /* Local (or Little) C Compiler */
13613498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
13713498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
13813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
13913498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
14013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
14113498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_SOCKLEN_T int
14213498266Sopenharmony_ci#  endif
14313498266Sopenharmony_ci
14413498266Sopenharmony_ci#elif defined(macintosh)
14513498266Sopenharmony_ci#  include <ConditionalMacros.h>
14613498266Sopenharmony_ci#  if TYPE_LONGLONG
14713498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
14813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
14913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
15013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
15113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
15213498266Sopenharmony_ci#  else
15313498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
15413498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
15513498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
15613498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
15713498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
15813498266Sopenharmony_ci#  endif
15913498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
16013498266Sopenharmony_ci
16113498266Sopenharmony_ci#elif defined(__TANDEM)
16213498266Sopenharmony_ci# if ! defined(__LP64)
16313498266Sopenharmony_ci   /* Required for 32-bit NonStop builds only. */
16413498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long long
16513498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "lld"
16613498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "llu"
16713498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     LL
16813498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    ULL
16913498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
17013498266Sopenharmony_ci# endif
17113498266Sopenharmony_ci
17213498266Sopenharmony_ci#elif defined(_WIN32_WCE)
17313498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     __int64
17413498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "I64d"
17513498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "I64u"
17613498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     i64
17713498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    ui64
17813498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
17913498266Sopenharmony_ci
18013498266Sopenharmony_ci#elif defined(__MINGW32__)
18113498266Sopenharmony_ci#  include <inttypes.h>
18213498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long long
18313498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     PRId64
18413498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    PRIu64
18513498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     LL
18613498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    ULL
18713498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
18813498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
18913498266Sopenharmony_ci
19013498266Sopenharmony_ci#elif defined(__VMS)
19113498266Sopenharmony_ci#  if defined(__VAX)
19213498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
19313498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
19413498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
19513498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
19613498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
19713498266Sopenharmony_ci#  else
19813498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
19913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
20013498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
20113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
20213498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
20313498266Sopenharmony_ci#  endif
20413498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
20513498266Sopenharmony_ci
20613498266Sopenharmony_ci#elif defined(__OS400__)
20713498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long long
20813498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "lld"
20913498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "llu"
21013498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     LL
21113498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    ULL
21213498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
21313498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
21413498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
21513498266Sopenharmony_ci
21613498266Sopenharmony_ci#elif defined(__MVS__)
21713498266Sopenharmony_ci#  if defined(_LONG_LONG)
21813498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
21913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
22013498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
22113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
22213498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
22313498266Sopenharmony_ci#  elif defined(_LP64)
22413498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
22513498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
22613498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
22713498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
22813498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
22913498266Sopenharmony_ci#  else
23013498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
23113498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
23213498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
23313498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
23413498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
23513498266Sopenharmony_ci#  endif
23613498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
23713498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
23813498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
23913498266Sopenharmony_ci
24013498266Sopenharmony_ci#elif defined(__370__)
24113498266Sopenharmony_ci#  if defined(__IBMC__) || defined(__IBMCPP__)
24213498266Sopenharmony_ci#    if defined(_ILP32)
24313498266Sopenharmony_ci#    elif defined(_LP64)
24413498266Sopenharmony_ci#    endif
24513498266Sopenharmony_ci#    if defined(_LONG_LONG)
24613498266Sopenharmony_ci#      define CURL_TYPEOF_CURL_OFF_T     long long
24713498266Sopenharmony_ci#      define CURL_FORMAT_CURL_OFF_T     "lld"
24813498266Sopenharmony_ci#      define CURL_FORMAT_CURL_OFF_TU    "llu"
24913498266Sopenharmony_ci#      define CURL_SUFFIX_CURL_OFF_T     LL
25013498266Sopenharmony_ci#      define CURL_SUFFIX_CURL_OFF_TU    ULL
25113498266Sopenharmony_ci#    elif defined(_LP64)
25213498266Sopenharmony_ci#      define CURL_TYPEOF_CURL_OFF_T     long
25313498266Sopenharmony_ci#      define CURL_FORMAT_CURL_OFF_T     "ld"
25413498266Sopenharmony_ci#      define CURL_FORMAT_CURL_OFF_TU    "lu"
25513498266Sopenharmony_ci#      define CURL_SUFFIX_CURL_OFF_T     L
25613498266Sopenharmony_ci#      define CURL_SUFFIX_CURL_OFF_TU    UL
25713498266Sopenharmony_ci#    else
25813498266Sopenharmony_ci#      define CURL_TYPEOF_CURL_OFF_T     long
25913498266Sopenharmony_ci#      define CURL_FORMAT_CURL_OFF_T     "ld"
26013498266Sopenharmony_ci#      define CURL_FORMAT_CURL_OFF_TU    "lu"
26113498266Sopenharmony_ci#      define CURL_SUFFIX_CURL_OFF_T     L
26213498266Sopenharmony_ci#      define CURL_SUFFIX_CURL_OFF_TU    UL
26313498266Sopenharmony_ci#    endif
26413498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
26513498266Sopenharmony_ci#    define CURL_PULL_SYS_TYPES_H      1
26613498266Sopenharmony_ci#    define CURL_PULL_SYS_SOCKET_H     1
26713498266Sopenharmony_ci#  endif
26813498266Sopenharmony_ci
26913498266Sopenharmony_ci#elif defined(TPF)
27013498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long
27113498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "ld"
27213498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "lu"
27313498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     L
27413498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    UL
27513498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
27613498266Sopenharmony_ci
27713498266Sopenharmony_ci#elif defined(__TINYC__) /* also known as tcc */
27813498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_OFF_T     long long
27913498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_T     "lld"
28013498266Sopenharmony_ci#  define CURL_FORMAT_CURL_OFF_TU    "llu"
28113498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_T     LL
28213498266Sopenharmony_ci#  define CURL_SUFFIX_CURL_OFF_TU    ULL
28313498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
28413498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
28513498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
28613498266Sopenharmony_ci
28713498266Sopenharmony_ci#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */
28813498266Sopenharmony_ci#  if !defined(__LP64) && (defined(__ILP32) ||                          \
28913498266Sopenharmony_ci                           defined(__i386) ||                           \
29013498266Sopenharmony_ci                           defined(__sparcv8) ||                        \
29113498266Sopenharmony_ci                           defined(__sparcv8plus))
29213498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
29313498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
29413498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
29513498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
29613498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
29713498266Sopenharmony_ci#  elif defined(__LP64) || \
29813498266Sopenharmony_ci        defined(__amd64) || defined(__sparcv9)
29913498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
30013498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
30113498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
30213498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
30313498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
30413498266Sopenharmony_ci#  endif
30513498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
30613498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
30713498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
30813498266Sopenharmony_ci
30913498266Sopenharmony_ci#elif defined(__xlc__) /* IBM xlc compiler */
31013498266Sopenharmony_ci#  if !defined(_LP64)
31113498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
31213498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
31313498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
31413498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
31513498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
31613498266Sopenharmony_ci#  else
31713498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
31813498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
31913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
32013498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
32113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
32213498266Sopenharmony_ci#  endif
32313498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
32413498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
32513498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
32613498266Sopenharmony_ci
32713498266Sopenharmony_ci#elif defined(__hpux) /* HP aCC compiler */
32813498266Sopenharmony_ci#  if !defined(_LP64)
32913498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
33013498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
33113498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
33213498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
33313498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
33413498266Sopenharmony_ci#  else
33513498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
33613498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
33713498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
33813498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
33913498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
34013498266Sopenharmony_ci#  endif
34113498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
34213498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
34313498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
34413498266Sopenharmony_ci
34513498266Sopenharmony_ci/* ===================================== */
34613498266Sopenharmony_ci/*    KEEP MSVC THE PENULTIMATE ENTRY    */
34713498266Sopenharmony_ci/* ===================================== */
34813498266Sopenharmony_ci
34913498266Sopenharmony_ci#elif defined(_MSC_VER)
35013498266Sopenharmony_ci#  if (_MSC_VER >= 1800)
35113498266Sopenharmony_ci#    include <inttypes.h>
35213498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     __int64
35313498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     PRId64
35413498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    PRIu64
35513498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     i64
35613498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ui64
35713498266Sopenharmony_ci#  elif (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
35813498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     __int64
35913498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "I64d"
36013498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "I64u"
36113498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     i64
36213498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ui64
36313498266Sopenharmony_ci#  else
36413498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
36513498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
36613498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
36713498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
36813498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
36913498266Sopenharmony_ci#  endif
37013498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T int
37113498266Sopenharmony_ci
37213498266Sopenharmony_ci/* ===================================== */
37313498266Sopenharmony_ci/*    KEEP GENERIC GCC THE LAST ENTRY    */
37413498266Sopenharmony_ci/* ===================================== */
37513498266Sopenharmony_ci
37613498266Sopenharmony_ci#elif defined(__GNUC__) && !defined(_SCO_DS)
37713498266Sopenharmony_ci#  if !defined(__LP64__) &&                                             \
37813498266Sopenharmony_ci  (defined(__ILP32__) || defined(__i386__) || defined(__hppa__) ||      \
37913498266Sopenharmony_ci   defined(__ppc__) || defined(__powerpc__) || defined(__arm__) ||      \
38013498266Sopenharmony_ci   defined(__sparc__) || defined(__mips__) || defined(__sh__) ||        \
38113498266Sopenharmony_ci   defined(__XTENSA__) ||                                               \
38213498266Sopenharmony_ci   (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4)  ||               \
38313498266Sopenharmony_ci   (defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
38413498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long long
38513498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "lld"
38613498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "llu"
38713498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     LL
38813498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    ULL
38913498266Sopenharmony_ci#  elif defined(__LP64__) || \
39013498266Sopenharmony_ci        defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
39113498266Sopenharmony_ci        defined(__e2k__) || \
39213498266Sopenharmony_ci        (defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
39313498266Sopenharmony_ci        (defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
39413498266Sopenharmony_ci#    define CURL_TYPEOF_CURL_OFF_T     long
39513498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_T     "ld"
39613498266Sopenharmony_ci#    define CURL_FORMAT_CURL_OFF_TU    "lu"
39713498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_T     L
39813498266Sopenharmony_ci#    define CURL_SUFFIX_CURL_OFF_TU    UL
39913498266Sopenharmony_ci#  endif
40013498266Sopenharmony_ci#  define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
40113498266Sopenharmony_ci#  define CURL_PULL_SYS_TYPES_H      1
40213498266Sopenharmony_ci#  define CURL_PULL_SYS_SOCKET_H     1
40313498266Sopenharmony_ci
40413498266Sopenharmony_ci#else
40513498266Sopenharmony_ci/* generic "safe guess" on old 32 bit style */
40613498266Sopenharmony_ci# define CURL_TYPEOF_CURL_OFF_T     long
40713498266Sopenharmony_ci# define CURL_FORMAT_CURL_OFF_T     "ld"
40813498266Sopenharmony_ci# define CURL_FORMAT_CURL_OFF_TU    "lu"
40913498266Sopenharmony_ci# define CURL_SUFFIX_CURL_OFF_T     L
41013498266Sopenharmony_ci# define CURL_SUFFIX_CURL_OFF_TU    UL
41113498266Sopenharmony_ci# define CURL_TYPEOF_CURL_SOCKLEN_T int
41213498266Sopenharmony_ci#endif
41313498266Sopenharmony_ci
41413498266Sopenharmony_ci#ifdef _AIX
41513498266Sopenharmony_ci/* AIX needs <sys/poll.h> */
41613498266Sopenharmony_ci#define CURL_PULL_SYS_POLL_H
41713498266Sopenharmony_ci#endif
41813498266Sopenharmony_ci
41913498266Sopenharmony_ci/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file  */
42013498266Sopenharmony_ci/* sys/types.h is required here to properly make type definitions below. */
42113498266Sopenharmony_ci#ifdef CURL_PULL_SYS_TYPES_H
42213498266Sopenharmony_ci#  include <sys/types.h>
42313498266Sopenharmony_ci#endif
42413498266Sopenharmony_ci
42513498266Sopenharmony_ci/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */
42613498266Sopenharmony_ci/* sys/socket.h is required here to properly make type definitions below. */
42713498266Sopenharmony_ci#ifdef CURL_PULL_SYS_SOCKET_H
42813498266Sopenharmony_ci#  include <sys/socket.h>
42913498266Sopenharmony_ci#endif
43013498266Sopenharmony_ci
43113498266Sopenharmony_ci/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file    */
43213498266Sopenharmony_ci/* sys/poll.h is required here to properly make type definitions below.   */
43313498266Sopenharmony_ci#ifdef CURL_PULL_SYS_POLL_H
43413498266Sopenharmony_ci#  include <sys/poll.h>
43513498266Sopenharmony_ci#endif
43613498266Sopenharmony_ci
43713498266Sopenharmony_ci/* Data type definition of curl_socklen_t. */
43813498266Sopenharmony_ci#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
43913498266Sopenharmony_ci  typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
44013498266Sopenharmony_ci#endif
44113498266Sopenharmony_ci
44213498266Sopenharmony_ci/* Data type definition of curl_off_t. */
44313498266Sopenharmony_ci
44413498266Sopenharmony_ci#ifdef CURL_TYPEOF_CURL_OFF_T
44513498266Sopenharmony_ci  typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
44613498266Sopenharmony_ci#endif
44713498266Sopenharmony_ci
44813498266Sopenharmony_ci/*
44913498266Sopenharmony_ci * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
45013498266Sopenharmony_ci * these to be visible and exported by the external libcurl interface API,
45113498266Sopenharmony_ci * while also making them visible to the library internals, simply including
45213498266Sopenharmony_ci * curl_setup.h, without actually needing to include curl.h internally.
45313498266Sopenharmony_ci * If some day this section would grow big enough, all this should be moved
45413498266Sopenharmony_ci * to its own header file.
45513498266Sopenharmony_ci */
45613498266Sopenharmony_ci
45713498266Sopenharmony_ci/*
45813498266Sopenharmony_ci * Figure out if we can use the ## preprocessor operator, which is supported
45913498266Sopenharmony_ci * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
46013498266Sopenharmony_ci * or  __cplusplus so we need to carefully check for them too.
46113498266Sopenharmony_ci */
46213498266Sopenharmony_ci
46313498266Sopenharmony_ci#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
46413498266Sopenharmony_ci  defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
46513498266Sopenharmony_ci  defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
46613498266Sopenharmony_ci  defined(__ILEC400__)
46713498266Sopenharmony_ci  /* This compiler is believed to have an ISO compatible preprocessor */
46813498266Sopenharmony_ci#define CURL_ISOCPP
46913498266Sopenharmony_ci#else
47013498266Sopenharmony_ci  /* This compiler is believed NOT to have an ISO compatible preprocessor */
47113498266Sopenharmony_ci#undef CURL_ISOCPP
47213498266Sopenharmony_ci#endif
47313498266Sopenharmony_ci
47413498266Sopenharmony_ci/*
47513498266Sopenharmony_ci * Macros for minimum-width signed and unsigned curl_off_t integer constants.
47613498266Sopenharmony_ci */
47713498266Sopenharmony_ci
47813498266Sopenharmony_ci#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
47913498266Sopenharmony_ci#  define CURLINC_OFF_T_C_HLPR2(x) x
48013498266Sopenharmony_ci#  define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x)
48113498266Sopenharmony_ci#  define CURL_OFF_T_C(Val)  CURLINC_OFF_T_C_HLPR1(Val) ## \
48213498266Sopenharmony_ci                             CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
48313498266Sopenharmony_ci#  define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
48413498266Sopenharmony_ci                             CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
48513498266Sopenharmony_ci#else
48613498266Sopenharmony_ci#  ifdef CURL_ISOCPP
48713498266Sopenharmony_ci#    define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
48813498266Sopenharmony_ci#  else
48913498266Sopenharmony_ci#    define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
49013498266Sopenharmony_ci#  endif
49113498266Sopenharmony_ci#  define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix)
49213498266Sopenharmony_ci#  define CURL_OFF_T_C(Val)  CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
49313498266Sopenharmony_ci#  define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
49413498266Sopenharmony_ci#endif
49513498266Sopenharmony_ci
49613498266Sopenharmony_ci#endif /* CURLINC_SYSTEM_H */
497