summaryrefslogtreecommitdiffhomepage
path: root/src/os/unix (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-07-30Autoindex: improved ngx_de_info() error handling.Sergey Kandaurov1-1/+1
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 Smirnoff1-5/+5
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-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.
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.
2012-11-29Core: removed GLOB_NOSORT glob option.Maxim Dounin1-1/+1
This will result in alphabetical sorting of included files if the "include" directive with wildcards is used. Note that the behaviour is now different from that on Windows, where alphabetical sorting is not guaranteed for FindFirsFile()/FindNextFile() (used to be alphabetical on NTFS, but not on FAT). Approved by Igor Sysoev, prodded by many.
2012-11-26Core: fixed ngx_write_chain_to_file() with IOV_MAX reached.Maxim Dounin1-0/+1
Catched by dav_chunked.t on Solaris. In released versions this might potentially result in corruption of complex protocol responses if they were written to disk and there were more distinct buffers than IOV_MAX in a single write.
2012-11-21Core: added debug logging of writev() in ngx_write_chain_to_file().Maxim Dounin1-0/+3
2012-11-20Fixed failure to start cache manager and cache loader processesIgor Sysoev1-4/+9
if there were more than 512 listening sockets in configuration.
2012-11-16Fixed setting of CPU affinity on respawn of dead worker processes.Ruslan Ermilov1-14/+16
Worker processes are now made aware of their sequential number needed to select CPU affinity mask. This replaces a workaround from r4865.
2012-10-18Removed conditional compilation from waitpid() error test.Maxim Dounin1-4/+0
There are reports that call to a signal handler for an exited process despite waitpid() already called for the process may happen on Linux as well.
2012-09-28Correct plural form for "path" in the whole source base.Andrey Belov1-6/+6
2012-09-26Added clearing of cpu_affinity after process spawn.Maxim Dounin1-0/+2
This fixes unwanted/incorrect cpu_affinity use on dead worker processes respawn. While this is not ideal, it's expected to be better when previous situation where multiple processes were spawn with identical CPU affinity set. Reported by Charles Chen.
2012-08-06Explicitly ignore returned value from unlink() in ngx_open_tempfile().Andrey Belov1-1/+1
The only thing we could potentially do here in case of error returned is to complain to error log, but we don't have log structure available here due to interface limitations. Prodded by Coverity.
2012-07-24Fixed compilation with -Wmissing-prototypes.Ruslan Ermilov3-0/+9
2012-07-03Made sure to initialize the entire "struct flock" allocated on stack.Ruslan Ermilov1-9/+3
2012-06-18Fixed return type of ngx_strerror_init().Maxim Dounin2-2/+2
2012-06-18Fixed "sendmsg() failed" alerts on HP-UX.Maxim Dounin1-0/+1
HP-UX needs _HPUX_ALT_XOPEN_SOCKET_API to be defined to be able to use various POSIX versions of networking functions. Notably sendmsg() resulted in "sendmsg() failed (9: Bad file number)" alerts without it. See xopen_networking(7) for more details.
2012-06-18Fixed segfault with poll and resolver used.Maxim Dounin1-0/+4
Poll event method needs ngx_cycle->files to work, and use of ngx_exit_cycle without files set caused null pointer dereference in resolver's cleanup on udp socket close.
2012-05-23Fixed compilation with -DNGX_DEBUG_MALLOC on FreeBSD 10.Maxim Dounin1-2/+2
After jemalloc 3.0.0 import there is no _malloc_options symbol, it has been replaced with the malloc_conf one with a different syntax.
2012-05-11Accept moderation in case of EMFILE/ENFILE.Maxim Dounin1-0/+2
In case of EMFILE/ENFILE returned from accept() we disable accept events, and (in case of no accept mutex used) arm timer to re-enable them later. With accept mutex we just drop it, and rely on normal accept mutex handling to re-enable accept events once it's acquired again. As we now handle errors in question, logging level was changed to "crit" (instead of "alert" used for unknown errors). Note: the code might call ngx_enable_accept_events() multiple times if there are many listen sockets. The ngx_enable_accept_events() function was modified to check if connection is already active (via c->read->active) and skip it then, thus making multiple calls safe.
2012-04-17Fixed ngx_readv_chain() to honor IOV_MAX (ticket #14).Maxim Dounin1-0/+8
Not using full chain passed is ok as consumers are expected to check event's ready flag to determine if another call is needed, not the returned size.
2012-04-17IOV_MAX handling microoptimization.Maxim Dounin5-18/+44
We now stop on IOV_MAX iovec entries only if we are going to add new one, i.e. next buffer can't be coalesced into last iovec. This also fixes incorrect checks for trailer creation on FreeBSD and Mac OS X, header.nelts was checked instead of trailer.nelts.
2012-04-17Fixed loop in ngx_writev_chain() and ngx_solaris_sendfilev_chain().Maxim Dounin2-2/+2
The "complete" flag wasn't cleared on loop iteration start, resulting in broken behaviour if there were more than IOV_MAX buffers and first iteration was fully completed (and hence the "complete" flag was set to 1).
2012-04-05Style: the function type should be on a line by itselfMaxim Konovalov1-1/+2
preceding the function. No functional changes.
2012-04-03Fixed spelling in multiline C comments.Ruslan Ermilov4-5/+5
2012-03-27Fixed unconditional MAX_PATH usage (ticket #22).Maxim Dounin1-1/+12
POSIX doesn't require it to be defined, and Debian GNU/Hurd doesn't define it. Note that if there is no MAX_PATH defined we have to use realpath() with NULL argument and free() the result.
2012-03-27Added explicit include of time.h.Maxim Dounin3-0/+3
Most of the systems have it included due to namespace pollution, but relying on this is a bad idea. Explicit include is required for at least Debian GNU/Hurd.
2012-03-21worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.Ruslan Ermilov4-15/+95
2012-03-05Whitespace fixes.Maxim Dounin1-1/+1
2012-02-28Added msleep() on reload to allow new processes to start.Maxim Dounin1-0/+4
This is expected to ensure smoother operation on reload (and with less chance of listen queue overflows). Prodded by Igor Sysoev.
2012-02-28Fixed spelling in single-line comments.Ruslan Ermilov3-3/+3
2012-02-28Workaround for fs_size on ZFS (ticket #46).Maxim Dounin1-2/+3
ZFS reports incorrect st_blocks until file settles on disk, and this may take a while (i.e. just after creation of a file the st_blocks value is incorrect). As a workaround we now use st_blocks only if st_blocks * 512 > st_size, this should fix ZFS problems while still preserving accuracy for other filesystems. The problem had appeared in r3900 (1.0.1).
2012-02-21Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.Valentin Bartenev1-0/+17
2012-02-20Disable symlinks: added explicit cast of AT_FDCWD (ticket #111).Maxim Dounin1-0/+2
Solaris has AT_FDCWD defined to unsigned value, and comparison of a file descriptor with it causes warnings in modern versions of gcc. Explicitly cast AT_FDCWD to ngx_fd_t to resolve these warnings.
2012-02-13Added openat()/fstatat().Andrey Belov2-0/+24
2012-02-10Added ngx_ncpu detection for most *nix platforms.Valentin Bartenev1-0/+6
This inaccurate detection by using sysconf(_SC_NPROCESSORS_ONLN) can improve usage of the mutex lock optimization on multicore systems.
2012-01-30Fixed AIO error handling on FreeBSD.Maxim Dounin1-18/+9
The aio_return() must be called regardless of the error returned by aio_error(). Not calling it resulted in various problems up to segmentation faults (as AIO events are level-triggered and were reported again and again). Additionally, in "aio sendfile" case r->blocked was incremented in case of error returned from ngx_file_aio_read(), thus causing request hangs.