summaryrefslogtreecommitdiffhomepage
path: root/src/os/win32 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-01-24Win32: added WSAPoll() support.Maxim Dounin2-0/+75
WSAPoll() is only available with Windows Vista and newer (and only available during compilation if _WIN32_WINNT >= 0x0600). To make sure the code works with Windows XP, we do not redefine _WIN32_WINNT, but instead load WSAPoll() dynamically if it is not available during compilation. Also, sockets are not guaranteed to be small integers on Windows. So an index array is used instead of NGX_USE_FD_EVENT to map events to connections.
2018-12-24Win32: removed NGX_DIR_MASK concept.Maxim Dounin2-6/+18
Previous interface of ngx_open_dir() assumed that passed directory name has a room for NGX_DIR_MASK at the end (NGX_DIR_MASK_LEN bytes). While all direct users of ngx_dir_open() followed this interface, this also implied similar requirements for indirect uses - in particular, via ngx_walk_tree(). Currently none of ngx_walk_tree() uses provides appropriate space, and fixing this does not look like a right way to go. Instead, ngx_dir_open() interface was changed to not require any additional space and use appropriate allocations instead.
2018-05-29Win32: fixed comment in ngx_gettimeofday() calculations.Ruslan Ermilov1-1/+1
2017-11-28Fixed "changing binary" when reaper is not init.Ruslan Ermilov2-0/+3
On some systems, it's possible that reaper of orphaned processes is set to something other than "init" process. On such systems, the changing binary procedure did not work. The fix is to check if PPID has changed, instead of assuming it's always 1 for orphaned processes.
2017-08-09Style.Sergey Kandaurov1-0/+1
2017-03-07Introduced worker_shutdown_timeout.Maxim Dounin1-0/+1
The directive configures a timeout to be used when gracefully shutting down worker processes. When the timer expires, nginx will try to close all the connections currently open to facilitate shutdown.
2017-03-07Cancelable timers are now preserved if there are other timers.Maxim Dounin1-5/+1
There is no need to cancel timers early if there are other timers blocking shutdown anyway. Preserving such timers allows nginx to continue some periodic work till the shutdown is actually possible. With the new approach, timers with ev->cancelable are simply ignored when checking if there are any timers left during shutdown.
2016-12-24Win32: compatiblity with OpenSSL 1.1.0.Maxim Dounin1-0/+3
OpenSSL 1.1.0 now uses normal "nmake; nmake install" instead of using custom "ms\do_ms.bat" script and "ms\nt.mak" makefile. And Configure now requires --prefix to be absolute, and no longer derives --openssldir from prefix (so it's specified explicitly). Generated libraries are now called "libcrypto.lib" and "libssl.lib" instead of "libeay32.lib" and "ssleay32.lib". Appropriate tests added to support both old and new variants. Additionally, openssl/lhash.h now triggers warning C4090 ('function' : different 'const' qualifiers), so the warning was disabled.
2016-12-24Win32: support 64-bit compilation with MSVC.Maxim Dounin1-0/+10
There are lots of C4244 warnings (conversion from 'type1' to 'type2', possible loss of data), so they were disabled. The same applies to C4267 warnings (conversion from 'size_t' to 'type', possible loss of data), most notably - conversion from ngx_str_t.len to ngx_variable_value_t.len (which is unsigned:28). Additionally, there is at least one case when it is not possible to fix the warning properly without introducing win32-specific code: recv() on win32 uses "int len", while POSIX defines "size_t len". The ssize_t type now properly defined for 64-bit compilation with MSVC. Caught by warning C4305 (truncation from '__int64' to 'ssize_t'), on "cutoff = NGX_MAX_SIZE_T_VALUE / 10" in ngx_atosz()). Several C4334 warnings (result of 32-bit shift implicitly converted to 64 bits) were fixed by adding explicit conversions. Several C4214 warnings (nonstandard extension used: bit field types other than int) in ngx_http_script.h fixed by changing bit field types from uintptr_t to unsigned.
2016-12-24Win32: fixed some warnings reported by Borland C.Maxim Dounin1-0/+3
Most notably, warning W8012 (comparing signed and unsigned values) reported in multiple places where an unsigned value of small type (e.g., u_short) is promoted to an int and compared to an unsigned value. Warning W8072 (suspicious pointer arithmetic) disabled, it is reported when we increment base pointer in ngx_shm_alloc().
2016-12-24Win32: minimized redefinition of ssize_t.Maxim Dounin1-1/+1
All variants of GCC have ssize_t available, there is no need to redefine it.
2016-12-24Win32: minimized redefinition of intptr_t/uintptr_t.Maxim Dounin1-1/+1
These types are available with MSVC (at least since 2003, in stddef.h), all variants of GCC (in stdint.h) and Watcom C. We need to define them only for Borland C.
2016-12-24Win32: stdint.h used for MinGW GCC.Maxim Dounin1-1/+1
There is no need to restrict stdint.h only to MinGW-w64 GCC, it is available with MinGW GCC as well.
2016-12-24Win32: fixed building with newer versions of MinGW GCC.Maxim Dounin1-0/+1
Macro to indicate that off_t was defined has been changed, so we now additionally define the new one.
2016-10-05Cache: cache manager limits.Dmitry Volyntsev1-3/+3
The new parameters "manager_files", "manager_sleep" and "manager_threshold" were added to proxy_cache_path and friends. Note that ngx_path_manager_pt was changed to return ngx_msec_t instead of time_t (API change).
2016-09-15Stream: filters.Roman Arutyunyan2-0/+4
2016-08-04Always seed PRNG with PID, seconds, and milliseconds.Ruslan Ermilov2-8/+12
2016-08-04Win32: added per-thread random seeding.Ruslan Ermilov1-0/+2
The change in b91bcba29351 was not enough to fix random() seeding. On Windows, the srand() seeds the PRNG only in the current thread, and worse, is not inherited from the calling thread. Due to this, worker threads were not properly seeded. Reported by Marc Bevand.
2016-04-08Removed redundant "u" format specifier.Ruslan Ermilov2-2/+2
It is implied for "x" and "X".
2016-04-07Fixed spelling.Josh Soref1-1/+1
2016-03-31Fixed ngx_os_signal_process() prototype.Ruslan Ermilov2-3/+3
2016-03-31Fixed ngx_pid_t formatting in ngx_sprintf() and logging.Sergey Kandaurov2-7/+7
2016-03-30Style.Ruslan Ermilov2-9/+9
2016-03-29Win32: replaced NGX_EXDEV with more appropriate error code.Maxim Dounin1-5/+1
Correct error code for NGX_EXDEV on Windows is ERROR_NOT_SAME_DEVICE, "The system cannot move the file to a different disk drive". Previously used ERROR_WRONG_DISK is about wrong diskette in the drive and is not appropriate. There is no real difference though, as MoveFile() is able to copy files between disk drives, and will fail with ERROR_ACCESS_DENIED when asked to copy directories. The ERROR_NOT_SAME_DEVICE error is only used by MoveFileEx() when called without the MOVEFILE_COPY_ALLOWED flag.
2016-03-29Win32: additional error code NGX_EEXIST_FILE (ticket #910).Maxim Dounin1-1/+7
On Windows there are two possible error codes which correspond to the EEXIST error code: ERROR_FILE_EXISTS used by CreateFile(CREATE_NEW), and ERROR_ALREADY_EXISTS used by CreateDirectory(). MoveFile() seems to use both: ERROR_ALREADY_EXISTS when moving within one filesystem, and ERROR_FILE_EXISTS when copying a file to a different drive.
2016-02-18Core: added support for more than 64 CPUs in worker_cpu_affinity.Vladimir Homutov1-0/+3
2016-02-04Dynamic modules: dlopen() support.Maxim Dounin2-0/+54
2016-02-04Dynamic modules: changed ngx_modules to cycle->modules.Maxim Dounin1-9/+9
2015-08-17Win32: MSVC 2015 compatibility.Maxim Dounin2-2/+7
Resolved warnings about declarations that hide previous local declarations. Warnings about WSASocketA() being deprecated resolved by explicit use of WSASocketW() instead of WSASocket(). When compiling without IPv6 support, WinSock deprecated warnings are disabled to allow use of gethostbyname().
2015-08-11Core: idle connections now closed only once on exiting.Valentin Bartenev1-18/+4
Iterating through all connections takes a lot of CPU time, especially with large number of worker connections configured. As a result nginx processes used to consume CPU time during graceful shutdown. To mitigate this we now only do a full scan for idle connections when shutdown signal is received. Transitions of connections to idle ones are now expected to be avoided if the ngx_exiting flag is set. The upstream keepalive module was modified to follow this.
2015-06-16Core: added support for writing to stdout.Vladimir Homutov1-0/+1
2015-05-20Introduced worker number, ngx_worker.Maxim Dounin2-0/+2
2015-04-27Win32: shared memory base addresses and remapping.Maxim Dounin3-2/+84
Two mechanisms are implemented to make it possible to store pointers in shared memory on Windows, in particular on Windows Vista and later versions with ASLR: - The ngx_shm_remap() function added to allow remapping of a shared memory zone to the address originally used for it in the master process. While important, it doesn't solve the problem by itself as in many cases it's not possible to use the address because of conflicts with other allocations. - We now create mappings at the same address in all processes by starting mappings at predefined addresses normally unused by newborn processes. These two mechanisms combined allow to use shared memory on Windows almost without problems, including reloads. Based on the patch by Sergey Brester: http://mailman.nginx.org/pipermail/nginx-devel/2015-April/006836.html
2015-03-26Replaced the remaining NGX_OLD_THREADS check with NGX_WIN32.Ruslan Ermilov1-2/+0
2015-03-26Removed "worker_threads" and "thread_stack_size" directives.Ruslan Ermilov3-41/+1
2015-03-26Removed unused thread-local-storage code.Ruslan Ermilov3-40/+0
2015-03-26Removed ngx_threaded and related code.Ruslan Ermilov2-2/+0
2015-03-23Removed stub implementation of win32 mutexes.Ruslan Ermilov2-62/+0
2015-03-04Renamed NGX_THREADS to NGX_OLD_THREADS because of deprecation.Ruslan Ermilov1-1/+1
It's mostly dead code and the original idea of worker threads has been rejected.
2015-03-17Core: expose maximum values of time_t and ngx_int_t.Ruslan Ermilov1-0/+2
These are needed to detect overflows.
2014-11-19Renamed ngx_handle_sent_chain() to ngx_chain_update_sent().Valentin Bartenev1-2/+2
No functional changes.
2014-08-13Events: introduced cancelable timers.Valentin Bartenev1-0/+2
2014-10-15Win32: made build-able with MinGW-w64 gcc.Kouhei Sutou1-2/+35
2014-10-28Core: added limit to recv_chain().Roman Arutyunyan2-7/+20
2014-10-14Style.Maxim Dounin1-1/+2
2014-10-11Win32: suppressed warnings by "-Werror=sign-compare".Kouhei Sutou1-2/+2
2014-08-13Reduced difference between the send chain functions.Valentin Bartenev1-9/+7
No functional changes. This follows the change from ad137a80919f.
2014-08-13Removed the "complete" variable from various send chain functions.Valentin Bartenev1-7/+1
It was made redundant by the previous change, since the "sent" variable is no longer modified.
2014-08-13Moved the code for adjusting sent buffers in a separate function.Valentin Bartenev1-45/+2
2014-08-03Style: use ngx_free() instead of free().Tatsuhiko Kubo1-1/+1