src/core/ngx_config.h - nginx source code

Data types defined

Macros defined

Source code


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


  5. #ifndef _NGX_CONFIG_H_INCLUDED_
  6. #define _NGX_CONFIG_H_INCLUDED_


  7. #include <ngx_auto_headers.h>


  8. #if defined __DragonFly__ && !defined __FreeBSD__
  9. #define __FreeBSD__        4
  10. #define __FreeBSD_version  480101
  11. #endif


  12. #if (NGX_FREEBSD)
  13. #include <ngx_freebsd_config.h>


  14. #elif (NGX_LINUX)
  15. #include <ngx_linux_config.h>


  16. #elif (NGX_SOLARIS)
  17. #include <ngx_solaris_config.h>


  18. #elif (NGX_DARWIN)
  19. #include <ngx_darwin_config.h>


  20. #elif (NGX_WIN32)
  21. #include <ngx_win32_config.h>


  22. #else /* POSIX */
  23. #include <ngx_posix_config.h>

  24. #endif


  25. #ifndef NGX_HAVE_SO_SNDLOWAT
  26. #define NGX_HAVE_SO_SNDLOWAT     1
  27. #endif


  28. #if !(NGX_WIN32)

  29. #define ngx_signal_helper(n)     SIG##n
  30. #define ngx_signal_value(n)      ngx_signal_helper(n)

  31. #define ngx_random               random

  32. /* TODO: #ifndef */
  33. #define NGX_SHUTDOWN_SIGNAL      QUIT
  34. #define NGX_TERMINATE_SIGNAL     TERM
  35. #define NGX_NOACCEPT_SIGNAL      WINCH
  36. #define NGX_RECONFIGURE_SIGNAL   HUP

  37. #if (NGX_LINUXTHREADS)
  38. #define NGX_REOPEN_SIGNAL        INFO
  39. #define NGX_CHANGEBIN_SIGNAL     XCPU
  40. #else
  41. #define NGX_REOPEN_SIGNAL        USR1
  42. #define NGX_CHANGEBIN_SIGNAL     USR2
  43. #endif

  44. #define ngx_cdecl
  45. #define ngx_libc_cdecl

  46. #endif

  47. typedef intptr_t        ngx_int_t;
  48. typedef uintptr_t       ngx_uint_t;
  49. typedef intptr_t        ngx_flag_t;


  50. #define NGX_INT32_LEN   (sizeof("-2147483648") - 1)
  51. #define NGX_INT64_LEN   (sizeof("-9223372036854775808") - 1)

  52. #if (NGX_PTR_SIZE == 4)
  53. #define NGX_INT_T_LEN   NGX_INT32_LEN
  54. #define NGX_MAX_INT_T_VALUE  2147483647

  55. #else
  56. #define NGX_INT_T_LEN   NGX_INT64_LEN
  57. #define NGX_MAX_INT_T_VALUE  9223372036854775807
  58. #endif


  59. #ifndef NGX_ALIGNMENT
  60. #define NGX_ALIGNMENT   sizeof(unsigned long)    /* platform word */
  61. #endif

  62. #define ngx_align(d, a)     (((d) + (a - 1)) & ~(a - 1))
  63. #define ngx_align_ptr(p, a)                                                   \
  64.     (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))


  65. #define ngx_abort       abort


  66. /* TODO: platform specific: array[NGX_INVALID_ARRAY_INDEX] must cause SIGSEGV */
  67. #define NGX_INVALID_ARRAY_INDEX 0x80000000


  68. /* TODO: auto_conf: ngx_inline   inline __inline __inline__ */
  69. #ifndef ngx_inline
  70. #define ngx_inline      inline
  71. #endif

  72. #ifndef INADDR_NONE  /* Solaris */
  73. #define INADDR_NONE  ((unsigned int) -1)
  74. #endif

  75. #ifdef MAXHOSTNAMELEN
  76. #define NGX_MAXHOSTNAMELEN  MAXHOSTNAMELEN
  77. #else
  78. #define NGX_MAXHOSTNAMELEN  256
  79. #endif


  80. #define NGX_MAX_UINT32_VALUE  (uint32_t) 0xffffffff
  81. #define NGX_MAX_INT32_VALUE   (uint32_t) 0x7fffffff


  82. #if (NGX_COMPAT)

  83. #define NGX_COMPAT_BEGIN(slots)  uint64_t spare[slots];
  84. #define NGX_COMPAT_END

  85. #else

  86. #define NGX_COMPAT_BEGIN(slots)
  87. #define NGX_COMPAT_END

  88. #endif


  89. #endif /* _NGX_CONFIG_H_INCLUDED_ */