]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/types.h
Merged from trunk (r12181, v3.2.0.17+)
[thirdparty/squid.git] / compat / types.h
1 /*
2 * * * * * * * * Legal stuff * * * * * * *
3 *
4 * (C) 2000 Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * SQUID Web Proxy Cache http://www.squid-cache.org/
19 * ----------------------------------------------------------
20 *
21 * Squid is the result of efforts by numerous individuals from
22 * the Internet community; see the CONTRIBUTORS file for full
23 * details. Many organizations have provided support for Squid's
24 * development; see the SPONSORS file for full details. Squid is
25 * Copyrighted (C) 2001 by the Regents of the University of
26 * California; see the COPYRIGHT file for full details. Squid
27 * incorporates software developed and/or copyrighted by other
28 * sources; see the CREDITS file for full details.
29 *
30 * This program is free software; you can redistribute it and/or modify
31 * it under the terms of the GNU General Public License as published by
32 * the Free Software Foundation; either version 2 of the License, or
33 * (at your option) any later version.
34 *
35 * This program is distributed in the hope that it will be useful,
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 * GNU General Public License for more details.
39 *
40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
43 *
44 * * * * * * * * Declaration of intents * * * * * * *
45 *
46 * Here are defined several known-width types, obtained via autoconf
47 * from system locations or various attempts. This is just a convenience
48 * header to include which takes care of proper preprocessor stuff
49 *
50 * This file is only intended to be included via compat/compat.h, do
51 * not include directly.
52 */
53
54 #ifndef SQUID_TYPES_H
55 #define SQUID_TYPES_H
56
57 /* This should be in synch with what we have in acinclude.m4 */
58 #if HAVE_SYS_TYPES_H
59 #include <sys/types.h>
60 #endif
61 #if HAVE_LINUX_TYPES_H
62 #include <linux/types.h>
63 #endif
64 #if HAVE_STDLIB_H
65 #include <stdlib.h>
66 #endif
67 #if HAVE_STDDEF_H
68 #include <stddef.h>
69 #endif
70 #if HAVE_INTTYPES_H
71 #include <inttypes.h>
72 #endif
73 #if HAVE_SYS_BITYPES_H
74 #include <sys/bitypes.h>
75 #endif
76 #if HAVE_SYS_SELECT_H
77 #include <sys/select.h>
78 #endif
79 #if HAVE_NETINET_IN_SYSTM_H
80 /* Several OS require types declared by in_systm.h without including it themselves. */
81 #include <netinet/in_systm.h>
82 #endif
83
84
85 /******************************************************/
86 /* Typedefs for missing entries on a system */
87 /******************************************************/
88
89
90 /*
91 * ISO C99 Standard printf() macros for 64 bit integers
92 * On some 64 bit platform, HP Tru64 is one, for printf must be used
93 * "%lx" instead of "%llx"
94 */
95 #ifndef PRId64
96 #if _SQUID_MSWIN_ /* Windows native port using MSVCRT */
97 #define PRId64 "I64d"
98 #elif SIZEOF_INT64_T > SIZEOF_LONG
99 #define PRId64 "lld"
100 #else
101 #define PRId64 "ld"
102 #endif
103 #endif
104
105 #ifndef PRIu64
106 #if _SQUID_MSWIN_ /* Windows native port using MSVCRT */
107 #define PRIu64 "I64u"
108 #elif SIZEOF_INT64_T > SIZEOF_LONG
109 #define PRIu64 "llu"
110 #else
111 #define PRIu64 "lu"
112 #endif
113 #endif
114
115 #ifndef PRIX64
116 #if _SQUID_MSWIN_ /* Windows native port using MSVCRT */
117 #define PRIX64 "I64X"
118 #elif SIZEOF_INT64_T > SIZEOF_LONG
119 #define PRIX64 "llX"
120 #else
121 #define PRIX64 "lX"
122 #endif
123 #endif
124
125 #ifndef PRIuSIZE
126 // NP: configure checks for support of %zu and defines where possible
127 #if SIZEOF_SIZE_T == 4 && _SQUID_MINGW_
128 #define PRIuSIZE "I32u"
129 #elif SIZEOF_SIZE_T == 4
130 #define PRIuSIZE "u"
131 #elif SIZEOF_SIZE_T == 8 && _SQUID_MINGW_
132 #define PRIuSIZE "I64u"
133 #elif SIZEOF_SIZE_T == 8
134 #define PRIuSIZE "lu"
135 #else
136 #error size_t is not 32-bit or 64-bit
137 #endif
138 #endif /* PRIuSIZE */
139
140 #ifndef HAVE_MODE_T
141 typedef unsigned short mode_t;
142 #endif
143
144 #ifndef HAVE_FD_MASK
145 typedef unsigned long fd_mask;
146 #endif
147
148 #ifndef HAVE_SOCKLEN_T
149 typedef int socklen_t;
150 #endif
151
152 #ifndef HAVE_MTYP_T
153 typedef long mtyp_t;
154 #endif
155
156 #ifndef NULL
157 #if defined(__cplusplus) && HAVE_NULLPTR
158 #define NULL nullptr
159 #else
160 #define NULL 0
161 #endif
162 #endif
163
164 #endif /* SQUID_TYPES_H */