src/os/win32/ngx_win32_config.h - nginx-1.31.7 nginx/ @ 939334eff

Data types defined

Macros defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #ifndef _NGX_WIN32_CONFIG_H_INCLUDED_
  6. ‌#define _NGX_WIN32_CONFIG_H_INCLUDED_


  7. #undef  WIN32
  8. ‌#define WIN32         0x0400
  9. ‌#define _WIN32_WINNT  0x0501


  10. ‌#define STRICT
  11. ‌#define WIN32_LEAN_AND_MEAN

  12. /* enable getenv() and gmtime() in msvc8 */
  13. ‌#define _CRT_SECURE_NO_WARNINGS
  14. ‌#define _CRT_SECURE_NO_DEPRECATE

  15. /* enable gethostbyname() in msvc2015 */
  16. #if !(NGX_HAVE_INET6)
  17. ‌#define _WINSOCK_DEPRECATED_NO_WARNINGS
  18. #endif

  19. /*
  20. * we need to include <windows.h> explicitly before <winsock2.h> because
  21. * the warning 4201 is enabled in <windows.h>
  22. */
  23. #include <windows.h>

  24. #ifdef _MSC_VER
  25. #pragma warning(disable:4201)
  26. #endif

  27. #include <winsock2.h>
  28. #include <ws2tcpip.h>  /* ipv6 */
  29. #include <mswsock.h>
  30. #include <shellapi.h>
  31. #include <stddef.h>    /* offsetof() */

  32. #ifdef __MINGW64_VERSION_MAJOR

  33. /* GCC MinGW-w64 supports _FILE_OFFSET_BITS */
  34. ‌#define _FILE_OFFSET_BITS 64

  35. #elif defined __GNUC__

  36. /* GCC MinGW's stdio.h includes sys/types.h */
  37. ‌#define _OFF_T_
  38. ‌#define __have_typedef_off_t

  39. #endif

  40. #include <stdio.h>
  41. #include <stdlib.h>
  42. #include <stdarg.h>
  43. #ifdef __GNUC__
  44. #include <stdint.h>
  45. #endif
  46. #include <ctype.h>
  47. #include <locale.h>

  48. #ifdef __WATCOMC__
  49. ‌#define _TIME_T_DEFINED
  50. ‌typedef long  time_t;
  51. /* OpenWatcom defines time_t as "unsigned long" */
  52. #endif

  53. #include <time.h>      /* localtime(), strftime() */


  54. #ifdef _MSC_VER

  55. /* the end of the precompiled headers */
  56. #pragma hdrstop

  57. #pragma warning(default:4201)

  58. /* 'type cast': from function pointer to data pointer */
  59. #pragma warning(disable:4054)

  60. /* 'type cast': from data pointer to function pointer */
  61. #pragma warning(disable:4055)

  62. /* 'function' : different 'const' qualifiers */
  63. #pragma warning(disable:4090)

  64. /* unreferenced formal parameter */
  65. #pragma warning(disable:4100)

  66. /* FD_SET() and FD_CLR(): conditional expression is constant */
  67. #pragma warning(disable:4127)

  68. /* conversion from 'type1' to 'type2', possible loss of data */
  69. #pragma warning(disable:4244)

  70. /* conversion from 'size_t' to 'type', possible loss of data */
  71. #pragma warning(disable:4267)

  72. /* array is too small to include a terminating null character */
  73. #pragma warning(disable:4295)

  74. /* conversion from 'type1' to 'type2' of greater size */
  75. #pragma warning(disable:4306)

  76. #endif


  77. #ifdef __WATCOMC__

  78. /* symbol 'ngx_rbtree_min' has been defined, but not referenced */
  79. #pragma disable_message(202)

  80. #endif


  81. #ifdef __BORLANDC__

  82. /* the end of the precompiled headers */
  83. #pragma hdrstop

  84. /* functions containing (for|while|some if) are not expanded inline */
  85. #pragma warn -8027

  86. /* unreferenced formal parameter */
  87. #pragma warn -8057

  88. /* suspicious pointer arithmetic */
  89. #pragma warn -8072

  90. #endif


  91. #include <ngx_auto_config.h>


  92. ‌#define ngx_inline          __inline
  93. ‌#define ngx_cdecl           __cdecl


  94. #ifdef _MSC_VER
  95. ‌typedef unsigned __int32    uint32_t;
  96. ‌typedef __int32             int32_t;
  97. ‌typedef unsigned __int16    uint16_t;
  98. ‌#define ngx_libc_cdecl      __cdecl

  99. #elif defined __BORLANDC__
  100. ‌typedef unsigned __int32    uint32_t;
  101. ‌typedef __int32             int32_t;
  102. ‌typedef unsigned __int16    uint16_t;
  103. ‌#define ngx_libc_cdecl      __cdecl

  104. #else /* __WATCOMC__ */
  105. ‌typedef unsigned int        uint32_t;
  106. ‌typedef int                 int32_t;
  107. ‌typedef unsigned short int  uint16_t;
  108. ‌#define ngx_libc_cdecl

  109. #endif

  110. ‌typedef __int64             int64_t;
  111. ‌typedef unsigned __int64    uint64_t;

  112. #if __BORLANDC__
  113. ‌typedef int                 intptr_t;
  114. ‌typedef u_int               uintptr_t;
  115. #endif


  116. #ifndef __MINGW64_VERSION_MAJOR

  117. /* Windows defines off_t as long, which is 32-bit */
  118. ‌typedef __int64             off_t;
  119. ‌#define _OFF_T_DEFINED

  120. #endif


  121. #ifdef __WATCOMC__

  122. /* off_t is redefined by sys/types.h used by zlib.h */
  123. ‌#define __TYPES_H_INCLUDED
  124. ‌typedef int                 dev_t;
  125. ‌typedef unsigned int        ino_t;

  126. #elif __BORLANDC__

  127. /* off_t is redefined by sys/types.h used by zlib.h */
  128. ‌#define __TYPES_H

  129. ‌typedef int                 dev_t;
  130. ‌typedef unsigned int        ino_t;

  131. #endif


  132. #ifndef __GNUC__
  133. #ifdef _WIN64
  134. ‌typedef __int64             ssize_t;
  135. #else
  136. ‌typedef int                 ssize_t;
  137. #endif
  138. #endif


  139. ‌typedef uint32_t            in_addr_t;
  140. ‌typedef u_short             in_port_t;
  141. ‌typedef int                 sig_atomic_t;


  142. #ifdef _WIN64

  143. ‌#define NGX_PTR_SIZE            8
  144. ‌#define NGX_SIZE_T_LEN          (sizeof("-9223372036854775808") - 1)
  145. ‌#define NGX_MAX_SIZE_T_VALUE    9223372036854775807
  146. ‌#define NGX_TIME_T_LEN          (sizeof("-9223372036854775808") - 1)
  147. ‌#define NGX_TIME_T_SIZE         8
  148. ‌#define NGX_MAX_TIME_T_VALUE    9223372036854775807

  149. #else

  150. ‌#define NGX_PTR_SIZE            4
  151. ‌#define NGX_SIZE_T_LEN          (sizeof("-2147483648") - 1)
  152. ‌#define NGX_MAX_SIZE_T_VALUE    2147483647
  153. ‌#define NGX_TIME_T_LEN          (sizeof("-2147483648") - 1)
  154. ‌#define NGX_TIME_T_SIZE         4
  155. ‌#define NGX_MAX_TIME_T_VALUE    2147483647

  156. #endif


  157. ‌#define NGX_OFF_T_LEN           (sizeof("-9223372036854775807") - 1)
  158. ‌#define NGX_MAX_OFF_T_VALUE     9223372036854775807
  159. ‌#define NGX_SIG_ATOMIC_T_SIZE   4


  160. ‌#define NGX_HAVE_LITTLE_ENDIAN  1
  161. ‌#define NGX_HAVE_NONALIGNED     1


  162. ‌#define NGX_WIN_NT        200000


  163. ‌#define NGX_LISTEN_BACKLOG           511


  164. #ifndef NGX_HAVE_INHERITED_NONBLOCK
  165. ‌#define NGX_HAVE_INHERITED_NONBLOCK  1
  166. #endif

  167. #ifndef NGX_HAVE_CASELESS_FILESYSTEM
  168. ‌#define NGX_HAVE_CASELESS_FILESYSTEM  1
  169. #endif

  170. #ifndef NGX_HAVE_WIN32_TRANSMITPACKETS
  171. ‌#define NGX_HAVE_WIN32_TRANSMITPACKETS  1
  172. ‌#define NGX_HAVE_WIN32_TRANSMITFILE     0
  173. #endif

  174. #ifndef NGX_HAVE_WIN32_TRANSMITFILE
  175. ‌#define NGX_HAVE_WIN32_TRANSMITFILE  1
  176. #endif

  177. #if (NGX_HAVE_WIN32_TRANSMITPACKETS) || (NGX_HAVE_WIN32_TRANSMITFILE)
  178. ‌#define NGX_HAVE_SENDFILE  1
  179. #endif

  180. #ifndef NGX_HAVE_SO_SNDLOWAT
  181. /* setsockopt(SO_SNDLOWAT) returns error WSAENOPROTOOPT */
  182. ‌#define NGX_HAVE_SO_SNDLOWAT         0
  183. #endif

  184. #ifndef NGX_HAVE_FIONREAD
  185. ‌#define NGX_HAVE_FIONREAD            1
  186. #endif

  187. ‌#define NGX_HAVE_GETADDRINFO         1

  188. ‌#define ngx_random()                                                          \
  189.     ((long) (0x7fffffff & ( ((uint32_t) rand() << 16)                         \
  190.                           ^ ((uint32_t) rand() << 8)                          \
  191.                           ^ ((uint32_t) rand()) )))

  192. ‌#define ngx_debug_init()


  193. #endif /* _NGX_WIN32_CONFIG_H_INCLUDED_ */