]> git.ipfire.org Git - thirdparty/squid.git/blame - compat/os/linux.h
SourceFormat Enforcement
[thirdparty/squid.git] / compat / os / linux.h
CommitLineData
37be9888 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
37be9888
AJ
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
f04e1182
AJ
9#ifndef SQUID_OS_LINUX_H
10#define SQUID_OS_LINUX_H
11
1191b93b 12#if _SQUID_LINUX_
f04e1182
AJ
13
14/****************************************************************************
15 *--------------------------------------------------------------------------*
16 * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
17 *--------------------------------------------------------------------------*
18 ****************************************************************************/
19
f04e1182
AJ
20#if USE_ASYNC_IO
21#define _SQUID_LINUX_THREADS_
22#endif
23
819656da
AJ
24/*
25 * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
26 */
27#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
28#define res_init __res_init
29#define HAVE_RES_INIT HAVE___RES_INIT
30#endif
31
43713e72
FC
32/*
33 * Netfilter header madness. (see Bug 4323)
34 *
35 * Netfilter have a history of defining their own versions of network protocol
36 * primitives without sufficient protection against the POSIX defines which are
37 * aways present in Linux.
38 *
39 * netinet/in.h must be included before any other sys header in order to properly
40 * activate include guards in <linux/libc-compat.h> the kernel maintainers added
41 * to workaround it.
42 */
43#if HAVE_NETINET_IN_H
44#include <netinet/in.h>
45#endif
46
bc8dfb10
AJ
47/*
48 * sys/capability.h is only needed in Linux apparently.
49 *
5b43d209 50 * HACK: LIBCAP_BROKEN Ugly glue to get around linux header madness colliding with glibc
bc8dfb10
AJ
51 */
52#if HAVE_SYS_CAPABILITY_H
53
5b43d209 54#if LIBCAP_BROKEN
bc8dfb10
AJ
55#undef _POSIX_SOURCE
56#define _LINUX_TYPES_H
57#define _LINUX_FS_H
58typedef uint32_t __u32;
59#endif
60
61#include <sys/capability.h>
62#endif /* HAVE_SYS_CAPABILITY_H */
63
92ca76f7
AJ
64/*
65 * glob.h is provided by GNU on Linux and contains some unavoidable preprocessor
66 * logic errors in its 64-bit definitions which are hit by non-GCC compilers.
67 *
68 * #if __USE_FILE_OFFSET64 && __GNUC__ < 2
69 * # define glob glob64
70 * #endif
71 * #if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2
72 * extern "C" glob(...);
73 * #endif
74 * extern "C" glob64(...);
75 *
76 * ... and multiple "C" definitions of glob64 refuse to compile.
77 * Because __GNUC__ being undefined equates to 0 and (0 < 2)
78 */
79#if __USE_FILE_OFFSET64 && __GNUC__ < 2
80#if HAVE_GLOB_H
81#undef HAVE_GLOB_H
82#endif
83#if HAVE_GLOB
84#undef HAVE_GLOB
85#endif
86#endif
bc8dfb10 87
f04e1182
AJ
88#endif /* _SQUID_LINUX_ */
89#endif /* SQUID_OS_LINUX_H */
f53969cc 90