diff options
Diffstat (limited to 'src/lib/sysfdsetsize.c')
-rw-r--r-- | src/lib/sysfdsetsize.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/lib/sysfdsetsize.c b/src/lib/sysfdsetsize.c new file mode 100644 index 00000000..fe7fba75 --- /dev/null +++ b/src/lib/sysfdsetsize.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2015 Karlson2k (Evgeny Grin) | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file microhttpd/sysfdsetsize.c | ||
22 | * @brief Helper for obtaining FD_SETSIZE system default value | ||
23 | * @author Karlson2k (Evgeny Grin) | ||
24 | */ | ||
25 | |||
26 | |||
27 | #include "MHD_config.h" | ||
28 | |||
29 | #ifdef FD_SETSIZE | ||
30 | /* FD_SETSIZE was defined before system headers. */ | ||
31 | /* To get system value of FD_SETSIZE, undefine FD_SETSIZE | ||
32 | here. */ | ||
33 | #undef FD_SETSIZE | ||
34 | #endif /* FD_SETSIZE */ | ||
35 | |||
36 | #include <stdlib.h> | ||
37 | #if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) | ||
38 | #include <sockLib.h> | ||
39 | #endif /* OS_VXWORKS */ | ||
40 | #if HAVE_SYS_SELECT_H | ||
41 | #include <sys/select.h> | ||
42 | #endif /* HAVE_SYS_SELECT_H */ | ||
43 | #if HAVE_SYS_TYPES_H | ||
44 | #include <sys/types.h> | ||
45 | #endif /* HAVE_SYS_TYPES_H */ | ||
46 | #if HAVE_SYS_TIME_H | ||
47 | #include <sys/time.h> | ||
48 | #endif /* HAVE_SYS_TIME_H */ | ||
49 | #if HAVE_TIME_H | ||
50 | #include <time.h> | ||
51 | #endif /* HAVE_TIME_H */ | ||
52 | #ifdef HAVE_UNISTD_H | ||
53 | #include <unistd.h> | ||
54 | #endif /* HAVE_UNISTD_H */ | ||
55 | #if HAVE_SYS_SOCKET_H | ||
56 | #include <sys/socket.h> | ||
57 | #endif /* HAVE_SYS_SOCKET_H */ | ||
58 | |||
59 | #if defined(_WIN32) && !defined(__CYGWIN__) | ||
60 | #ifndef WIN32_LEAN_AND_MEAN | ||
61 | #define WIN32_LEAN_AND_MEAN 1 | ||
62 | #endif /* !WIN32_LEAN_AND_MEAN */ | ||
63 | #include <winsock2.h> | ||
64 | #endif /* _WIN32 && !__CYGWIN__ */ | ||
65 | |||
66 | #ifndef FD_SETSIZE | ||
67 | #error FD_SETSIZE must be defined in system headers | ||
68 | #endif /* !FD_SETSIZE */ | ||
69 | |||
70 | #include "sysfdsetsize.h" | ||
71 | |||
72 | /** | ||
73 | * Get system default value of FD_SETSIZE | ||
74 | * @return system default value of FD_SETSIZE | ||
75 | */ | ||
76 | int | ||
77 | get_system_fdsetsize_value (void) | ||
78 | { | ||
79 | return FD_SETSIZE; | ||
80 | } | ||