Squid Web Cache
v8/master
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3
*
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_COMPAT_TYPES_H
10
#define SQUID_COMPAT_TYPES_H
11
12
/*
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
16
*
17
* This file is only intended to be included via compat/compat.h, do
18
* not include directly.
19
*/
20
21
/* This should be in synch with what we have in acinclude.m4 */
22
#if HAVE_SYS_TYPES_H
23
#include <sys/types.h>
24
#endif
25
#if HAVE_LINUX_TYPES_H
26
#include <linux/types.h>
27
#endif
28
#if HAVE_STDLIB_H
29
#include <stdlib.h>
30
#endif
31
#if HAVE_STDDEF_H
32
#include <stddef.h>
33
#endif
34
#if HAVE_INTTYPES_H
35
#include <inttypes.h>
36
#endif
37
#if HAVE_SYS_BITYPES_H
38
#include <sys/bitypes.h>
39
#endif
40
#if HAVE_SYS_SELECT_H
41
#include <sys/select.h>
42
#endif
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
47
48
/******************************************************/
49
/* Typedefs for missing entries on a system */
50
/******************************************************/
51
52
/*
53
* Ensure that standard type limits are defined for use
54
*/
55
#if __cplusplus
56
#include <cstdint>
57
#elif HAVE_STDINT_H
58
#include <stdint.h>
59
#endif
60
61
/* explicit bit sizes */
62
#if !defined(UINT32_MIN)
63
#define UINT32_MIN 0x00000000L
64
#endif
65
#if !defined(UINT32_MAX)
66
#define UINT32_MAX 0xFFFFFFFFL
67
#endif
68
69
#if !defined(INT_MAX)
70
#define INT_MAX 0x7FFFFFFFL
// hack but a safe bet (32-bit signed integer)
71
#endif
72
73
#if !defined(INT64_MIN)
74
/* Native 64 bit system without strtoll() */
75
#if defined(LONG_MIN) && (SIZEOF_LONG == 8)
76
#define INT64_MIN LONG_MIN
77
#else
78
/* 32 bit system */
79
#define INT64_MIN (-9223372036854775807LL-1LL)
80
#endif
81
#endif
82
83
#if !defined(INT64_MAX)
84
/* Native 64 bit system without strtoll() */
85
#if defined(LONG_MAX) && (SIZEOF_LONG == 8)
86
#define INT64_MAX LONG_MAX
87
#else
88
/* 32 bit system */
89
#define INT64_MAX 9223372036854775807LL
90
#endif
91
#endif
92
93
/*
94
* ISO C99 Standard printf() macros for 64 bit integers
95
* On some 64 bit platform, HP Tru64 is one, for printf must be used
96
* "%lx" instead of "%llx"
97
*/
98
#ifndef PRId64
99
#if _SQUID_WINDOWS_
100
#define PRId64 "I64d"
101
#elif SIZEOF_INT64_T > SIZEOF_LONG
102
#define PRId64 "lld"
103
#else
104
#define PRId64 "ld"
105
#endif
106
#endif
107
108
#ifndef PRIu64
109
#if _SQUID_WINDOWS_
110
#define PRIu64 "I64u"
111
#elif SIZEOF_INT64_T > SIZEOF_LONG
112
#define PRIu64 "llu"
113
#else
114
#define PRIu64 "lu"
115
#endif
116
#endif
117
118
#ifndef PRIX64
119
#if _SQUID_WINDOWS_
120
#define PRIX64 "I64X"
121
#elif SIZEOF_INT64_T > SIZEOF_LONG
122
#define PRIX64 "llX"
123
#else
124
#define PRIX64 "lX"
125
#endif
126
#endif
127
128
#ifndef HAVE_MODE_T
129
typedef
unsigned
short
mode_t
;
130
#endif
131
132
#ifndef HAVE_FD_MASK
133
typedef
unsigned
long
fd_mask
;
134
#endif
135
136
#ifndef HAVE_SOCKLEN_T
137
typedef
int
socklen_t
;
138
#endif
139
140
#ifndef HAVE_MTYP_T
141
typedef
long
mtyp_t
;
142
#endif
143
144
#ifndef NULL
145
#define NULL 0
146
#endif
147
148
#endif
/* SQUID_COMPAT_TYPES_H */
149
mode_t
unsigned short mode_t
Definition
types.h:129
socklen_t
int socklen_t
Definition
types.h:137
mtyp_t
long mtyp_t
Definition
types.h:141
fd_mask
unsigned long fd_mask
Definition
types.h:133
squid
compat
types.h
Generated by
1.9.8