Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.15.12 ]​[ nginx-1.16.0 ]​

0001 
0002 # Copyright (C) Igor Sysoev
0003 # Copyright (C) Nginx, Inc.
0004 
0005 
0006 have=NGX_LINUX . auto/have_headers
0007 
0008 CORE_INCS="$UNIX_INCS"
0009 CORE_DEPS="$UNIX_DEPS $LINUX_DEPS"
0010 CORE_SRCS="$UNIX_SRCS $LINUX_SRCS"
0011 
0012 ngx_spacer='
0013 '
0014 
0015 cc_aux_flags="$CC_AUX_FLAGS"
0016 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
0017 
0018 
0019 # Linux kernel version
0020 
0021 version=$((`uname -r \
0022     | sed -n -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/ \
0023                                                  \1*256*256+\2*256+\3/p' \
0024              -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1*256*256+\2*256/p'`))
0025 
0026 version=${version:-0}
0027 
0028 
0029 # posix_fadvise64() had been implemented in 2.5.60
0030 
0031 if [ $version -lt 132412 ]; then
0032     have=NGX_HAVE_POSIX_FADVISE . auto/nohave
0033 fi
0034 
0035 # epoll, EPOLLET version
0036 
0037 ngx_feature="epoll"
0038 ngx_feature_name="NGX_HAVE_EPOLL"
0039 ngx_feature_run=yes
0040 ngx_feature_incs="#include <sys/epoll.h>"
0041 ngx_feature_path=
0042 ngx_feature_libs=
0043 ngx_feature_test="int efd = 0;
0044                   struct epoll_event ee;
0045                   ee.events = EPOLLIN|EPOLLOUT|EPOLLET;
0046                   ee.data.ptr = NULL;
0047                   (void) ee;
0048                   efd = epoll_create(100);
0049                   if (efd == -1) return 1;"
0050 . auto/feature
0051 
0052 if [ $ngx_found = yes ]; then
0053     have=NGX_HAVE_CLEAR_EVENT . auto/have
0054     CORE_SRCS="$CORE_SRCS $EPOLL_SRCS"
0055     EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
0056     EVENT_FOUND=YES
0057 
0058 
0059     # EPOLLRDHUP appeared in Linux 2.6.17, glibc 2.8
0060 
0061     ngx_feature="EPOLLRDHUP"
0062     ngx_feature_name="NGX_HAVE_EPOLLRDHUP"
0063     ngx_feature_run=no
0064     ngx_feature_incs="#include <sys/epoll.h>"
0065     ngx_feature_path=
0066     ngx_feature_libs=
0067     ngx_feature_test="int efd = 0, fd = 0;
0068                       struct epoll_event ee;
0069                       ee.events = EPOLLIN|EPOLLRDHUP|EPOLLET;
0070                       ee.data.ptr = NULL;
0071                       epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
0072     . auto/feature
0073 
0074 
0075     # EPOLLEXCLUSIVE appeared in Linux 4.5, glibc 2.24
0076 
0077     ngx_feature="EPOLLEXCLUSIVE"
0078     ngx_feature_name="NGX_HAVE_EPOLLEXCLUSIVE"
0079     ngx_feature_run=no
0080     ngx_feature_incs="#include <sys/epoll.h>"
0081     ngx_feature_path=
0082     ngx_feature_libs=
0083     ngx_feature_test="int efd = 0, fd = 0;
0084                       struct epoll_event ee;
0085                       ee.events = EPOLLIN|EPOLLEXCLUSIVE;
0086                       ee.data.ptr = NULL;
0087                       epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
0088     . auto/feature
0089 fi
0090 
0091 
0092 # O_PATH and AT_EMPTY_PATH were introduced in 2.6.39, glibc 2.14
0093 
0094 ngx_feature="O_PATH"
0095 ngx_feature_name="NGX_HAVE_O_PATH"
0096 ngx_feature_run=no
0097 ngx_feature_incs="#include <sys/types.h>
0098                   #include <sys/stat.h>
0099                   #include <fcntl.h>"
0100 ngx_feature_path=
0101 ngx_feature_libs=
0102 ngx_feature_test="int fd; struct stat sb;
0103                   fd = openat(AT_FDCWD, \".\", O_PATH|O_DIRECTORY|O_NOFOLLOW);
0104                   if (fstatat(fd, \"\", &sb, AT_EMPTY_PATH) != 0) return 1"
0105 . auto/feature
0106 
0107 
0108 # sendfile()
0109 
0110 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE"
0111 ngx_feature="sendfile()"
0112 ngx_feature_name="NGX_HAVE_SENDFILE"
0113 ngx_feature_run=yes
0114 ngx_feature_incs="#include <sys/sendfile.h>
0115                   #include <errno.h>"
0116 ngx_feature_path=
0117 ngx_feature_libs=
0118 ngx_feature_test="int s = 0, fd = 1;
0119                   ssize_t n; off_t off = 0;
0120                   n = sendfile(s, fd, &off, 1);
0121                   if (n == -1 && errno == ENOSYS) return 1"
0122 . auto/feature
0123 
0124 if [ $ngx_found = yes ]; then
0125     CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS"
0126 fi
0127 
0128 
0129 # sendfile64()
0130 
0131 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
0132 ngx_feature="sendfile64()"
0133 ngx_feature_name="NGX_HAVE_SENDFILE64"
0134 ngx_feature_run=yes
0135 ngx_feature_incs="#include <sys/sendfile.h>
0136                   #include <errno.h>"
0137 ngx_feature_path=
0138 ngx_feature_libs=
0139 ngx_feature_test="int s = 0, fd = 1;
0140                   ssize_t n; off_t off = 0;
0141                   n = sendfile(s, fd, &off, 1);
0142                   if (n == -1 && errno == ENOSYS) return 1"
0143 . auto/feature
0144 
0145 
0146 ngx_include="sys/prctl.h"; . auto/include
0147 
0148 # prctl(PR_SET_DUMPABLE)
0149 
0150 ngx_feature="prctl(PR_SET_DUMPABLE)"
0151 ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE"
0152 ngx_feature_run=yes
0153 ngx_feature_incs="#include <sys/prctl.h>"
0154 ngx_feature_path=
0155 ngx_feature_libs=
0156 ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1"
0157 . auto/feature
0158 
0159 
0160 # prctl(PR_SET_KEEPCAPS)
0161 
0162 ngx_feature="prctl(PR_SET_KEEPCAPS)"
0163 ngx_feature_name="NGX_HAVE_PR_SET_KEEPCAPS"
0164 ngx_feature_run=yes
0165 ngx_feature_incs="#include <sys/prctl.h>"
0166 ngx_feature_path=
0167 ngx_feature_libs=
0168 ngx_feature_test="if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1) return 1"
0169 . auto/feature
0170 
0171 
0172 # capabilities
0173 
0174 ngx_feature="capabilities"
0175 ngx_feature_name="NGX_HAVE_CAPABILITIES"
0176 ngx_feature_run=no
0177 ngx_feature_incs="#include <linux/capability.h>
0178                   #include <sys/syscall.h>"
0179 ngx_feature_path=
0180 ngx_feature_libs=
0181 ngx_feature_test="struct __user_cap_data_struct    data;
0182                   struct __user_cap_header_struct  header;
0183 
0184                   header.version = _LINUX_CAPABILITY_VERSION_1;
0185                   data.effective = CAP_TO_MASK(CAP_NET_RAW);
0186                   data.permitted = 0;
0187 
0188                   (void) header;
0189                   (void) data;
0190                   (void) SYS_capset"
0191 . auto/feature
0192 
0193 
0194 # crypt_r()
0195 
0196 ngx_feature="crypt_r()"
0197 ngx_feature_name="NGX_HAVE_GNU_CRYPT_R"
0198 ngx_feature_run=no
0199 ngx_feature_incs="#include <crypt.h>"
0200 ngx_feature_path=
0201 ngx_feature_libs=-lcrypt
0202 ngx_feature_test="struct crypt_data  cd;
0203                   crypt_r(\"key\", \"salt\", &cd);"
0204 . auto/feature
0205 
0206 
0207 ngx_include="sys/vfs.h";     . auto/include
0208 
0209 
0210 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"