]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/fdsetsize.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_FDSETSIZE_H
10 #define SQUID_COMPAT_FDSETSIZE_H
12 /****************************************************************************
13 *--------------------------------------------------------------------------*
14 * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
15 *--------------------------------------------------------------------------*
16 ****************************************************************************/
19 * On some systems, FD_SETSIZE is set to something lower than the
20 * actual number of files which can be opened. IRIX is one case,
21 * NetBSD is another. So here we increase FD_SETSIZE to our
22 * configure-discovered maximum *before* any system includes.
24 #define CHANGE_FD_SETSIZE 1
27 * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
28 * with glibc 2.2 (or later? remains to be seen). We do this by including
29 * bits/types.h which defines __FD_SETSIZE first, then we redefine
30 * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
31 * directly, so this is a dirty hack!
33 #if _SQUID_LINUX_ || _SQUID_KFREEBSD_
34 #undef CHANGE_FD_SETSIZE
35 #define CHANGE_FD_SETSIZE 0
37 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
38 #if SQUID_MAXFD > DEFAULT_FD_SETSIZE
39 #include <bits/types.h>
40 #if HAVE_LINUX_POSIX_TYPES_H
41 #include <linux/posix_types.h>
44 #define __FD_SETSIZE SQUID_MAXFD
50 * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
52 * --Marian Durkovic <marian@svf.stuba.sk>
53 * --Peter Wemm <peter@spinner.DIALix.COM>
56 #include <osreldate.h>
57 #if __FreeBSD_version < 220000
58 #undef CHANGE_FD_SETSIZE
59 #define CHANGE_FD_SETSIZE 0
64 * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
68 #undef CHANGE_FD_SETSIZE
69 #define CHANGE_FD_SETSIZE 0
72 /* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
73 #if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
74 #define FD_SETSIZE SQUID_MAXFD
78 * Trap unintentional use of fd_set. Must not be used outside the
79 * select code as it only supports FD_SETSIZE number of filedescriptors
80 * and Squid may be running with a lot more..
81 * But only for code linked into Squid, not the helpers.. (unlinkd, pinger)
83 #ifdef SQUID_FDSET_NOUSE
85 # define fd_set ERROR_FD_SET_USED
89 #endif /* SQUID_COMPAT_FDSETSIZE_H */