summaryrefslogtreecommitdiffhomepage
path: root/src/os (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2014-09-08Added ngx_init_setproctitle() return code check.Maxim Dounin2-3/+5
The ngx_init_setproctitle() function, as used on systems without setproctitle(3), may fail due to memory allocation errors, and therefore its return code needs to be checked. Reported by Markus Linnala.
2014-09-01Events: removed broken thread support from posted events.Valentin Bartenev2-12/+4
It's mostly dead code. And the idea of thread support for this task has been deprecated.
2014-08-01Core: exit on ngx_pnalloc() failure.Piotr Sikora1-0/+4
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-08-03Style: use ngx_free() instead of free().Tatsuhiko Kubo1-1/+1
2014-07-28Bigger iovec buffer in ngx_readv_chain().Maxim Dounin1-1/+5
This helps to reduce likelyhood of memory allocations in ngx_readv_chain(), which are known to lead to noticeable effects in some cases, see http://mailman.nginx.org/pipermail/nginx/2014-July/044512.html.
2014-07-08Style: keep return type and function name on different lines.Piotr Sikora1-3/+6
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-08Style: add whitespace between control statement and parentheses.Piotr Sikora1-1/+1
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-07-05Win32: ngx_open_dir() and ngx_close_dir() fixes.Maxim Dounin2-1/+14
The ngx_open_dir() function changed to restore name passed to it. This fixes removing destination directory in dav module, as caught by dav.t. The ngx_close_dir() function introduced to properly convert errors, as FindClose() returns 0 on error.
2014-06-19FreeBSD has migrated to Bugzilla.Sergey Kandaurov2-2/+2
2014-05-28Configure: added -Wno-deprecated-declarations on OS X.Maxim Dounin1-3/+0
Previous workaround to avoid warnings on OS X due to deprecated system OpenSSL library (introduced in a3870ea96ccd) no longer works, as the MAC_OS_X_VERSION_MIN_REQUIRED macro is ignored on OS X 10.9 if a compiler used supports __attribute__(availability).
2014-05-23Events: use eventfd() instead of syscall(SYS_eventfd) if possible.Ruslan Ermilov1-0/+3
This fixes --with-file-aio support on systems that lack eventfd() syscall, notably aarch64 Linux. The syscall(SYS_eventfd) may still be necessary on systems that have eventfd() syscall in the kernel but lack it in glibc, e.g. as seen in the current CentOS 5 release.
2014-05-12Added syslog support for error_log and access_log directives.Vladimir Homutov1-4/+7
2014-05-20Configure: the --build= option.Ruslan Ermilov2-2/+2
If set, its value is output in "nginx -v" and in the error log.
2014-03-31Win32: fixed cpu hog by cache manager on exit (ticket #514).Maxim Dounin1-3/+3
The "ngx_quit" may be reset by the worker thread before it's seen by a ngx_cache_manager_thread(), resulting in an infinite loop. Make sure to test ngx_exiting as well.
2014-03-31Added #ifndef around NGX_HAVE_CASELESS_FILESYSTEM define.Maxim Dounin1-0/+2
This brings Cygwin compilation in line with other case-insensitive systems (notably win32 and OS X) where one can force case sensitivity using -DNGX_HAVE_CASELESS_FILESYSTEM=0.
2014-03-06Added connection serial number in logging of left open sockets.Sergey Kandaurov2-4/+4
2014-02-13Win32: MSVC 2013 compatibility.Maxim Dounin1-0/+8
Warnings about GetVersionEx() deprecation silenced. Precompiled object linked in.
2014-02-03Use ngx_socket_errno where appropriate.Piotr Sikora2-3/+3
Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-01-30Core: handle getsockopt(TCP_FASTOPEN) failures.Piotr Sikora2-0/+2
Linux returns EOPNOTSUPP for non-TCP sockets and ENOPROTOOPT for TCP sockets, because getsockopt(TCP_FASTOPEN) is not implemented so far. While there, lower the log level from ALERT to NOTICE to match other getsockopt() failures. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2014-01-04Win32: support for UTF-16 surrogate pairs (ticket #457).Maxim Dounin1-2/+21
2014-01-04Added per-process random seeding (ticket #456).Maxim Dounin2-1/+3
2013-11-29Win32: fixed init_process without master process (ticket #453).Maxim Dounin1-10/+0
Init process callbacks are called by ngx_worker_thread(), there is no need to call them in ngx_single_process_cycle().
2013-10-31Win32: plugged memory leak.Maxim Dounin1-0/+2
2013-10-31Core: handling of getsockopt(TCP_DEFER_ACCEPT) failures.Maxim Dounin2-0/+2
Recent Linux versions started to return EOPNOTSUPP to getsockopt() calls on unix sockets, resulting in log pollution on binary upgrade. Such errors are silently ignored now.
2013-09-23Added ngx_filename_cmp() with "/" sorted to the left.Maxim Dounin8-17/+10
This patch fixes incorrect handling of auto redirect in configurations like: location /0 { } location /a- { } location /a/ { proxy_pass ... } With previously used sorting, this resulted in the following locations tree (as "-" is less than "/"): "/a-" "/0" "/a/" and a request to "/a" didn't match "/a/" with auto_redirect, as it didn't traverse relevant tree node during lookup (it tested "/a-", then "/0", and then falled back to null location). To preserve locale use for non-ASCII characters on case-insensetive systems, libc's tolower() used.
2013-09-05Fixed handling of the ready flag with kqueue.Valentin Bartenev2-0/+2
There is nothing to do more when recv() has returned 0, so we should drop the flag.
2013-09-04Win32: MinGW GCC compatibility.Maxim Dounin5-6/+14
Several warnings silenced, notably (ngx_socket_t) -1 is now checked on socket operations instead of -1, as ngx_socket_t is unsigned on win32 and gcc complains on comparison. With this patch, it's now possible to compile nginx using mingw gcc, with options we normally compile on win32.
2013-09-04Win32: Borland C compatibility fixes.Maxim Dounin1-0/+8
Several false positive warnings silenced, notably W8012 "Comparing signed and unsigned" (due to u_short values promoted to int), and W8072 "Suspicious pointer arithmetic" (due to large type values added to pointers). With this patch, it's now again possible to compile nginx using bcc32, with options we normally compile on win32 minus ipv6 and ssl.
2013-09-04Win32: Open Watcom C compatibility fixes.Maxim Dounin1-0/+14
Precompiled headers are disabled as they lead to internal compiler errors with long configure lines. Couple of false positive warnings silenced. Various win32 typedefs are adjusted to work with Open Watcom C 1.9 headers. With this patch, it's now again possible to compile nginx using owc386, with options we normally compile on win32 minus ipv6 and ssl.
2013-09-02Disable symlinks: use O_PATH to open path components.Valentin Bartenev1-0/+3
It was introduced in Linux 2.6.39, glibc 2.14 and allows to obtain file descriptors without actually opening files. Thus made it possible to traverse path with openat() syscalls without the need to have read permissions for path components. It is effectively emulates O_SEARCH which is missing on Linux. O_PATH is used in combination with O_RDONLY. The last one is ignored if O_PATH is used, but it allows nginx to not fail when it was built on modern system (i.e. glibc 2.14+) and run with a kernel older than 2.6.39. Then O_PATH is unknown to the kernel and ignored, while O_RDONLY is used. Sadly, fstat() is not working with O_PATH descriptors till Linux 3.6. As a workaround we fallback to fstatat() with the AT_EMPTY_PATH flag that was introduced at the same time as O_PATH.
2013-09-02Added the NGX_EBADF define.Valentin Bartenev2-0/+2
2013-07-30Autoindex: improved ngx_de_info() error handling.Sergey Kandaurov2-1/+2
This allows to build a directory listing whenever a loop exists in symbolic link resolution of the path argument.
2013-08-20Format specifier fixes in error logging.Sergey Kandaurov1-1/+1
2013-08-15Unbreak building on Linux without sendfile64() support.Valentin Bartenev1-3/+3
It was broken in 8e446a2daf48 when the NGX_SENDFILE_LIMIT constant was added to ngx_linux_sendfile_chain.c having the same name as already defined one in ngx_linux_config.h. The newer is needed to overcome a bug in old Linux kernels by limiting the number of bytes to send per sendfile() syscall. The older is used with sendfile() on ancient kernels that works with 32-bit offsets only. One of these renamed to NGX_SENDFILE_MAXSIZE.
2013-08-08Don't lose pointer to first nonempty buf in ngx_*_sendfile_chain().Gleb Smirnoff4-66/+58
In ngx_*_sendfile_chain() when calculating pointer to a first non-zero sized buf, use "in" as iterator. This fixes processing of zero sized buf(s) after EINTR. Otherwise function can return zero sized buf to caller, and later ngx_http_write_filter() logs warning.
2013-07-25On DragonFlyBSD, TCP_KEEPIDLE and TCP_KEEPINTVL are in msecs.Ruslan Ermilov1-0/+5
Based on a patch by Sepherosa Ziehau.
2013-07-13Events: honor NGX_USE_GREEDY_EVENT when kqueue support is enabled.Valentin Bartenev2-2/+4
Currently this flag is needed for epoll and rtsig, and though these methods usually present on different platforms than kqueue, nginx can be compiled to support all of them.
2013-07-11Style.Maxim Dounin1-1/+1
2013-07-05Make macros safe.Gleb Smirnoff2-8/+8
2013-06-26Fixed build on Linux with x32 ABI.Maxim Dounin1-2/+7
On Linux x32 inclusion of sys/sysctl.h produces an error. As sysctl() is only used by rtsig event method code, which is legacy and not compiled in by default on modern linuxes, the sys/sysctl.h file now only included if rtsig support is enabled. Based on patch by Serguei I. Ivantsov.
2013-06-20Core: support several "error_log" directives.Vladimir Homutov1-0/+2
When several "error_log" directives are specified in the same configuration block, logs are written to all files with a matching log level. All logs are stored in the singly-linked list that is sorted by log level in the descending order. Specific debug levels (NGX_LOG_DEBUG_HTTP,EVENT, etc.) are not supported if several "error_log" directives are specified. In this case all logs will use debug level that has largest absolute value.
2013-06-12Valgrind: another complaint about uninitialized bytes.Tatsuhiko Kubo1-0/+2
2013-06-05Valgrind: supressed complaints about uninitialized bytes.Maxim Dounin1-0/+8
Valgrind complains if we pass uninitialized memory to a syscall: ==36492== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s) ==36492== at 0x6B5E6A: sendmsg (in /usr/lib/system/libsystem_kernel.dylib) ==36492== by 0x10004288E: ngx_signal_worker_processes (ngx_process_cycle.c:527) ==36492== by 0x1000417A7: ngx_master_process_cycle (ngx_process_cycle.c:203) ==36492== by 0x100001F10: main (nginx.c:410) ==36492== Address 0x7fff5fbff71c is on thread 1's stack Even initialization of all members of the structure passed isn't enough, as there is padding which still remains uninitialized and results in Valgrind complaint. Note there is no real problem here as data from uninitialized memory isn't used.
2013-06-05Valgrind: sigaction() failure now ignored.Maxim Dounin1-0/+5
Valgrind intercepts SIGUSR2 in some cases, and nginx might not be able to start due to sigaction() failure. If compiled with NGX_VALGRIND defined, we now ignore the failure of sigaction().
2013-05-29Win32: added missing reset of wev->ready on WSAEWOULDBLOCK.Maxim Dounin1-0/+1
This fixes connection hang with websockets proxy, and likely some other places as well.
2013-05-23Use "void" for functions with empty parameter list.Sergey Kandaurov4-5/+5
2013-05-21Style: remove unnecessary references to HTTP from non-HTTP modules.Piotr Sikora1-1/+1
No functional changes. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
2013-03-25Use NGX_FILE_ERROR for handling file operations errors.Valentin Bartenev1-1/+1
On Win32 platforms 0 is used to indicate errors in file operations, so comparing against -1 is not portable. This was not much of an issue in patched code, since only ngx_fd_info() test is actually reachable on Win32 and in worst case it might result in bogus error log entry. Patch by Piotr Sikora.
2013-03-20Win32: disabled MSVC warning about '\0' not fitting into array.Valentin Bartenev1-0/+3
We believe that this warning produces more inconvience than real benefit. Here is an example to trigger: u_char a[4] = "test";
2012-12-21Core: crypt_r() error handling fixed.Maxim Dounin1-14/+13
The crypt_r() function returns NULL on errors, check it explicitly instead of assuming errno will remain 0 if there are no errors (per POSIX, the setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified). Additionally, dropped unneeded ngx_set_errno(0) and fixed error handling of memory allocation after normal crypt(), which was inapropriate and resulted in null pointer dereference on allocation failures.