]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/types.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_COMPAT_TYPES_H
10 #define SQUID_COMPAT_TYPES_H
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
17 * This file is only intended to be included via compat/compat.h, do
18 * not include directly.
21 /* This should be in synch with what we have in acinclude.m4 */
23 #include <sys/types.h>
25 #if HAVE_LINUX_TYPES_H
26 #include <linux/types.h>
37 #if HAVE_SYS_BITYPES_H
38 #include <sys/bitypes.h>
41 #include <sys/select.h>
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>
48 /******************************************************/
49 /* Typedefs for missing entries on a system */
50 /******************************************************/
53 * Ensure that standard type limits are defined for use
61 /* explicit bit sizes */
62 #if !defined(UINT32_MIN)
63 #define UINT32_MIN 0x00000000L
65 #if !defined(UINT32_MAX)
66 #define UINT32_MAX 0xFFFFFFFFL
70 #define INT_MAX 0x7FFFFFFFL // hack but a safe bet (32-bit signed integer)
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
79 #define INT64_MIN (-9223372036854775807LL-1LL)
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
89 #define INT64_MAX 9223372036854775807LL
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"
100 #define PRId64 "I64d"
101 #elif SIZEOF_INT64_T > SIZEOF_LONG
110 #define PRIu64 "I64u"
111 #elif SIZEOF_INT64_T > SIZEOF_LONG
120 #define PRIX64 "I64X"
121 #elif SIZEOF_INT64_T > SIZEOF_LONG
129 typedef unsigned short mode_t
;
133 typedef unsigned long fd_mask
;
136 #ifndef HAVE_SOCKLEN_T
137 typedef int socklen_t
;
148 #endif /* SQUID_COMPAT_TYPES_H */