src/os/win32/ngx_win32_config.h - nginx-1.31.9 nginx/ @ 2a3a19c6f

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 <shellapi.h>
  30. #include <stddef.h>    /* offsetof() */

  31. #ifdef __MINGW64_VERSION_MAJOR

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

  34. #elif defined __GNUC__

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

  38. #endif

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

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

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


  53. #ifdef _MSC_VER

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

  56. #pragma warning(default:4201)

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

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

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

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

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

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

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

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

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

  75. #endif


  76. #ifdef __WATCOMC__

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

  79. #endif


  80. #ifdef __BORLANDC__

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

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

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

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

  89. #endif


  90. #include <ngx_auto_config.h>


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


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

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

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

  108. #endif

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

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


  115. #ifndef __MINGW64_VERSION_MAJOR

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

  119. #endif


  120. #ifdef __WATCOMC__

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

  125. #elif __BORLANDC__

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

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

  130. #endif


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


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


  141. #ifdef _WIN64

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

  148. #else

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

  155. #endif


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


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


  161. ‌#define NGX_WIN_NT        200000


  162. ‌#define NGX_LISTEN_BACKLOG           511


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

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

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

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

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

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

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

  186. ‌#define NGX_HAVE_GETADDRINFO         1

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

  191. ‌#define ngx_debug_init()


  192. #endif /* _NGX_WIN32_CONFIG_H_INCLUDED_ */