nginx几个重要的头文件
在分析nginx源代码时,我们看到几乎所有的源文件都会首先包含ngx_config.h
,ngx_core.h
这两个头文件。这两个头文件又包含一些其他头文件,其他头文件我们主要会介绍ngx_linux_config.h
,ngx_auto_headers.h
和ngx_auto_config.h
这三个。按头文件包含由里到外的顺序为:
-
ngx_auto_config.h (ngx_auto_headers.h)
-
ngx_linux_config.h
-
ngx_config.h
-
ngx_core.h
如下我们也按这个顺序来进行介绍。
1. ngx_auto_config.h头文件
ngx_auto_config.h
头文件是我们在配置编译时生成的,我们在这里在此列出以作参考:
#define NGX_CONFIGURE " --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11"
#ifndef NGX_COMPILER
#define NGX_COMPILER "gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) "
#endif
#ifndef NGX_HAVE_GCC_ATOMIC
#define NGX_HAVE_GCC_ATOMIC 1
#endif
#ifndef NGX_HAVE_C99_VARIADIC_MACROS
#define NGX_HAVE_C99_VARIADIC_MACROS 1
#endif
#ifndef NGX_HAVE_GCC_VARIADIC_MACROS
#define NGX_HAVE_GCC_VARIADIC_MACROS 1
#endif
#ifndef NGX_HAVE_GCC_BSWAP64
#define NGX_HAVE_GCC_BSWAP64 1
#endif
#ifndef NGX_HAVE_EPOLL
#define NGX_HAVE_EPOLL 1
#endif
#ifndef NGX_HAVE_CLEAR_EVENT
#define NGX_HAVE_CLEAR_EVENT 1
#endif
#ifndef NGX_HAVE_EPOLLRDHUP
#define NGX_HAVE_EPOLLRDHUP 1
#endif
#ifndef NGX_HAVE_O_PATH
#define NGX_HAVE_O_PATH 1
#endif
#ifndef NGX_HAVE_SENDFILE
#define NGX_HAVE_SENDFILE 1
#endif
#ifndef NGX_HAVE_SENDFILE64
#define NGX_HAVE_SENDFILE64 1
#endif
#ifndef NGX_HAVE_PR_SET_DUMPABLE
#define NGX_HAVE_PR_SET_DUMPABLE 1
#endif
#ifndef NGX_HAVE_SCHED_SETAFFINITY
#define NGX_HAVE_SCHED_SETAFFINITY 1
#endif
#ifndef NGX_HAVE_GNU_CRYPT_R
#define NGX_HAVE_GNU_CRYPT_R 1
#endif
#ifndef NGX_HAVE_NONALIGNED
#define NGX_HAVE_NONALIGNED 1
#endif
#ifndef NGX_CPU_CACHE_LINE
#define NGX_CPU_CACHE_LINE 32
#endif
#define NGX_KQUEUE_UDATA_T (void *)
#ifndef NGX_HAVE_POSIX_FADVISE
#define NGX_HAVE_POSIX_FADVISE 1
#endif
#ifndef NGX_HAVE_O_DIRECT
#define NGX_HAVE_O_DIRECT 1
#endif
#ifndef NGX_HAVE_ALIGNED_DIRECTIO
#define NGX_HAVE_ALIGNED_DIRECTIO 1
#endif
#ifndef NGX_HAVE_STATFS
#define NGX_HAVE_STATFS 1
#endif
#ifndef NGX_HAVE_STATVFS
#define NGX_HAVE_STATVFS 1
#endif
#ifndef NGX_HAVE_DLOPEN
#define NGX_HAVE_DLOPEN 1
#endif
#ifndef NGX_HAVE_SCHED_YIELD
#define NGX_HAVE_SCHED_YIELD 1
#endif
#ifndef NGX_HAVE_REUSEPORT
#define NGX_HAVE_REUSEPORT 1
#endif
#ifndef NGX_HAVE_IP_PKTINFO
#define NGX_HAVE_IP_PKTINFO 1
#endif
#ifndef NGX_HAVE_IPV6_RECVPKTINFO
#define NGX_HAVE_IPV6_RECVPKTINFO 1
#endif
#ifndef NGX_HAVE_DEFERRED_ACCEPT
#define NGX_HAVE_DEFERRED_ACCEPT 1
#endif
#ifndef NGX_HAVE_KEEPALIVE_TUNABLE
#define NGX_HAVE_KEEPALIVE_TUNABLE 1
#endif
#ifndef NGX_HAVE_TCP_FASTOPEN
#define NGX_HAVE_TCP_FASTOPEN 1
#endif
#ifndef NGX_HAVE_TCP_INFO
#define NGX_HAVE_TCP_INFO 1
#endif
#ifndef NGX_HAVE_ACCEPT4
#define NGX_HAVE_ACCEPT4 1
#endif
#ifndef NGX_HAVE_EVENTFD
#define NGX_HAVE_EVENTFD 1
#endif
#ifndef NGX_HAVE_SYS_EVENTFD_H
#define NGX_HAVE_SYS_EVENTFD_H 1
#endif
#ifndef NGX_HAVE_UNIX_DOMAIN
#define NGX_HAVE_UNIX_DOMAIN 1
#endif
#ifndef NGX_PTR_SIZE
#define NGX_PTR_SIZE 4
#endif
#ifndef NGX_SIG_ATOMIC_T_SIZE
#define NGX_SIG_ATOMIC_T_SIZE 4
#endif
#ifndef NGX_HAVE_LITTLE_ENDIAN
#define NGX_HAVE_LITTLE_ENDIAN 1
#endif
#ifndef NGX_MAX_SIZE_T_VALUE
#define NGX_MAX_SIZE_T_VALUE 2147483647
#endif
#ifndef NGX_SIZE_T_LEN
#define NGX_SIZE_T_LEN (sizeof("-2147483648") - 1)
#endif
#ifndef NGX_MAX_OFF_T_VALUE
#define NGX_MAX_OFF_T_VALUE 9223372036854775807LL
#endif
#ifndef NGX_OFF_T_LEN
#define NGX_OFF_T_LEN (sizeof("-9223372036854775808") - 1)
#endif
#ifndef NGX_TIME_T_SIZE
#define NGX_TIME_T_SIZE 4
#endif
#ifndef NGX_TIME_T_LEN
#define NGX_TIME_T_LEN (sizeof("-2147483648") - 1)
#endif
#ifndef NGX_MAX_TIME_T_VALUE
#define NGX_MAX_TIME_T_VALUE 2147483647
#endif
#ifndef NGX_HAVE_PREAD
#define NGX_HAVE_PREAD 1
#endif
#ifndef NGX_HAVE_PWRITE
#define NGX_HAVE_PWRITE 1
#endif
#ifndef NGX_HAVE_PWRITEV
#define NGX_HAVE_PWRITEV 1
#endif
#ifndef NGX_SYS_NERR
#define NGX_SYS_NERR 135
#endif
#ifndef NGX_HAVE_LOCALTIME_R
#define NGX_HAVE_LOCALTIME_R 1
#endif
#ifndef NGX_HAVE_POSIX_MEMALIGN
#define NGX_HAVE_POSIX_MEMALIGN 1
#endif
#ifndef NGX_HAVE_MEMALIGN
#define NGX_HAVE_MEMALIGN 1
#endif
#ifndef NGX_HAVE_MAP_ANON
#define NGX_HAVE_MAP_ANON 1
#endif
#ifndef NGX_HAVE_MAP_DEVZERO
#define NGX_HAVE_MAP_DEVZERO 1
#endif
#ifndef NGX_HAVE_SYSVSHM
#define NGX_HAVE_SYSVSHM 1
#endif
#ifndef NGX_HAVE_POSIX_SEM
#define NGX_HAVE_POSIX_SEM 1
#endif
#ifndef NGX_HAVE_MSGHDR_MSG_CONTROL
#define NGX_HAVE_MSGHDR_MSG_CONTROL 1
#endif
#ifndef NGX_HAVE_FIONBIO
#define NGX_HAVE_FIONBIO 1
#endif
#ifndef NGX_HAVE_GMTOFF
#define NGX_HAVE_GMTOFF 1
#endif
#ifndef NGX_HAVE_D_TYPE
#define NGX_HAVE_D_TYPE 1
#endif
#ifndef NGX_HAVE_SC_NPROCESSORS_ONLN
#define NGX_HAVE_SC_NPROCESSORS_ONLN 1
#endif
#ifndef NGX_HAVE_OPENAT
#define NGX_HAVE_OPENAT 1
#endif
#ifndef NGX_HAVE_GETADDRINFO
#define NGX_HAVE_GETADDRINFO 1
#endif
#ifndef NGX_HTTP_CACHE
#define NGX_HTTP_CACHE 1
#endif
#ifndef NGX_HTTP_GZIP
#define NGX_HTTP_GZIP 1
#endif
#ifndef NGX_HTTP_SSI
#define NGX_HTTP_SSI 1
#endif
#ifndef NGX_CRYPT
#define NGX_CRYPT 1
#endif
#ifndef NGX_HTTP_X_FORWARDED_FOR
#define NGX_HTTP_X_FORWARDED_FOR 1
#endif
#ifndef NGX_HTTP_SSL
#define NGX_HTTP_SSL 1
#endif
#ifndef NGX_HTTP_X_FORWARDED_FOR
#define NGX_HTTP_X_FORWARDED_FOR 1
#endif
#ifndef NGX_HTTP_UPSTREAM_ZONE
#define NGX_HTTP_UPSTREAM_ZONE 1
#endif
#ifndef NGX_PCRE
#define NGX_PCRE 1
#endif
#ifndef NGX_OPENSSL
#define NGX_OPENSSL 1
#endif
#ifndef NGX_SSL
#define NGX_SSL 1
#endif
#ifndef NGX_HAVE_OPENSSL_MD5_H
#define NGX_HAVE_OPENSSL_MD5_H 1
#endif
#ifndef NGX_OPENSSL_MD5
#define NGX_OPENSSL_MD5 1
#endif
#ifndef NGX_HAVE_MD5
#define NGX_HAVE_MD5 1
#endif
#ifndef NGX_HAVE_OPENSSL_SHA1_H
#define NGX_HAVE_OPENSSL_SHA1_H 1
#endif
#ifndef NGX_HAVE_SHA1
#define NGX_HAVE_SHA1 1
#endif
#ifndef NGX_ZLIB
#define NGX_ZLIB 1
#endif
#ifndef NGX_PREFIX
#define NGX_PREFIX "/usr/local/nginx/"
#endif
#ifndef NGX_CONF_PREFIX
#define NGX_CONF_PREFIX "/usr/local/nginx/"
#endif
#ifndef NGX_SBIN_PATH
#define NGX_SBIN_PATH "/usr/local/nginx/nginx"
#endif
#ifndef NGX_CONF_PATH
#define NGX_CONF_PATH "/usr/local/nginx/nginx.conf"
#endif
#ifndef NGX_PID_PATH
#define NGX_PID_PATH "/usr/local/nginx/nginx.pid"
#endif
#ifndef NGX_LOCK_PATH
#define NGX_LOCK_PATH "logs/nginx.lock"
#endif
#ifndef NGX_ERROR_LOG_PATH
#define NGX_ERROR_LOG_PATH "logs/error.log"
#endif
#ifndef NGX_HTTP_LOG_PATH
#define NGX_HTTP_LOG_PATH "logs/access.log"
#endif
#ifndef NGX_HTTP_CLIENT_TEMP_PATH
#define NGX_HTTP_CLIENT_TEMP_PATH "client_body_temp"
#endif
#ifndef NGX_HTTP_PROXY_TEMP_PATH
#define NGX_HTTP_PROXY_TEMP_PATH "proxy_temp"
#endif
#ifndef NGX_HTTP_FASTCGI_TEMP_PATH
#define NGX_HTTP_FASTCGI_TEMP_PATH "fastcgi_temp"
#endif
#ifndef NGX_HTTP_UWSGI_TEMP_PATH
#define NGX_HTTP_UWSGI_TEMP_PATH "uwsgi_temp"
#endif
#ifndef NGX_HTTP_SCGI_TEMP_PATH
#define NGX_HTTP_SCGI_TEMP_PATH "scgi_temp"
#endif
#ifndef NGX_SUPPRESS_WARN
#define NGX_SUPPRESS_WARN 1
#endif
#ifndef NGX_SMP
#define NGX_SMP 1
#endif
#ifndef NGX_USER
#define NGX_USER "nobody"
#endif
#ifndef NGX_GROUP
#define NGX_GROUP "nogroup"
#endif
ngx_auto_config.h
基本上在执行configure脚本时根据当前操作系统的特性所产生的一些配置。
2. ngx_auto_headers.h头文件
ngx_auto_headers.h
头文件是在执行configure脚本时产生的,主要是检测当前操作系统所支持的一些头文件:
#ifndef NGX_HAVE_UNISTD_H
#define NGX_HAVE_UNISTD_H 1
#endif
#ifndef NGX_HAVE_INTTYPES_H
#define NGX_HAVE_INTTYPES_H 1
#endif
#ifndef NGX_HAVE_LIMITS_H
#define NGX_HAVE_LIMITS_H 1
#endif
#ifndef NGX_HAVE_SYS_PARAM_H
#define NGX_HAVE_SYS_PARAM_H 1
#endif
#ifndef NGX_HAVE_SYS_MOUNT_H
#define NGX_HAVE_SYS_MOUNT_H 1
#endif
#ifndef NGX_HAVE_SYS_STATVFS_H
#define NGX_HAVE_SYS_STATVFS_H 1
#endif
#ifndef NGX_HAVE_CRYPT_H
#define NGX_HAVE_CRYPT_H 1
#endif
#ifndef NGX_LINUX
#define NGX_LINUX 1
#endif
#ifndef NGX_HAVE_SYS_PRCTL_H
#define NGX_HAVE_SYS_PRCTL_H 1
#endif
#ifndef NGX_HAVE_SYS_VFS_H
#define NGX_HAVE_SYS_VFS_H 1
#endif
3. os/unix/ngx_linux_config.h头文件
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_LINUX_CONFIG_H_INCLUDED_
#define _NGX_LINUX_CONFIG_H_INCLUDED_
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* pread(), pwrite(), gethostname() */
#endif
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdarg.h>
#include <stddef.h> /* offsetof() */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <pwd.h>
#include <grp.h>
#include <dirent.h>
#include <glob.h>
#include <sys/vfs.h> /* statfs() */
#include <sys/uio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sched.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h> /* TCP_NODELAY, TCP_CORK */
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/un.h>
#include <time.h> /* tzset() */
#include <malloc.h> /* memalign() */
#include <limits.h> /* IOV_MAX */
#include <sys/ioctl.h>
#include <crypt.h>
#include <sys/utsname.h> /* uname() */
#include <dlfcn.h>
#include <ngx_auto_config.h>
#if (NGX_HAVE_POSIX_SEM)
#include <semaphore.h>
#endif
#if (NGX_HAVE_SYS_PRCTL_H)
#include <sys/prctl.h>
#endif
#if (NGX_HAVE_SENDFILE64)
#include <sys/sendfile.h>
#else
extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
#define NGX_SENDFILE_LIMIT 0x80000000
#endif
#if (NGX_HAVE_POLL)
#include <poll.h>
#endif
#if (NGX_HAVE_EPOLL)
#include <sys/epoll.h>
#endif
#if (NGX_HAVE_SYS_EVENTFD_H)
#include <sys/eventfd.h>
#endif
#include <sys/syscall.h>
#if (NGX_HAVE_FILE_AIO)
#include <linux/aio_abi.h>
typedef struct iocb ngx_aiocb_t;
#endif
#define NGX_LISTEN_BACKLOG 511
#ifndef NGX_HAVE_SO_SNDLOWAT
/* setsockopt(SO_SNDLOWAT) returns ENOPROTOOPT */
#define NGX_HAVE_SO_SNDLOWAT 0
#endif
#ifndef NGX_HAVE_INHERITED_NONBLOCK
#define NGX_HAVE_INHERITED_NONBLOCK 0
#endif
#define NGX_HAVE_OS_SPECIFIC_INIT 1
#define ngx_debug_init()
extern char **environ;
#endif /* _NGX_LINUX_CONFIG_H_INCLUDED_ */
如上我们看到ngx_linux_config.h
头文件也是一个很基础的头文件,参照我们configure执行时的相应特性:
-
NGX_HAVE_POSIX_SEM
: 值为1 -
NGX_HAVE_SYS_PRCTL_H
: 值为1 -
NGX_HAVE_SENDFILE64
: 值为1 -
NGX_HAVE_POLL
: 没有定义,值为0 -
NGX_HAVE_EPOLL
: 值为1 -
NGX_HAVE_SYS_EVENTFD_H
: 值为1 -
NGX_HAVE_FILE_AIO
: 没有定义,值为0 -
NGX_HAVE_SO_SNDLOWAT
: 没有定义 -
NGX_HAVE_INHERITED_NONBLOCK
: 没有定义
extern char **environ
其一般是定义在操作系统posix/environ.c中。该变量在我们可执行程序启动时操作系统就会自动为我们赋值。看如下测试程序test2.c:
#include <stdio.h>
#include <stdlib.h>
extern char**environ;
int main(int argc,char *argv[])
{
char **p = NULL;
if (environ == NULL)
printf("environ is NULL\n");
else{
for(p = environ; *p; p++)
{
printf("%s\n",*p);
}
}
return 0x0;
}
编译运行:
[root@localhost test-src]# gcc -o test2 test2.c [root@localhost test-src]# ./test2 XDG_SESSION_ID=23 HOSTNAME=localhost.localdomain SELINUX_ROLE_REQUESTED= TERM=vt100 SHELL=/bin/bash HISTSIZE=1000 SSH_CLIENT=192.168.69.1 49180 22 SELINUX_USE_CURRENT_RANGE= SSH_TTY=/dev/pts/2 JRE_HOME=/usr/java/jdk1.8.0_131/jre USER=root LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01; //此处部分删减 MAIL=/var/spool/mail/root PATH=/usr/java/jdk1.8.0_131//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin PWD=/root/test-src JAVA_HOME=/usr/java/jdk1.8.0_131/ LANG=en_US.UTF-8 SELINUX_LEVEL_REQUESTED= HISTCONTROL=ignoredups SHLVL=1 HOME=/root LOGNAME=root CLASSPATH=/usr/java/jdk1.8.0_131//lib:/usr/java/jdk1.8.0_131/jre/lib: SSH_CONNECTION=192.168.69.1 49180 192.168.69.128 22 PKG_CONFIG_PATH=:/usr/local/lib/pkgconfig/ LESSOPEN=||/usr/bin/lesspipe.sh %s XDG_RUNTIME_DIR=/run/user/0 _=./test2 OLDPWD=/root
与我们直接调用如下命令得到的结果一致:
# env
4. core/ngx_config.h头文件
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_CONFIG_H_INCLUDED_
#define _NGX_CONFIG_H_INCLUDED_
#include <ngx_auto_headers.h>
#if defined __DragonFly__ && !defined __FreeBSD__
#define __FreeBSD__ 4
#define __FreeBSD_version 480101
#endif
#if (NGX_FREEBSD)
#include <ngx_freebsd_config.h>
#elif (NGX_LINUX)
#include <ngx_linux_config.h>
#elif (NGX_SOLARIS)
#include <ngx_solaris_config.h>
#elif (NGX_DARWIN)
#include <ngx_darwin_config.h>
#elif (NGX_WIN32)
#include <ngx_win32_config.h>
#else /* POSIX */
#include <ngx_posix_config.h>
#endif
#ifndef NGX_HAVE_SO_SNDLOWAT
#define NGX_HAVE_SO_SNDLOWAT 1
#endif
#if !(NGX_WIN32)
#define ngx_signal_helper(n) SIG##n
#define ngx_signal_value(n) ngx_signal_helper(n)
#define ngx_random random
/* TODO: #ifndef */
#define NGX_SHUTDOWN_SIGNAL QUIT
#define NGX_TERMINATE_SIGNAL TERM
#define NGX_NOACCEPT_SIGNAL WINCH
#define NGX_RECONFIGURE_SIGNAL HUP
#if (NGX_LINUXTHREADS)
#define NGX_REOPEN_SIGNAL INFO
#define NGX_CHANGEBIN_SIGNAL XCPU
#else
#define NGX_REOPEN_SIGNAL USR1
#define NGX_CHANGEBIN_SIGNAL USR2
#endif
#define ngx_cdecl
#define ngx_libc_cdecl
#endif
typedef intptr_t ngx_int_t;
typedef uintptr_t ngx_uint_t;
typedef intptr_t ngx_flag_t;
#define NGX_INT32_LEN (sizeof("-2147483648") - 1)
#define NGX_INT64_LEN (sizeof("-9223372036854775808") - 1)
#if (NGX_PTR_SIZE == 4)
#define NGX_INT_T_LEN NGX_INT32_LEN
#define NGX_MAX_INT_T_VALUE 2147483647
#else
#define NGX_INT_T_LEN NGX_INT64_LEN
#define NGX_MAX_INT_T_VALUE 9223372036854775807
#endif
#ifndef NGX_ALIGNMENT
#define NGX_ALIGNMENT sizeof(unsigned long) /* platform word */
#endif
#define ngx_align(d, a) (((d) + (a - 1)) & ~(a - 1))
#define ngx_align_ptr(p, a) \
(u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1))
#define ngx_abort abort
/* TODO: platform specific: array[NGX_INVALID_ARRAY_INDEX] must cause SIGSEGV */
#define NGX_INVALID_ARRAY_INDEX 0x80000000
/* TODO: auto_conf: ngx_inline inline __inline __inline__ */
#ifndef ngx_inline
#define ngx_inline inline
#endif
#ifndef INADDR_NONE /* Solaris */
#define INADDR_NONE ((unsigned int) -1)
#endif
#ifdef MAXHOSTNAMELEN
#define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN
#else
#define NGX_MAXHOSTNAMELEN 256
#endif
#define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffff
#define NGX_MAX_INT32_VALUE (uint32_t) 0x7fffffff
#endif /* _NGX_CONFIG_H_INCLUDED_ */
-
NGX_LINUX
: 值为1 -
NGX_LINUXTHREADS
: 没有定义 -
NGX_PTR_SIZE
: 值为4 -
NGX_ALIGNMENT
: 没有定义
5. core/ngx_core.h头文件
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_CORE_H_INCLUDED_
#define _NGX_CORE_H_INCLUDED_
#include <ngx_config.h>
typedef struct ngx_module_s ngx_module_t;
typedef struct ngx_conf_s ngx_conf_t;
typedef struct ngx_cycle_s ngx_cycle_t;
typedef struct ngx_pool_s ngx_pool_t;
typedef struct ngx_chain_s ngx_chain_t;
typedef struct ngx_log_s ngx_log_t;
typedef struct ngx_open_file_s ngx_open_file_t;
typedef struct ngx_command_s ngx_command_t;
typedef struct ngx_file_s ngx_file_t;
typedef struct ngx_event_s ngx_event_t;
typedef struct ngx_event_aio_s ngx_event_aio_t;
typedef struct ngx_connection_s ngx_connection_t;
#if (NGX_THREADS)
typedef struct ngx_thread_task_s ngx_thread_task_t;
#endif
typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
#define NGX_OK 0
#define NGX_ERROR -1
#define NGX_AGAIN -2
#define NGX_BUSY -3
#define NGX_DONE -4
#define NGX_DECLINED -5
#define NGX_ABORT -6
#include <ngx_errno.h>
#include <ngx_atomic.h>
#include <ngx_thread.h>
#include <ngx_rbtree.h>
#include <ngx_time.h>
#include <ngx_socket.h>
#include <ngx_string.h>
#include <ngx_files.h>
#include <ngx_shmem.h>
#include <ngx_process.h>
#include <ngx_user.h>
#include <ngx_dlopen.h>
#include <ngx_parse.h>
#include <ngx_parse_time.h>
#include <ngx_log.h>
#include <ngx_alloc.h>
#include <ngx_palloc.h>
#include <ngx_buf.h>
#include <ngx_queue.h>
#include <ngx_array.h>
#include <ngx_list.h>
#include <ngx_hash.h>
#include <ngx_file.h>
#include <ngx_crc.h>
#include <ngx_crc32.h>
#include <ngx_murmurhash.h>
#if (NGX_PCRE)
#include <ngx_regex.h>
#endif
#include <ngx_radix_tree.h>
#include <ngx_times.h>
#include <ngx_rwlock.h>
#include <ngx_shmtx.h>
#include <ngx_slab.h>
#include <ngx_inet.h>
#include <ngx_cycle.h>
#include <ngx_resolver.h>
#if (NGX_OPENSSL)
#include <ngx_event_openssl.h>
#endif
#include <ngx_process_cycle.h>
#include <ngx_conf_file.h>
#include <ngx_module.h>
#include <ngx_open_file_cache.h>
#include <ngx_os.h>
#include <ngx_connection.h>
#include <ngx_syslog.h>
#include <ngx_proxy_protocol.h>
#define LF (u_char) '\n'
#define CR (u_char) '\r'
#define CRLF "\r\n"
#define ngx_abs(value) (((value) >= 0) ? (value) : - (value))
#define ngx_max(val1, val2) ((val1 < val2) ? (val2) : (val1))
#define ngx_min(val1, val2) ((val1 > val2) ? (val2) : (val1))
void ngx_cpuinfo(void);
#if (NGX_HAVE_OPENAT)
#define NGX_DISABLE_SYMLINKS_OFF 0
#define NGX_DISABLE_SYMLINKS_ON 1
#define NGX_DISABLE_SYMLINKS_NOTOWNER 2
#endif
#endif /* _NGX_CORE_H_INCLUDED_ */
-
NGX_THREADS
: 没有定义 -
NGX_PCRE
: 值为1 -
NGX_OPENSSL
: 值为1 -
NGX_HAVE_OPENAT
: 值为1