nginxtra 1.0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/bin/nginxtra +5 -0
- data/lib/nginxtra.rb +12 -0
- data/lib/nginxtra/action.rb +36 -0
- data/lib/nginxtra/actions/compile.rb +60 -0
- data/lib/nginxtra/actions/install.rb +99 -0
- data/lib/nginxtra/actions/reload.rb +14 -0
- data/lib/nginxtra/actions/restart.rb +15 -0
- data/lib/nginxtra/actions/start.rb +53 -0
- data/lib/nginxtra/actions/status.rb +31 -0
- data/lib/nginxtra/actions/stop.rb +14 -0
- data/lib/nginxtra/cli.rb +77 -0
- data/lib/nginxtra/config.rb +339 -0
- data/lib/nginxtra/error.rb +13 -0
- data/lib/nginxtra/status.rb +57 -0
- data/src/nginx/CHANGES +5630 -0
- data/src/nginx/CHANGES.ru +5716 -0
- data/src/nginx/LICENSE +25 -0
- data/src/nginx/README +3 -0
- data/src/nginx/auto/cc/acc +15 -0
- data/src/nginx/auto/cc/bcc +72 -0
- data/src/nginx/auto/cc/ccc +46 -0
- data/src/nginx/auto/cc/conf +189 -0
- data/src/nginx/auto/cc/gcc +183 -0
- data/src/nginx/auto/cc/icc +121 -0
- data/src/nginx/auto/cc/msvc +138 -0
- data/src/nginx/auto/cc/name +101 -0
- data/src/nginx/auto/cc/owc +104 -0
- data/src/nginx/auto/cc/sunc +158 -0
- data/src/nginx/auto/define +12 -0
- data/src/nginx/auto/endianess +45 -0
- data/src/nginx/auto/feature +123 -0
- data/src/nginx/auto/have +12 -0
- data/src/nginx/auto/have_headers +12 -0
- data/src/nginx/auto/headers +13 -0
- data/src/nginx/auto/include +61 -0
- data/src/nginx/auto/init +51 -0
- data/src/nginx/auto/install +184 -0
- data/src/nginx/auto/lib/conf +83 -0
- data/src/nginx/auto/lib/geoip/conf +79 -0
- data/src/nginx/auto/lib/google-perftools/conf +45 -0
- data/src/nginx/auto/lib/libatomic/conf +43 -0
- data/src/nginx/auto/lib/libatomic/make +14 -0
- data/src/nginx/auto/lib/libgd/conf +83 -0
- data/src/nginx/auto/lib/libxslt/conf +156 -0
- data/src/nginx/auto/lib/make +32 -0
- data/src/nginx/auto/lib/md5/conf +103 -0
- data/src/nginx/auto/lib/md5/make +96 -0
- data/src/nginx/auto/lib/md5/makefile.bcc +22 -0
- data/src/nginx/auto/lib/md5/makefile.msvc +22 -0
- data/src/nginx/auto/lib/md5/makefile.owc +11 -0
- data/src/nginx/auto/lib/openssl/conf +74 -0
- data/src/nginx/auto/lib/openssl/make +67 -0
- data/src/nginx/auto/lib/openssl/makefile.bcc +18 -0
- data/src/nginx/auto/lib/openssl/makefile.msvc +14 -0
- data/src/nginx/auto/lib/pcre/conf +180 -0
- data/src/nginx/auto/lib/pcre/make +64 -0
- data/src/nginx/auto/lib/pcre/makefile.bcc +26 -0
- data/src/nginx/auto/lib/pcre/makefile.msvc +22 -0
- data/src/nginx/auto/lib/pcre/makefile.owc +24 -0
- data/src/nginx/auto/lib/perl/conf +60 -0
- data/src/nginx/auto/lib/perl/make +36 -0
- data/src/nginx/auto/lib/sha1/conf +79 -0
- data/src/nginx/auto/lib/sha1/make +96 -0
- data/src/nginx/auto/lib/sha1/makefile.bcc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.msvc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.owc +11 -0
- data/src/nginx/auto/lib/test +40 -0
- data/src/nginx/auto/lib/zlib/conf +76 -0
- data/src/nginx/auto/lib/zlib/make +114 -0
- data/src/nginx/auto/lib/zlib/makefile.bcc +15 -0
- data/src/nginx/auto/lib/zlib/makefile.msvc +14 -0
- data/src/nginx/auto/lib/zlib/makefile.owc +14 -0
- data/src/nginx/auto/lib/zlib/patch.zlib.h +10 -0
- data/src/nginx/auto/make +417 -0
- data/src/nginx/auto/modules +479 -0
- data/src/nginx/auto/nohave +12 -0
- data/src/nginx/auto/options +490 -0
- data/src/nginx/auto/os/conf +105 -0
- data/src/nginx/auto/os/darwin +116 -0
- data/src/nginx/auto/os/freebsd +136 -0
- data/src/nginx/auto/os/linux +152 -0
- data/src/nginx/auto/os/solaris +60 -0
- data/src/nginx/auto/os/win32 +29 -0
- data/src/nginx/auto/sources +518 -0
- data/src/nginx/auto/stubs +8 -0
- data/src/nginx/auto/summary +114 -0
- data/src/nginx/auto/types/sizeof +83 -0
- data/src/nginx/auto/types/typedef +77 -0
- data/src/nginx/auto/types/uintptr_t +42 -0
- data/src/nginx/auto/types/value +12 -0
- data/src/nginx/auto/unix +719 -0
- data/src/nginx/conf/fastcgi.conf +24 -0
- data/src/nginx/conf/fastcgi_params +23 -0
- data/src/nginx/conf/koi-utf +109 -0
- data/src/nginx/conf/koi-win +103 -0
- data/src/nginx/conf/mime.types +80 -0
- data/src/nginx/conf/nginx.conf +118 -0
- data/src/nginx/conf/scgi_params +15 -0
- data/src/nginx/conf/uwsgi_params +15 -0
- data/src/nginx/conf/win-utf +126 -0
- data/src/nginx/configure +108 -0
- data/src/nginx/contrib/README +15 -0
- data/src/nginx/contrib/geo2nginx.pl +58 -0
- data/src/nginx/contrib/unicode2nginx/koi-utf +131 -0
- data/src/nginx/contrib/unicode2nginx/unicode-to-nginx.pl +45 -0
- data/src/nginx/contrib/unicode2nginx/win-utf +130 -0
- data/src/nginx/html/50x.html +18 -0
- data/src/nginx/html/index.html +8 -0
- data/src/nginx/man/nginx.8 +202 -0
- data/src/nginx/src/core/nginx.c +1333 -0
- data/src/nginx/src/core/nginx.h +20 -0
- data/src/nginx/src/core/ngx_array.c +147 -0
- data/src/nginx/src/core/ngx_array.h +53 -0
- data/src/nginx/src/core/ngx_buf.c +218 -0
- data/src/nginx/src/core/ngx_buf.h +162 -0
- data/src/nginx/src/core/ngx_conf_file.c +1506 -0
- data/src/nginx/src/core/ngx_conf_file.h +348 -0
- data/src/nginx/src/core/ngx_config.h +134 -0
- data/src/nginx/src/core/ngx_connection.c +1074 -0
- data/src/nginx/src/core/ngx_connection.h +195 -0
- data/src/nginx/src/core/ngx_core.h +95 -0
- data/src/nginx/src/core/ngx_cpuinfo.c +139 -0
- data/src/nginx/src/core/ngx_crc.h +39 -0
- data/src/nginx/src/core/ngx_crc32.c +129 -0
- data/src/nginx/src/core/ngx_crc32.h +79 -0
- data/src/nginx/src/core/ngx_crypt.c +238 -0
- data/src/nginx/src/core/ngx_crypt.h +20 -0
- data/src/nginx/src/core/ngx_cycle.c +1379 -0
- data/src/nginx/src/core/ngx_cycle.h +142 -0
- data/src/nginx/src/core/ngx_file.c +993 -0
- data/src/nginx/src/core/ngx_file.h +151 -0
- data/src/nginx/src/core/ngx_hash.c +976 -0
- data/src/nginx/src/core/ngx_hash.h +122 -0
- data/src/nginx/src/core/ngx_inet.c +1008 -0
- data/src/nginx/src/core/ngx_inet.h +120 -0
- data/src/nginx/src/core/ngx_list.c +71 -0
- data/src/nginx/src/core/ngx_list.h +83 -0
- data/src/nginx/src/core/ngx_log.c +459 -0
- data/src/nginx/src/core/ngx_log.h +250 -0
- data/src/nginx/src/core/ngx_md5.c +289 -0
- data/src/nginx/src/core/ngx_md5.h +60 -0
- data/src/nginx/src/core/ngx_murmurhash.c +50 -0
- data/src/nginx/src/core/ngx_murmurhash.h +19 -0
- data/src/nginx/src/core/ngx_open_file_cache.c +882 -0
- data/src/nginx/src/core/ngx_open_file_cache.h +119 -0
- data/src/nginx/src/core/ngx_output_chain.c +673 -0
- data/src/nginx/src/core/ngx_palloc.c +433 -0
- data/src/nginx/src/core/ngx_palloc.h +95 -0
- data/src/nginx/src/core/ngx_parse.c +249 -0
- data/src/nginx/src/core/ngx_parse.h +24 -0
- data/src/nginx/src/core/ngx_queue.c +80 -0
- data/src/nginx/src/core/ngx_queue.h +112 -0
- data/src/nginx/src/core/ngx_radix_tree.c +291 -0
- data/src/nginx/src/core/ngx_radix_tree.h +46 -0
- data/src/nginx/src/core/ngx_rbtree.c +383 -0
- data/src/nginx/src/core/ngx_rbtree.h +84 -0
- data/src/nginx/src/core/ngx_regex.c +206 -0
- data/src/nginx/src/core/ngx_regex.h +56 -0
- data/src/nginx/src/core/ngx_resolver.c +2201 -0
- data/src/nginx/src/core/ngx_resolver.h +149 -0
- data/src/nginx/src/core/ngx_sha1.h +31 -0
- data/src/nginx/src/core/ngx_shmtx.c +284 -0
- data/src/nginx/src/core/ngx_shmtx.h +38 -0
- data/src/nginx/src/core/ngx_slab.c +701 -0
- data/src/nginx/src/core/ngx_slab.h +54 -0
- data/src/nginx/src/core/ngx_spinlock.c +53 -0
- data/src/nginx/src/core/ngx_string.c +1837 -0
- data/src/nginx/src/core/ngx_string.h +231 -0
- data/src/nginx/src/core/ngx_times.c +407 -0
- data/src/nginx/src/core/ngx_times.h +51 -0
- data/src/nginx/src/event/modules/ngx_aio_module.c +171 -0
- data/src/nginx/src/event/modules/ngx_devpoll_module.c +569 -0
- data/src/nginx/src/event/modules/ngx_epoll_module.c +833 -0
- data/src/nginx/src/event/modules/ngx_eventport_module.c +602 -0
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +785 -0
- data/src/nginx/src/event/modules/ngx_poll_module.c +443 -0
- data/src/nginx/src/event/modules/ngx_rtsig_module.c +735 -0
- data/src/nginx/src/event/modules/ngx_select_module.c +435 -0
- data/src/nginx/src/event/modules/ngx_win32_select_module.c +400 -0
- data/src/nginx/src/event/ngx_event.c +1275 -0
- data/src/nginx/src/event/ngx_event.h +573 -0
- data/src/nginx/src/event/ngx_event_accept.c +428 -0
- data/src/nginx/src/event/ngx_event_busy_lock.c +286 -0
- data/src/nginx/src/event/ngx_event_busy_lock.h +65 -0
- data/src/nginx/src/event/ngx_event_connect.c +258 -0
- data/src/nginx/src/event/ngx_event_connect.h +76 -0
- data/src/nginx/src/event/ngx_event_mutex.c +70 -0
- data/src/nginx/src/event/ngx_event_openssl.c +2382 -0
- data/src/nginx/src/event/ngx_event_openssl.h +162 -0
- data/src/nginx/src/event/ngx_event_pipe.c +996 -0
- data/src/nginx/src/event/ngx_event_pipe.h +95 -0
- data/src/nginx/src/event/ngx_event_posted.c +173 -0
- data/src/nginx/src/event/ngx_event_posted.h +75 -0
- data/src/nginx/src/event/ngx_event_timer.c +159 -0
- data/src/nginx/src/event/ngx_event_timer.h +102 -0
- data/src/nginx/src/http/modules/ngx_http_access_module.c +384 -0
- data/src/nginx/src/http/modules/ngx_http_addition_filter_module.c +250 -0
- data/src/nginx/src/http/modules/ngx_http_auth_basic_module.c +478 -0
- data/src/nginx/src/http/modules/ngx_http_autoindex_module.c +701 -0
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +713 -0
- data/src/nginx/src/http/modules/ngx_http_charset_filter_module.c +1681 -0
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_dav_module.c +1141 -0
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +243 -0
- data/src/nginx/src/http/modules/ngx_http_empty_gif_module.c +140 -0
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +2916 -0
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +254 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +1441 -0
- data/src/nginx/src/http/modules/ngx_http_geoip_module.c +671 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +1206 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +299 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +616 -0
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1489 -0
- data/src/nginx/src/http/modules/ngx_http_index_module.c +516 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +809 -0
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +553 -0
- data/src/nginx/src/http/modules/ngx_http_log_module.c +1357 -0
- data/src/nginx/src/http/modules/ngx_http_map_module.c +575 -0
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +624 -0
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +3000 -0
- data/src/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +143 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +2831 -0
- data/src/nginx/src/http/modules/ngx_http_random_index_module.c +317 -0
- data/src/nginx/src/http/modules/ngx_http_range_filter_module.c +855 -0
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +476 -0
- data/src/nginx/src/http/modules/ngx_http_referer_module.c +613 -0
- data/src/nginx/src/http/modules/ngx_http_rewrite_module.c +1019 -0
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +1714 -0
- data/src/nginx/src/http/modules/ngx_http_secure_link_module.c +355 -0
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +2913 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.h +114 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.c +652 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.h +52 -0
- data/src/nginx/src/http/modules/ngx_http_static_module.c +278 -0
- data/src/nginx/src/http/modules/ngx_http_stub_status_module.c +144 -0
- data/src/nginx/src/http/modules/ngx_http_sub_filter_module.c +716 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +237 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +846 -0
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +1774 -0
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +984 -0
- data/src/nginx/src/http/modules/perl/Makefile.PL +42 -0
- data/src/nginx/src/http/modules/perl/nginx.pm +137 -0
- data/src/nginx/src/http/modules/perl/nginx.xs +986 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.c +1076 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.h +67 -0
- data/src/nginx/src/http/modules/perl/typemap +3 -0
- data/src/nginx/src/http/ngx_http.c +2073 -0
- data/src/nginx/src/http/ngx_http.h +160 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +307 -0
- data/src/nginx/src/http/ngx_http_busy_lock.h +54 -0
- data/src/nginx/src/http/ngx_http_cache.h +148 -0
- data/src/nginx/src/http/ngx_http_config.h +75 -0
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +300 -0
- data/src/nginx/src/http/ngx_http_core_module.c +4736 -0
- data/src/nginx/src/http/ngx_http_core_module.h +541 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +1715 -0
- data/src/nginx/src/http/ngx_http_header_filter_module.c +623 -0
- data/src/nginx/src/http/ngx_http_parse.c +1734 -0
- data/src/nginx/src/http/ngx_http_parse_time.c +276 -0
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +178 -0
- data/src/nginx/src/http/ngx_http_request.c +3181 -0
- data/src/nginx/src/http/ngx_http_request.h +573 -0
- data/src/nginx/src/http/ngx_http_request_body.c +644 -0
- data/src/nginx/src/http/ngx_http_script.c +1752 -0
- data/src/nginx/src/http/ngx_http_script.h +257 -0
- data/src/nginx/src/http/ngx_http_special_response.c +789 -0
- data/src/nginx/src/http/ngx_http_upstream.c +4555 -0
- data/src/nginx/src/http/ngx_http_upstream.h +350 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +791 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +85 -0
- data/src/nginx/src/http/ngx_http_variables.c +2053 -0
- data/src/nginx/src/http/ngx_http_variables.h +115 -0
- data/src/nginx/src/http/ngx_http_write_filter_module.c +315 -0
- data/src/nginx/src/mail/ngx_mail.c +542 -0
- data/src/nginx/src/mail/ngx_mail.h +407 -0
- data/src/nginx/src/mail/ngx_mail_auth_http_module.c +1452 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +553 -0
- data/src/nginx/src/mail/ngx_mail_handler.c +773 -0
- data/src/nginx/src/mail/ngx_mail_imap_handler.c +457 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.c +253 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.h +39 -0
- data/src/nginx/src/mail/ngx_mail_parse.c +885 -0
- data/src/nginx/src/mail/ngx_mail_pop3_handler.c +500 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.c +264 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.h +38 -0
- data/src/nginx/src/mail/ngx_mail_proxy_module.c +1089 -0
- data/src/nginx/src/mail/ngx_mail_smtp_handler.c +872 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.c +308 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.h +45 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.c +491 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.h +52 -0
- data/src/nginx/src/misc/ngx_cpp_test_module.cpp +27 -0
- data/src/nginx/src/misc/ngx_google_perftools_module.c +126 -0
- data/src/nginx/src/os/unix/ngx_aio_read.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_read_chain.c +78 -0
- data/src/nginx/src/os/unix/ngx_aio_write.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_write_chain.c +100 -0
- data/src/nginx/src/os/unix/ngx_alloc.c +90 -0
- data/src/nginx/src/os/unix/ngx_alloc.h +45 -0
- data/src/nginx/src/os/unix/ngx_atomic.h +311 -0
- data/src/nginx/src/os/unix/ngx_channel.c +258 -0
- data/src/nginx/src/os/unix/ngx_channel.h +34 -0
- data/src/nginx/src/os/unix/ngx_daemon.c +69 -0
- data/src/nginx/src/os/unix/ngx_darwin.h +20 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +96 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +166 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +366 -0
- data/src/nginx/src/os/unix/ngx_errno.c +87 -0
- data/src/nginx/src/os/unix/ngx_errno.h +68 -0
- data/src/nginx/src/os/unix/ngx_file_aio_read.c +208 -0
- data/src/nginx/src/os/unix/ngx_files.c +566 -0
- data/src/nginx/src/os/unix/ngx_files.h +343 -0
- data/src/nginx/src/os/unix/ngx_freebsd.h +24 -0
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +119 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +259 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +756 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +122 -0
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +436 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_amd64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_ppc.h +155 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_x86.h +127 -0
- data/src/nginx/src/os/unix/ngx_linux.h +18 -0
- data/src/nginx/src/os/unix/ngx_linux_aio_read.c +137 -0
- data/src/nginx/src/os/unix/ngx_linux_config.h +117 -0
- data/src/nginx/src/os/unix/ngx_linux_init.c +91 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +378 -0
- data/src/nginx/src/os/unix/ngx_os.h +84 -0
- data/src/nginx/src/os/unix/ngx_posix_config.h +153 -0
- data/src/nginx/src/os/unix/ngx_posix_init.c +124 -0
- data/src/nginx/src/os/unix/ngx_process.c +590 -0
- data/src/nginx/src/os/unix/ngx_process.h +87 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +1390 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.h +61 -0
- data/src/nginx/src/os/unix/ngx_pthread_thread.c +278 -0
- data/src/nginx/src/os/unix/ngx_readv_chain.c +258 -0
- data/src/nginx/src/os/unix/ngx_recv.c +180 -0
- data/src/nginx/src/os/unix/ngx_send.c +73 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +135 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.h +52 -0
- data/src/nginx/src/os/unix/ngx_shmem.c +126 -0
- data/src/nginx/src/os/unix/ngx_shmem.h +29 -0
- data/src/nginx/src/os/unix/ngx_socket.c +116 -0
- data/src/nginx/src/os/unix/ngx_socket.h +64 -0
- data/src/nginx/src/os/unix/ngx_solaris.h +16 -0
- data/src/nginx/src/os/unix/ngx_solaris_config.h +107 -0
- data/src/nginx/src/os/unix/ngx_solaris_init.c +75 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +251 -0
- data/src/nginx/src/os/unix/ngx_sunpro_amd64.il +43 -0
- data/src/nginx/src/os/unix/ngx_sunpro_atomic_sparc64.h +61 -0
- data/src/nginx/src/os/unix/ngx_sunpro_sparc64.il +36 -0
- data/src/nginx/src/os/unix/ngx_sunpro_x86.il +44 -0
- data/src/nginx/src/os/unix/ngx_thread.h +128 -0
- data/src/nginx/src/os/unix/ngx_time.c +104 -0
- data/src/nginx/src/os/unix/ngx_time.h +66 -0
- data/src/nginx/src/os/unix/ngx_udp_recv.c +115 -0
- data/src/nginx/src/os/unix/ngx_user.c +109 -0
- data/src/nginx/src/os/unix/ngx_user.h +24 -0
- data/src/nginx/src/os/unix/ngx_writev_chain.c +181 -0
- data/src/nginx/src/os/unix/rfork_thread.S +73 -0
- metadata +419 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#ifndef _NGX_TIMES_H_INCLUDED_
|
9
|
+
#define _NGX_TIMES_H_INCLUDED_
|
10
|
+
|
11
|
+
|
12
|
+
#include <ngx_config.h>
|
13
|
+
#include <ngx_core.h>
|
14
|
+
|
15
|
+
|
16
|
+
typedef struct {
|
17
|
+
time_t sec;
|
18
|
+
ngx_uint_t msec;
|
19
|
+
ngx_int_t gmtoff;
|
20
|
+
} ngx_time_t;
|
21
|
+
|
22
|
+
|
23
|
+
void ngx_time_init(void);
|
24
|
+
void ngx_time_update(void);
|
25
|
+
void ngx_time_sigsafe_update(void);
|
26
|
+
u_char *ngx_http_time(u_char *buf, time_t t);
|
27
|
+
u_char *ngx_http_cookie_time(u_char *buf, time_t t);
|
28
|
+
void ngx_gmtime(time_t t, ngx_tm_t *tp);
|
29
|
+
|
30
|
+
time_t ngx_next_time(time_t when);
|
31
|
+
#define ngx_next_time_n "mktime()"
|
32
|
+
|
33
|
+
|
34
|
+
extern volatile ngx_time_t *ngx_cached_time;
|
35
|
+
|
36
|
+
#define ngx_time() ngx_cached_time->sec
|
37
|
+
#define ngx_timeofday() (ngx_time_t *) ngx_cached_time
|
38
|
+
|
39
|
+
extern volatile ngx_str_t ngx_cached_err_log_time;
|
40
|
+
extern volatile ngx_str_t ngx_cached_http_time;
|
41
|
+
extern volatile ngx_str_t ngx_cached_http_log_time;
|
42
|
+
extern volatile ngx_str_t ngx_cached_http_log_iso8601;
|
43
|
+
|
44
|
+
/*
|
45
|
+
* milliseconds elapsed since epoch and truncated to ngx_msec_t,
|
46
|
+
* used in event timers
|
47
|
+
*/
|
48
|
+
extern volatile ngx_msec_t ngx_current_msec;
|
49
|
+
|
50
|
+
|
51
|
+
#endif /* _NGX_TIMES_H_INCLUDED_ */
|
@@ -0,0 +1,171 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <ngx_event.h>
|
11
|
+
|
12
|
+
|
13
|
+
extern ngx_event_module_t ngx_kqueue_module_ctx;
|
14
|
+
|
15
|
+
|
16
|
+
static ngx_int_t ngx_aio_init(ngx_cycle_t *cycle, ngx_msec_t timer);
|
17
|
+
static void ngx_aio_done(ngx_cycle_t *cycle);
|
18
|
+
static ngx_int_t ngx_aio_add_event(ngx_event_t *ev, ngx_int_t event,
|
19
|
+
ngx_uint_t flags);
|
20
|
+
static ngx_int_t ngx_aio_del_event(ngx_event_t *ev, ngx_int_t event,
|
21
|
+
ngx_uint_t flags);
|
22
|
+
static ngx_int_t ngx_aio_del_connection(ngx_connection_t *c, ngx_uint_t flags);
|
23
|
+
static ngx_int_t ngx_aio_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
|
24
|
+
ngx_uint_t flags);
|
25
|
+
|
26
|
+
|
27
|
+
ngx_os_io_t ngx_os_aio = {
|
28
|
+
ngx_aio_read,
|
29
|
+
ngx_aio_read_chain,
|
30
|
+
NULL,
|
31
|
+
ngx_aio_write,
|
32
|
+
ngx_aio_write_chain,
|
33
|
+
0
|
34
|
+
};
|
35
|
+
|
36
|
+
|
37
|
+
static ngx_str_t aio_name = ngx_string("aio");
|
38
|
+
|
39
|
+
ngx_event_module_t ngx_aio_module_ctx = {
|
40
|
+
&aio_name,
|
41
|
+
NULL, /* create configuration */
|
42
|
+
NULL, /* init configuration */
|
43
|
+
|
44
|
+
{
|
45
|
+
ngx_aio_add_event, /* add an event */
|
46
|
+
ngx_aio_del_event, /* delete an event */
|
47
|
+
NULL, /* enable an event */
|
48
|
+
NULL, /* disable an event */
|
49
|
+
NULL, /* add an connection */
|
50
|
+
ngx_aio_del_connection, /* delete an connection */
|
51
|
+
NULL, /* process the changes */
|
52
|
+
ngx_aio_process_events, /* process the events */
|
53
|
+
ngx_aio_init, /* init the events */
|
54
|
+
ngx_aio_done /* done the events */
|
55
|
+
}
|
56
|
+
|
57
|
+
};
|
58
|
+
|
59
|
+
ngx_module_t ngx_aio_module = {
|
60
|
+
NGX_MODULE_V1,
|
61
|
+
&ngx_aio_module_ctx, /* module context */
|
62
|
+
NULL, /* module directives */
|
63
|
+
NGX_EVENT_MODULE, /* module type */
|
64
|
+
NULL, /* init master */
|
65
|
+
NULL, /* init module */
|
66
|
+
NULL, /* init process */
|
67
|
+
NULL, /* init thread */
|
68
|
+
NULL, /* exit thread */
|
69
|
+
NULL, /* exit process */
|
70
|
+
NULL, /* exit master */
|
71
|
+
NGX_MODULE_V1_PADDING
|
72
|
+
};
|
73
|
+
|
74
|
+
|
75
|
+
#if (NGX_HAVE_KQUEUE)
|
76
|
+
|
77
|
+
static ngx_int_t
|
78
|
+
ngx_aio_init(ngx_cycle_t *cycle, ngx_msec_t timer)
|
79
|
+
{
|
80
|
+
if (ngx_kqueue_module_ctx.actions.init(cycle, timer) == NGX_ERROR) {
|
81
|
+
return NGX_ERROR;
|
82
|
+
}
|
83
|
+
|
84
|
+
ngx_io = ngx_os_aio;
|
85
|
+
|
86
|
+
ngx_event_flags = NGX_USE_AIO_EVENT;
|
87
|
+
ngx_event_actions = ngx_aio_module_ctx.actions;
|
88
|
+
|
89
|
+
|
90
|
+
return NGX_OK;
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
static void
|
95
|
+
ngx_aio_done(ngx_cycle_t *cycle)
|
96
|
+
{
|
97
|
+
ngx_kqueue_module_ctx.actions.done(cycle);
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
/* the event adding and deleting are needed for the listening sockets */
|
102
|
+
|
103
|
+
static ngx_int_t
|
104
|
+
ngx_aio_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
|
105
|
+
{
|
106
|
+
return ngx_kqueue_module_ctx.actions.add(ev, event, flags);
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
static ngx_int_t
|
111
|
+
ngx_aio_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
|
112
|
+
{
|
113
|
+
return ngx_kqueue_module_ctx.actions.del(ev, event, flags);
|
114
|
+
}
|
115
|
+
|
116
|
+
|
117
|
+
static ngx_int_t
|
118
|
+
ngx_aio_del_connection(ngx_connection_t *c, ngx_uint_t flags)
|
119
|
+
{
|
120
|
+
int rc;
|
121
|
+
|
122
|
+
if (c->read->active == 0 && c->write->active == 0) {
|
123
|
+
return NGX_OK;
|
124
|
+
}
|
125
|
+
|
126
|
+
if (flags & NGX_CLOSE_EVENT) {
|
127
|
+
return NGX_OK;
|
128
|
+
}
|
129
|
+
|
130
|
+
rc = aio_cancel(c->fd, NULL);
|
131
|
+
|
132
|
+
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "aio_cancel: %d", rc);
|
133
|
+
|
134
|
+
if (rc == AIO_CANCELED) {
|
135
|
+
c->read->active = 0;
|
136
|
+
c->write->active = 0;
|
137
|
+
return NGX_OK;
|
138
|
+
}
|
139
|
+
|
140
|
+
if (rc == AIO_ALLDONE) {
|
141
|
+
c->read->active = 0;
|
142
|
+
c->write->active = 0;
|
143
|
+
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
144
|
+
"aio_cancel() returned AIO_ALLDONE");
|
145
|
+
return NGX_OK;
|
146
|
+
}
|
147
|
+
|
148
|
+
if (rc == -1) {
|
149
|
+
ngx_log_error(NGX_LOG_ALERT, c->log, ngx_errno,
|
150
|
+
"aio_cancel() failed");
|
151
|
+
return NGX_ERROR;
|
152
|
+
}
|
153
|
+
|
154
|
+
if (rc == AIO_NOTCANCELED) {
|
155
|
+
ngx_log_error(NGX_LOG_ALERT, c->log, 0,
|
156
|
+
"aio_cancel() returned AIO_NOTCANCELED");
|
157
|
+
|
158
|
+
return NGX_ERROR;
|
159
|
+
}
|
160
|
+
|
161
|
+
return NGX_OK;
|
162
|
+
}
|
163
|
+
|
164
|
+
|
165
|
+
static ngx_int_t
|
166
|
+
ngx_aio_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags)
|
167
|
+
{
|
168
|
+
return ngx_kqueue_module_ctx.actions.process_events(cycle, timer, flags);
|
169
|
+
}
|
170
|
+
|
171
|
+
#endif /* NGX_HAVE_KQUEUE */
|
@@ -0,0 +1,569 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <ngx_event.h>
|
11
|
+
|
12
|
+
|
13
|
+
#if (NGX_TEST_BUILD_DEVPOLL)
|
14
|
+
|
15
|
+
/* Solaris declarations */
|
16
|
+
|
17
|
+
#define POLLREMOVE 0x0800
|
18
|
+
#define DP_POLL 0xD001
|
19
|
+
#define DP_ISPOLLED 0xD002
|
20
|
+
|
21
|
+
struct dvpoll {
|
22
|
+
struct pollfd *dp_fds;
|
23
|
+
int dp_nfds;
|
24
|
+
int dp_timeout;
|
25
|
+
};
|
26
|
+
|
27
|
+
#endif
|
28
|
+
|
29
|
+
|
30
|
+
typedef struct {
|
31
|
+
ngx_uint_t changes;
|
32
|
+
ngx_uint_t events;
|
33
|
+
} ngx_devpoll_conf_t;
|
34
|
+
|
35
|
+
|
36
|
+
static ngx_int_t ngx_devpoll_init(ngx_cycle_t *cycle, ngx_msec_t timer);
|
37
|
+
static void ngx_devpoll_done(ngx_cycle_t *cycle);
|
38
|
+
static ngx_int_t ngx_devpoll_add_event(ngx_event_t *ev, ngx_int_t event,
|
39
|
+
ngx_uint_t flags);
|
40
|
+
static ngx_int_t ngx_devpoll_del_event(ngx_event_t *ev, ngx_int_t event,
|
41
|
+
ngx_uint_t flags);
|
42
|
+
static ngx_int_t ngx_devpoll_set_event(ngx_event_t *ev, ngx_int_t event,
|
43
|
+
ngx_uint_t flags);
|
44
|
+
static ngx_int_t ngx_devpoll_process_events(ngx_cycle_t *cycle,
|
45
|
+
ngx_msec_t timer, ngx_uint_t flags);
|
46
|
+
|
47
|
+
static void *ngx_devpoll_create_conf(ngx_cycle_t *cycle);
|
48
|
+
static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf);
|
49
|
+
|
50
|
+
static int dp = -1;
|
51
|
+
static struct pollfd *change_list, *event_list;
|
52
|
+
static ngx_uint_t nchanges, max_changes, nevents;
|
53
|
+
|
54
|
+
static ngx_event_t **change_index;
|
55
|
+
|
56
|
+
|
57
|
+
static ngx_str_t devpoll_name = ngx_string("/dev/poll");
|
58
|
+
|
59
|
+
static ngx_command_t ngx_devpoll_commands[] = {
|
60
|
+
|
61
|
+
{ ngx_string("devpoll_changes"),
|
62
|
+
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
63
|
+
ngx_conf_set_num_slot,
|
64
|
+
0,
|
65
|
+
offsetof(ngx_devpoll_conf_t, changes),
|
66
|
+
NULL },
|
67
|
+
|
68
|
+
{ ngx_string("devpoll_events"),
|
69
|
+
NGX_EVENT_CONF|NGX_CONF_TAKE1,
|
70
|
+
ngx_conf_set_num_slot,
|
71
|
+
0,
|
72
|
+
offsetof(ngx_devpoll_conf_t, events),
|
73
|
+
NULL },
|
74
|
+
|
75
|
+
ngx_null_command
|
76
|
+
};
|
77
|
+
|
78
|
+
|
79
|
+
ngx_event_module_t ngx_devpoll_module_ctx = {
|
80
|
+
&devpoll_name,
|
81
|
+
ngx_devpoll_create_conf, /* create configuration */
|
82
|
+
ngx_devpoll_init_conf, /* init configuration */
|
83
|
+
|
84
|
+
{
|
85
|
+
ngx_devpoll_add_event, /* add an event */
|
86
|
+
ngx_devpoll_del_event, /* delete an event */
|
87
|
+
ngx_devpoll_add_event, /* enable an event */
|
88
|
+
ngx_devpoll_del_event, /* disable an event */
|
89
|
+
NULL, /* add an connection */
|
90
|
+
NULL, /* delete an connection */
|
91
|
+
NULL, /* process the changes */
|
92
|
+
ngx_devpoll_process_events, /* process the events */
|
93
|
+
ngx_devpoll_init, /* init the events */
|
94
|
+
ngx_devpoll_done, /* done the events */
|
95
|
+
}
|
96
|
+
|
97
|
+
};
|
98
|
+
|
99
|
+
ngx_module_t ngx_devpoll_module = {
|
100
|
+
NGX_MODULE_V1,
|
101
|
+
&ngx_devpoll_module_ctx, /* module context */
|
102
|
+
ngx_devpoll_commands, /* module directives */
|
103
|
+
NGX_EVENT_MODULE, /* module type */
|
104
|
+
NULL, /* init master */
|
105
|
+
NULL, /* init module */
|
106
|
+
NULL, /* init process */
|
107
|
+
NULL, /* init thread */
|
108
|
+
NULL, /* exit thread */
|
109
|
+
NULL, /* exit process */
|
110
|
+
NULL, /* exit master */
|
111
|
+
NGX_MODULE_V1_PADDING
|
112
|
+
};
|
113
|
+
|
114
|
+
|
115
|
+
static ngx_int_t
|
116
|
+
ngx_devpoll_init(ngx_cycle_t *cycle, ngx_msec_t timer)
|
117
|
+
{
|
118
|
+
size_t n;
|
119
|
+
ngx_devpoll_conf_t *dpcf;
|
120
|
+
|
121
|
+
dpcf = ngx_event_get_conf(cycle->conf_ctx, ngx_devpoll_module);
|
122
|
+
|
123
|
+
if (dp == -1) {
|
124
|
+
dp = open("/dev/poll", O_RDWR);
|
125
|
+
|
126
|
+
if (dp == -1) {
|
127
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
128
|
+
"open(/dev/poll) failed");
|
129
|
+
return NGX_ERROR;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
if (max_changes < dpcf->changes) {
|
134
|
+
if (nchanges) {
|
135
|
+
n = nchanges * sizeof(struct pollfd);
|
136
|
+
if (write(dp, change_list, n) != (ssize_t) n) {
|
137
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
138
|
+
"write(/dev/poll) failed");
|
139
|
+
return NGX_ERROR;
|
140
|
+
}
|
141
|
+
|
142
|
+
nchanges = 0;
|
143
|
+
}
|
144
|
+
|
145
|
+
if (change_list) {
|
146
|
+
ngx_free(change_list);
|
147
|
+
}
|
148
|
+
|
149
|
+
change_list = ngx_alloc(sizeof(struct pollfd) * dpcf->changes,
|
150
|
+
cycle->log);
|
151
|
+
if (change_list == NULL) {
|
152
|
+
return NGX_ERROR;
|
153
|
+
}
|
154
|
+
|
155
|
+
if (change_index) {
|
156
|
+
ngx_free(change_index);
|
157
|
+
}
|
158
|
+
|
159
|
+
change_index = ngx_alloc(sizeof(ngx_event_t *) * dpcf->changes,
|
160
|
+
cycle->log);
|
161
|
+
if (change_index == NULL) {
|
162
|
+
return NGX_ERROR;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
max_changes = dpcf->changes;
|
167
|
+
|
168
|
+
if (nevents < dpcf->events) {
|
169
|
+
if (event_list) {
|
170
|
+
ngx_free(event_list);
|
171
|
+
}
|
172
|
+
|
173
|
+
event_list = ngx_alloc(sizeof(struct pollfd) * dpcf->events,
|
174
|
+
cycle->log);
|
175
|
+
if (event_list == NULL) {
|
176
|
+
return NGX_ERROR;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
nevents = dpcf->events;
|
181
|
+
|
182
|
+
ngx_io = ngx_os_io;
|
183
|
+
|
184
|
+
ngx_event_actions = ngx_devpoll_module_ctx.actions;
|
185
|
+
|
186
|
+
ngx_event_flags = NGX_USE_LEVEL_EVENT|NGX_USE_FD_EVENT;
|
187
|
+
|
188
|
+
return NGX_OK;
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
static void
|
193
|
+
ngx_devpoll_done(ngx_cycle_t *cycle)
|
194
|
+
{
|
195
|
+
if (close(dp) == -1) {
|
196
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
197
|
+
"close(/dev/poll) failed");
|
198
|
+
}
|
199
|
+
|
200
|
+
dp = -1;
|
201
|
+
|
202
|
+
ngx_free(change_list);
|
203
|
+
ngx_free(event_list);
|
204
|
+
ngx_free(change_index);
|
205
|
+
|
206
|
+
change_list = NULL;
|
207
|
+
event_list = NULL;
|
208
|
+
change_index = NULL;
|
209
|
+
max_changes = 0;
|
210
|
+
nchanges = 0;
|
211
|
+
nevents = 0;
|
212
|
+
}
|
213
|
+
|
214
|
+
|
215
|
+
static ngx_int_t
|
216
|
+
ngx_devpoll_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
|
217
|
+
{
|
218
|
+
#if (NGX_DEBUG)
|
219
|
+
ngx_connection_t *c;
|
220
|
+
#endif
|
221
|
+
|
222
|
+
#if (NGX_READ_EVENT != POLLIN)
|
223
|
+
event = (event == NGX_READ_EVENT) ? POLLIN : POLLOUT;
|
224
|
+
#endif
|
225
|
+
|
226
|
+
#if (NGX_DEBUG)
|
227
|
+
c = ev->data;
|
228
|
+
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
|
229
|
+
"devpoll add event: fd:%d ev:%04Xi", c->fd, event);
|
230
|
+
#endif
|
231
|
+
|
232
|
+
ev->active = 1;
|
233
|
+
|
234
|
+
return ngx_devpoll_set_event(ev, event, 0);
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
static ngx_int_t
|
239
|
+
ngx_devpoll_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
|
240
|
+
{
|
241
|
+
ngx_event_t *e;
|
242
|
+
ngx_connection_t *c;
|
243
|
+
|
244
|
+
c = ev->data;
|
245
|
+
|
246
|
+
#if (NGX_READ_EVENT != POLLIN)
|
247
|
+
event = (event == NGX_READ_EVENT) ? POLLIN : POLLOUT;
|
248
|
+
#endif
|
249
|
+
|
250
|
+
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
|
251
|
+
"devpoll del event: fd:%d ev:%04Xi", c->fd, event);
|
252
|
+
|
253
|
+
if (ngx_devpoll_set_event(ev, POLLREMOVE, flags) == NGX_ERROR) {
|
254
|
+
return NGX_ERROR;
|
255
|
+
}
|
256
|
+
|
257
|
+
ev->active = 0;
|
258
|
+
|
259
|
+
if (flags & NGX_CLOSE_EVENT) {
|
260
|
+
e = (event == POLLIN) ? c->write : c->read;
|
261
|
+
|
262
|
+
if (e) {
|
263
|
+
e->active = 0;
|
264
|
+
}
|
265
|
+
|
266
|
+
return NGX_OK;
|
267
|
+
}
|
268
|
+
|
269
|
+
/* restore the pair event if it exists */
|
270
|
+
|
271
|
+
if (event == POLLIN) {
|
272
|
+
e = c->write;
|
273
|
+
event = POLLOUT;
|
274
|
+
|
275
|
+
} else {
|
276
|
+
e = c->read;
|
277
|
+
event = POLLIN;
|
278
|
+
}
|
279
|
+
|
280
|
+
if (e && e->active) {
|
281
|
+
return ngx_devpoll_set_event(e, event, 0);
|
282
|
+
}
|
283
|
+
|
284
|
+
return NGX_OK;
|
285
|
+
}
|
286
|
+
|
287
|
+
|
288
|
+
static ngx_int_t
|
289
|
+
ngx_devpoll_set_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
|
290
|
+
{
|
291
|
+
size_t n;
|
292
|
+
ngx_connection_t *c;
|
293
|
+
|
294
|
+
c = ev->data;
|
295
|
+
|
296
|
+
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
|
297
|
+
"devpoll fd:%d ev:%04Xi fl:%04Xi", c->fd, event, flags);
|
298
|
+
|
299
|
+
if (nchanges >= max_changes) {
|
300
|
+
ngx_log_error(NGX_LOG_WARN, ev->log, 0,
|
301
|
+
"/dev/pool change list is filled up");
|
302
|
+
|
303
|
+
n = nchanges * sizeof(struct pollfd);
|
304
|
+
if (write(dp, change_list, n) != (ssize_t) n) {
|
305
|
+
ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
|
306
|
+
"write(/dev/poll) failed");
|
307
|
+
return NGX_ERROR;
|
308
|
+
}
|
309
|
+
|
310
|
+
nchanges = 0;
|
311
|
+
}
|
312
|
+
|
313
|
+
change_list[nchanges].fd = c->fd;
|
314
|
+
change_list[nchanges].events = (short) event;
|
315
|
+
change_list[nchanges].revents = 0;
|
316
|
+
|
317
|
+
change_index[nchanges] = ev;
|
318
|
+
ev->index = nchanges;
|
319
|
+
|
320
|
+
nchanges++;
|
321
|
+
|
322
|
+
if (flags & NGX_CLOSE_EVENT) {
|
323
|
+
n = nchanges * sizeof(struct pollfd);
|
324
|
+
if (write(dp, change_list, n) != (ssize_t) n) {
|
325
|
+
ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
|
326
|
+
"write(/dev/poll) failed");
|
327
|
+
return NGX_ERROR;
|
328
|
+
}
|
329
|
+
|
330
|
+
nchanges = 0;
|
331
|
+
}
|
332
|
+
|
333
|
+
return NGX_OK;
|
334
|
+
}
|
335
|
+
|
336
|
+
|
337
|
+
ngx_int_t
|
338
|
+
ngx_devpoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
|
339
|
+
ngx_uint_t flags)
|
340
|
+
{
|
341
|
+
int events, revents, rc;
|
342
|
+
size_t n;
|
343
|
+
ngx_fd_t fd;
|
344
|
+
ngx_err_t err;
|
345
|
+
ngx_int_t i;
|
346
|
+
ngx_uint_t level;
|
347
|
+
ngx_event_t *rev, *wev, **queue;
|
348
|
+
ngx_connection_t *c;
|
349
|
+
struct pollfd pfd;
|
350
|
+
struct dvpoll dvp;
|
351
|
+
|
352
|
+
/* NGX_TIMER_INFINITE == INFTIM */
|
353
|
+
|
354
|
+
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
355
|
+
"devpoll timer: %M", timer);
|
356
|
+
|
357
|
+
if (nchanges) {
|
358
|
+
n = nchanges * sizeof(struct pollfd);
|
359
|
+
if (write(dp, change_list, n) != (ssize_t) n) {
|
360
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
361
|
+
"write(/dev/poll) failed");
|
362
|
+
return NGX_ERROR;
|
363
|
+
}
|
364
|
+
|
365
|
+
nchanges = 0;
|
366
|
+
}
|
367
|
+
|
368
|
+
dvp.dp_fds = event_list;
|
369
|
+
dvp.dp_nfds = (int) nevents;
|
370
|
+
dvp.dp_timeout = timer;
|
371
|
+
events = ioctl(dp, DP_POLL, &dvp);
|
372
|
+
|
373
|
+
err = (events == -1) ? ngx_errno : 0;
|
374
|
+
|
375
|
+
if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
|
376
|
+
ngx_time_update();
|
377
|
+
}
|
378
|
+
|
379
|
+
if (err) {
|
380
|
+
if (err == NGX_EINTR) {
|
381
|
+
|
382
|
+
if (ngx_event_timer_alarm) {
|
383
|
+
ngx_event_timer_alarm = 0;
|
384
|
+
return NGX_OK;
|
385
|
+
}
|
386
|
+
|
387
|
+
level = NGX_LOG_INFO;
|
388
|
+
|
389
|
+
} else {
|
390
|
+
level = NGX_LOG_ALERT;
|
391
|
+
}
|
392
|
+
|
393
|
+
ngx_log_error(level, cycle->log, err, "ioctl(DP_POLL) failed");
|
394
|
+
return NGX_ERROR;
|
395
|
+
}
|
396
|
+
|
397
|
+
if (events == 0) {
|
398
|
+
if (timer != NGX_TIMER_INFINITE) {
|
399
|
+
return NGX_OK;
|
400
|
+
}
|
401
|
+
|
402
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
403
|
+
"ioctl(DP_POLL) returned no events without timeout");
|
404
|
+
return NGX_ERROR;
|
405
|
+
}
|
406
|
+
|
407
|
+
ngx_mutex_lock(ngx_posted_events_mutex);
|
408
|
+
|
409
|
+
for (i = 0; i < events; i++) {
|
410
|
+
|
411
|
+
fd = event_list[i].fd;
|
412
|
+
revents = event_list[i].revents;
|
413
|
+
|
414
|
+
c = ngx_cycle->files[fd];
|
415
|
+
|
416
|
+
if (c == NULL || c->fd == -1) {
|
417
|
+
|
418
|
+
pfd.fd = fd;
|
419
|
+
pfd.events = 0;
|
420
|
+
pfd.revents = 0;
|
421
|
+
|
422
|
+
rc = ioctl(dp, DP_ISPOLLED, &pfd);
|
423
|
+
|
424
|
+
switch (rc) {
|
425
|
+
|
426
|
+
case -1:
|
427
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
428
|
+
"ioctl(DP_ISPOLLED) failed for socket %d, event",
|
429
|
+
fd, revents);
|
430
|
+
break;
|
431
|
+
|
432
|
+
case 0:
|
433
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
434
|
+
"phantom event %04Xd for closed and removed socket %d",
|
435
|
+
revents, fd);
|
436
|
+
break;
|
437
|
+
|
438
|
+
default:
|
439
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
440
|
+
"unexpected event %04Xd for closed and removed socket %d, ",
|
441
|
+
"ioctl(DP_ISPOLLED) returned rc:%d, fd:%d, event %04Xd",
|
442
|
+
revents, fd, rc, pfd.fd, pfd.revents);
|
443
|
+
|
444
|
+
pfd.fd = fd;
|
445
|
+
pfd.events = POLLREMOVE;
|
446
|
+
pfd.revents = 0;
|
447
|
+
|
448
|
+
if (write(dp, &pfd, sizeof(struct pollfd))
|
449
|
+
!= (ssize_t) sizeof(struct pollfd))
|
450
|
+
{
|
451
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
452
|
+
"write(/dev/poll) for %d failed, fd");
|
453
|
+
}
|
454
|
+
|
455
|
+
if (close(fd) == -1) {
|
456
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
457
|
+
"close(%d) failed", fd);
|
458
|
+
}
|
459
|
+
|
460
|
+
break;
|
461
|
+
}
|
462
|
+
|
463
|
+
continue;
|
464
|
+
}
|
465
|
+
|
466
|
+
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
467
|
+
"devpoll: fd:%d, ev:%04Xd, rev:%04Xd",
|
468
|
+
fd, event_list[i].events, revents);
|
469
|
+
|
470
|
+
if (revents & (POLLERR|POLLHUP|POLLNVAL)) {
|
471
|
+
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
472
|
+
"ioctl(DP_POLL) error fd:%d ev:%04Xd rev:%04Xd",
|
473
|
+
fd, event_list[i].events, revents);
|
474
|
+
}
|
475
|
+
|
476
|
+
if (revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL)) {
|
477
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
478
|
+
"strange ioctl(DP_POLL) events "
|
479
|
+
"fd:%d ev:%04Xd rev:%04Xd",
|
480
|
+
fd, event_list[i].events, revents);
|
481
|
+
}
|
482
|
+
|
483
|
+
if ((revents & (POLLERR|POLLHUP|POLLNVAL))
|
484
|
+
&& (revents & (POLLIN|POLLOUT)) == 0)
|
485
|
+
{
|
486
|
+
/*
|
487
|
+
* if the error events were returned without POLLIN or POLLOUT,
|
488
|
+
* then add these flags to handle the events at least in one
|
489
|
+
* active handler
|
490
|
+
*/
|
491
|
+
|
492
|
+
revents |= POLLIN|POLLOUT;
|
493
|
+
}
|
494
|
+
|
495
|
+
rev = c->read;
|
496
|
+
|
497
|
+
if ((revents & POLLIN) && rev->active) {
|
498
|
+
|
499
|
+
if ((flags & NGX_POST_THREAD_EVENTS) && !rev->accept) {
|
500
|
+
rev->posted_ready = 1;
|
501
|
+
|
502
|
+
} else {
|
503
|
+
rev->ready = 1;
|
504
|
+
}
|
505
|
+
|
506
|
+
if (flags & NGX_POST_EVENTS) {
|
507
|
+
queue = (ngx_event_t **) (rev->accept ?
|
508
|
+
&ngx_posted_accept_events : &ngx_posted_events);
|
509
|
+
|
510
|
+
ngx_locked_post_event(rev, queue);
|
511
|
+
|
512
|
+
} else {
|
513
|
+
rev->handler(rev);
|
514
|
+
}
|
515
|
+
}
|
516
|
+
|
517
|
+
wev = c->write;
|
518
|
+
|
519
|
+
if ((revents & POLLOUT) && wev->active) {
|
520
|
+
|
521
|
+
if (flags & NGX_POST_THREAD_EVENTS) {
|
522
|
+
wev->posted_ready = 1;
|
523
|
+
|
524
|
+
} else {
|
525
|
+
wev->ready = 1;
|
526
|
+
}
|
527
|
+
|
528
|
+
if (flags & NGX_POST_EVENTS) {
|
529
|
+
ngx_locked_post_event(wev, &ngx_posted_events);
|
530
|
+
|
531
|
+
} else {
|
532
|
+
wev->handler(wev);
|
533
|
+
}
|
534
|
+
}
|
535
|
+
}
|
536
|
+
|
537
|
+
ngx_mutex_unlock(ngx_posted_events_mutex);
|
538
|
+
|
539
|
+
return NGX_OK;
|
540
|
+
}
|
541
|
+
|
542
|
+
|
543
|
+
static void *
|
544
|
+
ngx_devpoll_create_conf(ngx_cycle_t *cycle)
|
545
|
+
{
|
546
|
+
ngx_devpoll_conf_t *dpcf;
|
547
|
+
|
548
|
+
dpcf = ngx_palloc(cycle->pool, sizeof(ngx_devpoll_conf_t));
|
549
|
+
if (dpcf == NULL) {
|
550
|
+
return NULL;
|
551
|
+
}
|
552
|
+
|
553
|
+
dpcf->changes = NGX_CONF_UNSET;
|
554
|
+
dpcf->events = NGX_CONF_UNSET;
|
555
|
+
|
556
|
+
return dpcf;
|
557
|
+
}
|
558
|
+
|
559
|
+
|
560
|
+
static char *
|
561
|
+
ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf)
|
562
|
+
{
|
563
|
+
ngx_devpoll_conf_t *dpcf = conf;
|
564
|
+
|
565
|
+
ngx_conf_init_uint_value(dpcf->changes, 32);
|
566
|
+
ngx_conf_init_uint_value(dpcf->events, 32);
|
567
|
+
|
568
|
+
return NGX_CONF_OK;
|
569
|
+
}
|