src/core/ngx_config.h - nginx-1.7.10

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. #else
  55. #define NGX_INT_T_LEN   NGX_INT64_LEN
  56. #endif


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

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


  63. #define ngx_abort       abort


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


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

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

  73. #ifdef MAXHOSTNAMELEN
  74. #define NGX_MAXHOSTNAMELEN  MAXHOSTNAMELEN
  75. #else
  76. #define NGX_MAXHOSTNAMELEN  256
  77. #endif


  78. #if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
  79. #define NGX_MAX_UINT32_VALUE  (uint32_t) 0xffffffffLL
  80. #else
  81. #define NGX_MAX_UINT32_VALUE  (uint32_t) 0xffffffff
  82. #endif

  83. #define NGX_MAX_INT32_VALUE   (uint32_t) 0x7fffffff


  84. #endif /* _NGX_CONFIG_H_INCLUDED_ */