]>
Commit | Line | Data |
---|---|---|
77d6bd88 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 The Squid Software Foundation and contributors |
77d6bd88 | 3 | * |
37be9888 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
9 | #ifndef SQUID_TYPES_H | |
10 | #define SQUID_TYPES_H | |
11 | ||
12 | /* | |
77d6bd88 | 13 | * Here are defined several known-width types, obtained via autoconf |
14 | * from system locations or various attempts. This is just a convenience | |
15 | * header to include which takes care of proper preprocessor stuff | |
a6443f51 | 16 | * |
489520a9 | 17 | * This file is only intended to be included via compat/compat.h, do |
a6443f51 | 18 | * not include directly. |
77d6bd88 | 19 | */ |
20 | ||
0a4e8536 | 21 | /* This should be in synch with what we have in acinclude.m4 */ |
a9245686 | 22 | #if HAVE_SYS_TYPES_H |
23 | #include <sys/types.h> | |
24 | #endif | |
d2422105 AJ |
25 | #if HAVE_LINUX_TYPES_H |
26 | #include <linux/types.h> | |
27 | #endif | |
489520a9 | 28 | #if HAVE_STDLIB_H |
0a4e8536 | 29 | #include <stdlib.h> |
489520a9 AJ |
30 | #endif |
31 | #if HAVE_STDDEF_H | |
0a4e8536 | 32 | #include <stddef.h> |
33 | #endif | |
34 | #if HAVE_INTTYPES_H | |
35 | #include <inttypes.h> | |
36 | #endif | |
0a4e8536 | 37 | #if HAVE_SYS_BITYPES_H |
38 | #include <sys/bitypes.h> | |
39 | #endif | |
eea70fbb | 40 | #if HAVE_SYS_SELECT_H |
41 | #include <sys/select.h> | |
42 | #endif | |
dc8596bb AJ |
43 | #if HAVE_NETINET_IN_SYSTM_H |
44 | /* Several OS require types declared by in_systm.h without including it themselves. */ | |
45 | #include <netinet/in_systm.h> | |
46 | #endif | |
77d6bd88 | 47 | |
489520a9 AJ |
48 | /******************************************************/ |
49 | /* Typedefs for missing entries on a system */ | |
50 | /******************************************************/ | |
51 | ||
c5dd4956 | 52 | /* |
4d883d1f | 53 | * ISO C99 Standard printf() macros for 64 bit integers |
54 | * On some 64 bit platform, HP Tru64 is one, for printf must be used | |
c5dd4956 | 55 | * "%lx" instead of "%llx" |
4d883d1f | 56 | */ |
57 | #ifndef PRId64 | |
7aa9bb3e | 58 | #if _SQUID_WINDOWS_ |
4d883d1f | 59 | #define PRId64 "I64d" |
60 | #elif SIZEOF_INT64_T > SIZEOF_LONG | |
61 | #define PRId64 "lld" | |
62 | #else | |
63 | #define PRId64 "ld" | |
64 | #endif | |
65 | #endif | |
66 | ||
67 | #ifndef PRIu64 | |
7aa9bb3e | 68 | #if _SQUID_WINDOWS_ |
4d883d1f | 69 | #define PRIu64 "I64u" |
70 | #elif SIZEOF_INT64_T > SIZEOF_LONG | |
71 | #define PRIu64 "llu" | |
72 | #else | |
73 | #define PRIu64 "lu" | |
74 | #endif | |
75 | #endif | |
76 | ||
4ad60609 | 77 | #ifndef PRIX64 |
7aa9bb3e | 78 | #if _SQUID_WINDOWS_ |
4ad60609 AR |
79 | #define PRIX64 "I64X" |
80 | #elif SIZEOF_INT64_T > SIZEOF_LONG | |
81 | #define PRIX64 "llX" | |
82 | #else | |
83 | #define PRIX64 "lX" | |
84 | #endif | |
85 | #endif | |
86 | ||
fe1e5c91 AJ |
87 | #ifndef PRIuSIZE |
88 | // NP: configure checks for support of %zu and defines where possible | |
89 | #if SIZEOF_SIZE_T == 4 && _SQUID_MINGW_ | |
90 | #define PRIuSIZE "I32u" | |
91 | #elif SIZEOF_SIZE_T == 4 | |
92 | #define PRIuSIZE "u" | |
93 | #elif SIZEOF_SIZE_T == 8 && _SQUID_MINGW_ | |
94 | #define PRIuSIZE "I64u" | |
95 | #elif SIZEOF_SIZE_T == 8 | |
96 | #define PRIuSIZE "lu" | |
97 | #else | |
98 | #error size_t is not 32-bit or 64-bit | |
99 | #endif | |
100 | #endif /* PRIuSIZE */ | |
101 | ||
489520a9 AJ |
102 | #ifndef HAVE_MODE_T |
103 | typedef unsigned short mode_t; | |
104 | #endif | |
105 | ||
106 | #ifndef HAVE_FD_MASK | |
107 | typedef unsigned long fd_mask; | |
108 | #endif | |
109 | ||
110 | #ifndef HAVE_SOCKLEN_T | |
111 | typedef int socklen_t; | |
112 | #endif | |
113 | ||
114 | #ifndef HAVE_MTYP_T | |
115 | typedef long mtyp_t; | |
116 | #endif | |
117 | ||
a203dec7 AJ |
118 | #ifndef NULL |
119 | #if defined(__cplusplus) && HAVE_NULLPTR | |
120 | #define NULL nullptr | |
121 | #else | |
122 | #define NULL 0 | |
123 | #endif | |
124 | #endif | |
125 | ||
b5638623 | 126 | #endif /* SQUID_TYPES_H */ |
f53969cc | 127 |