aboutsummaryrefslogtreecommitdiff
path: root/src/lib/sysfdsetsize.c
blob: 4929b3d29598c9c7fb32c62dcf2fed18f11f3d9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
  This file is part of libmicrohttpd
  Copyright (C) 2015 Karlson2k (Evgeny Grin)

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

/**
 * @file microhttpd/sysfdsetsize.c
 * @brief  Helper for obtaining FD_SETSIZE system default value
 * @author Karlson2k (Evgeny Grin)
 */


#include "MHD_config.h"

#ifdef FD_SETSIZE
/* FD_SETSIZE was defined before system headers. */
/* To get system value of FD_SETSIZE, undefine FD_SETSIZE
   here. */
#undef FD_SETSIZE
#endif /* FD_SETSIZE */

#include <stdlib.h>
#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
#include <sockLib.h>
#endif /* OS_VXWORKS */
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#if HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif /* HAVE_SYS_SOCKET_H */

#if defined(_WIN32) && ! defined(__CYGWIN__)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif /* !WIN32_LEAN_AND_MEAN */
#include <winsock2.h>
#endif /* _WIN32 && !__CYGWIN__ */

#ifndef FD_SETSIZE
#error FD_SETSIZE must be defined in system headers
#endif /* !FD_SETSIZE */

#include "sysfdsetsize.h"

/**
 * Get system default value of FD_SETSIZE
 * @return system default value of FD_SETSIZE
 */
int
get_system_fdsetsize_value (void)
{
  return FD_SETSIZE;
}