summaryrefslogtreecommitdiffhomepage
path: root/src/os/unix (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2012-11-12Merge of r4870, r4871, r4890, r4895: minor fixes.Maxim Dounin2-10/+6
*) Made sure to initialize the entire ngx_file_t structure. Found by Coverity. *) Correct plural form for "path" in the whole source base. *) Removed conditional compilation from waitpid() error test. 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. *) Style, parentheses instead of braces in misc/GNUMakefile.
2012-11-12Merge of r4865: 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-09-24Merge of r4785, r4795, r4811, r4812, r4816, r4822: coverity.Maxim Dounin1-1/+1
*) Resolver: fixed possible memory leak in ngx_resolver_create(). *) Explicitly ignore returned value from unlink() in ngx_open_tempfile(). *) Explicitly ignore returned value from close() in ngx_event_core_init_conf(). *) Added three missing checks for NULL after ngx_array_push() calls. *) Crypt: fixed handling of corrupted SSHA entries in password file. *) Mark logically dead code with corresponding comment. Found by / prodded by Coverity.
2012-08-06Merge of r4760, r4761: -Wmissing-prototypes.Maxim Dounin3-0/+9
Fixed compilation with -Wmissing-prototypes. Added a commented out -Wmissing-prototypes to CFLAGS. It is commented out to not break builds with 3rd party modules.
2012-08-06Merge of r4738: struct flock initialization.Maxim Dounin1-9/+3
Made sure to initialize the entire "struct flock" allocated on stack.
2012-07-02Merge of r4693: fixed "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-07-02Merge of r4682, r4694, r4699, r4704, r4705: minor nits.Maxim Dounin2-2/+2
*) Fixed spelling of "endianness", and called it "byte ordering" in the user visible part. *) Fixed return type of ngx_strerror_init(). *) Fixed a harmless error in spelling of "Connection: close" when computing the response header length. *) Style. *) Added code to look up Google perftools in /opt/local/, for MacPorts.
2012-07-02Merge of r4654, r4672, r4684, r4685, r4692: resolver changes.Maxim Dounin1-0/+4
*) Resolver: fixed format specification. Patch by Yichun Zhang (agentzh). *) Support for IPv6 literals and an optional port in resolver. *) Fixed crash in ngx_resolver_cleanup_tree(). If sending a DNS request fails with an error (e.g., when mistakenly trying to send it to a local IP broadcast), such a request is not deleted if there are clients waiting on it. However, it was still erroneously removed from the queue. Later ngx_resolver_cleanup_tree() attempted to remove it from the queue again that resulted in a NULL pointer dereference. *) When "resolver" is configured with a domain name, only the first resolved address was used. Now all addresses will be used. *) Fixed segfault with poll and resolver used. 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-07-02Merge of r4646: jemalloc 3.0.0 compatibility.Maxim Dounin1-2/+2
Fixed compilation with -DNGX_DEBUG_MALLOC on FreeBSD 10. 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-06-04Merge of r4619: accept moderation on 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.
2012-01-18Copyright updated.Maxim Konovalov67-0/+67
2012-01-16Fixed sched_setaffinity(2) to correctly pass size.Maxim Dounin1-1/+4
Second argument (cpusetsize) is size in bytes, not in bits. Previously used constant 32 resulted in reading of uninitialized memory and caused EINVAL to be returned on some Linux kernels.
2011-12-11Microoptimization of sendfile(2) usage under FreeBSD.Maxim Dounin1-2/+7
FreeBSD kernel checks headers/trailers pointer against NULL, not corresponding count. Passing NULL if there are no headers/trailers helps to avoid unneeded work in kernel, as well as unexpected 0 bytes GIO in traces.
2011-11-28Added (void) as we intentionally ignore returned values.Maxim Dounin1-1/+1
Requested by Igor Sysoev.
2011-11-23Unlock of shared memory zones on process crash.Maxim Dounin1-11/+50
If process exited abnormally while holding lock on some shared memory zone - unlock it. It may be not safe thing to do (as crash with lock held may result in corrupted shared memory structure, and other processes will subsequently crash while trying to access shared data), therefore complain loudly if unlock succeeds.
2011-11-23Added shmtx interface to forcibly unlock mutexes.Maxim Dounin1-1/+1
It is currently used from master process on abnormal worker termination to unlock accept mutex (unlocking of accept mutex was broken in 1.0.2). It is expected to be used in the future to unlock other mutexes as well. Shared mutex code was rewritten to make this possible in a safe way, i.e. with a check if lock was actually held by the exited process. We again use pid to lock mutex, and use separate atomic variable for a count of processes waiting in sem_wait().
2011-11-18FreeBSD 10-current has recently gotten POSIX_FADV_* macros.Maxim Konovalov1-1/+1
A fix for the broken build applied. Patch from Igor Sysoev.
2011-11-14Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()Igor Sysoev1-0/+1
for output of ./configure options, etc., since ngx_log_stderr() output length is limited by 2048 characters defined as NGX_MAX_ERROR_STR.
2011-10-25Fixed range checking for the "somaxconn" sysctl.Ruslan Ermilov2-12/+5
2011-10-24malloc() debugging on MacOSX.Igor Sysoev10-5/+45
2011-10-21Fixed another return in unix ngx_write_chain_to_file().Maxim Dounin1-2/+9
Previous patch missed special case for one iovec, it needs total bytes written to be returned as well.
2011-10-20Fixed unix ngx_write_chain_to_file() to return total bytes written.Maxim Dounin1-2/+5
Previously result of last iteration's writev() was returned. This was unnoticed as return value was only used if chain contained only one or two buffers.
2011-09-19Replaced "can not" with "cannot" and "could not" in a bunch of places.Ruslan Ermilov5-5/+6
Fixed nearby grammar errors.
2011-09-16Fixing Linux AIO syscalls return value handling:Igor Sysoev1-9/+7
syscall(2) uses usual libc convention, it returns -1 on error and sets errno. Obsolete _syscall(2) returns negative value of error. Thanks to Hagai Avrahami.
2011-09-13In Mac OS X Lion, Apple deprecated the use of the system OpenSSL libraryRuslan Ermilov1-0/+2
in favour of their CommonCrypto library. This change adds a work-around that allows nginx to still be built on Lion with OpenSSL.
2011-09-05Bugfix: open_file_cache lost is_directio flag.Maxim Dounin2-0/+7
On file retest open_file_cache lost is_directio if file wasn't changed. This caused unaligned operations under Linux to fail with EINVAL. It wasn't noticeable with AIO though, as errors wasn't properly logged.
2011-08-22SIGWINCH/NOACCEPT signal is disabled now in non-daemon mode.Igor Sysoev1-2/+7
Non-daemon mode is currently used by supervisord, daemontools and so on or during debugging. The NOACCEPT signal is only used for online upgrade which is not supported when nginx is run under supervisord, etc., so this change should not break existant setups.
2011-08-21Move SO_ACCEPTFILTER and TCP_DEFER_ACCEPT checks into configure.Maxim Dounin2-10/+0
NetBSD 5.0+ has SO_ACCEPTFILTER support merged from FreeBSD, and having accept filter check in FreeBSD-specific ngx_freebsd_config.h prevents it from being used on NetBSD. Therefore move the check into configure (and do the same for Linux-specific TCP_DEFER_ACCEPT, just to be in line).
2011-07-24elimination of reading cache files by cache loaderIgor Sysoev1-0/+1
2011-05-16"$apr1", "{PLAIN}", and "{SSHA}" password methods in auth basic moduleIgor Sysoev2-3/+3
patch by Maxim Dounin
2011-05-10use POSIX semaphores in shmtx instead of sched_yield()Igor Sysoev5-0/+25
number of spinlock spins are increased twice
2011-04-23revert r3864, it may cause kernel panic on some kernels while working with IPv6Igor Sysoev1-1/+1
2011-04-22Use more precise stat.st_blocks to account cache size on UnixIgor Sysoev1-0/+1
instead of file length rounded to a file system block size. There is no similar way on Windows, so rounding to a cache->bsize is kept.