summaryrefslogtreecommitdiffhomepage
path: root/src/os/unix/ngx_files.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-09Style.Sergey Kandaurov1-0/+1
2016-05-31Core: skip special buffers on writing (ticket #981).Maxim Dounin1-0/+5
A special last buffer with cl->buf->pos set to NULL can be present in a chain when writing request body if chunked encoding was used. This resulted in a NULL pointer dereference if it happened to be the only buffer left after a do...while loop iteration in ngx_write_chain_to_file(). The problem originally appeared in nginx 1.3.9 with chunked encoding support. Additionally, rev. 3832b608dc8d (nginx 1.9.13) changed the minimum number of buffers to trigger this from IOV_MAX (typically 1024) to NGX_IOVS_PREALLOCATE (typically 64). Fix is to skip such buffers in ngx_chain_to_iovec(), much like it is done in other places.
2016-03-31Fixed logging.Sergey Kandaurov1-1/+1
2016-03-18Threads: offloading of temp files writing to thread pools.Maxim Dounin1-14/+152
The ngx_thread_write_chain_to_file() function introduced, which uses ngx_file_t thread_handler, thread_ctx and thread_task fields. The task context structure (ngx_thread_file_ctx_t) is the same for both reading and writing, and can be safely shared as long as operations are serialized. The task->handler field is now always set (and not only when task is allocated), as the same task can be used with different handlers. The thread_write flag is introduced in the ngx_temp_file_t structure to explicitly enable use of ngx_thread_write_chain_to_file() in ngx_write_chain_to_temp_file() when supported by caller. In collaboration with Valentin Bartenev.
2016-03-18Threads: task pointer stored in ngx_file_t.Maxim Dounin1-4/+4
This simplifies the interface of the ngx_thread_read() function. Additionally, most of the thread operations now explicitly set file->thread_task, file->thread_handler and file->thread_ctx, to facilitate use of thread operations in other places. (Potential problems remain with sendfile in threads though - it uses file->thread_handler as set in ngx_output_chain(), and it should not be overwritten to an incompatible one.) In collaboration with Valentin Bartenev.
2016-03-03Introduced the ngx_chain_to_iovec() function.Valentin Bartenev1-50/+60
It's similar to ngx_output_chain_to_iovec() and uses only preallocated memory.
2015-11-17Used the pwritev() syscall for writing files where possible.Valentin Bartenev1-3/+35
It is more effective, because it doesn't require a separate lseek().
2015-11-17Moved file writev() handling code to a separate function.Valentin Bartenev1-32/+51
No functional changes.
2015-11-17Handled EINTR from write() and pwrite() syscalls.Valentin Bartenev1-3/+20
This is in addition to 6fce16b1fc10.
2015-11-17Adjusted file->sys_offset after the write() syscall.Valentin Bartenev1-0/+1
This fixes suboptimal behavior caused by surplus lseek() for sequential writes on systems without pwrite(). A consecutive read after write might result in an error on systems without pread() and pwrite(). Fortunately, at the moment there are no widely used systems without these syscalls.
2015-09-02Fixed building --with-debug, broken by 6fce16b1fc10.Valentin Bartenev1-1/+1
2015-09-02Writing to some file systems can be interrupted.Valentin Bartenev1-1/+12
At least such behavior was observed with CephFS, see: http://mailman.nginx.org/pipermail/nginx/2015-July/048188.html.
2015-03-14Added support for offloading read() in thread pools.Valentin Bartenev1-0/+109
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-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-03Made sure to initialize the entire "struct flock" allocated on stack.Ruslan Ermilov1-9/+3
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
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-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-02-11set current atime while setting mtimeIgor Sysoev1-1/+1
patch by Andrei Nigmatulin
2010-06-30fix ngx_write_file() bufIgor Sysoev1-2/+2
2010-06-29ngx_create_file_mapping()Igor Sysoev1-0/+52
2009-11-15fix posix_fadvise() error handlingIgor Sysoev1-0/+20
2009-11-05export aio presence knowledge to prevent using "aio sendfile",Igor Sysoev1-0/+7
if aio does not present
2009-10-14*) reset cached dirent.d_type after stat()Igor Sysoev1-2/+1
this fixes slash after link to a directory in ngx_http_autoindex_module; *) use cached dirent.d_type as hint on all systems the issues has been introduced in r2235
2009-09-25uniform ngx_directio_on/off() interface with other file functionsIgor Sysoev1-2/+2
2009-09-25handle short pwrite() to log an error cause: ENOSPC, EDQUOT, or EFBIGIgor Sysoev1-29/+33
2009-09-24log file name for read/write errorsIgor Sysoev1-11/+19
2009-03-30ngx_fs_bsize()Igor Sysoev1-0/+47
2009-03-06XFS on Linux does not set dirent.d_type,Igor Sysoev1-5/+3
therefore fallback to stat() if dirent.d_type is not set, this fixes slash after directory name in ngx_http_autoindex_module; the issue has been introduced in r2235
2008-09-12disable directio for unaligned reads in LinuxIgor Sysoev1-1/+16
2008-09-05*) autoconfigure struct dirent capabilitiesIgor Sysoev1-0/+21
*) move src/os/.../ngx_types.h's content into src/os/.../ngx_files.h and delete src/os/.../ngx_types.h
2008-08-26fix build on Linux and Solaris introduced in r2200Igor Sysoev1-1/+9
2008-08-22fix building on FreeBSD prior to 4.8, it has no GLOB_NOMATCHIgor Sysoev1-1/+5
2008-07-30directioIgor Sysoev1-0/+19
2008-04-29ignore glob no match errorIgor Sysoev1-1/+9
2007-01-18rename mode to accessIgor Sysoev1-2/+3
2006-10-02fix building on Linux and SolarisIgor Sysoev1-2/+2
2006-10-02glob support in includeIgor Sysoev1-0/+34
2006-08-30nginx-0.4.0-RELEASE importrelease-0.4.0Igor Sysoev1-0/+18
*) Change in internal API: the HTTP modules initialization was moved from the init module phase to the HTTP postconfiguration phase. *) Change: now the request body is not read beforehand for the ngx_http_perl_module: it's required to start the reading using the $r->has_request_body method. *) Feature: the ngx_http_perl_module supports the DECLINED return code. *) Feature: the ngx_http_dav_module supports the incoming "Date" header line for the PUT method. *) Feature: the "ssi" directive is available inside the "if" block. *) Bugfix: a segmentation fault occurred if there was an "index" directive with variables and the first index name was without variables; the bug had appeared in 0.1.29.
2006-04-14nginx-0.3.38-RELEASE importrelease-0.3.38Igor Sysoev1-2/+2
*) Feature: the ngx_http_dav_module. *) Change: the ngx_http_perl_module optimizations. Thanks to Sergey Skvortsov. *) Feature: the ngx_http_perl_module supports the $r->request_body_file method. *) Feature: the "client_body_in_file_only" directive. *) Workaround: now on disk overflow nginx tries to write access logs once a second only. Thanks to Anton Yuzhaninov and Maxim Dounin. *) Bugfix: now the "limit_rate" directive more precisely limits rate if rate is more than 100 Kbyte/s. Thanks to ForJest. *) Bugfix: now the IMAP/POP3 proxy escapes the "\r" and "\n" symbols in login and password to pass authorization server. Thanks to Maxim Dounin.
2006-02-08nginx-0.3.27-RELEASE importrelease-0.3.27Igor Sysoev1-31/+30
*) Change: the "variables_hash_max_size" and "variables_hash_bucket_size" directives. *) Feature: the $body_bytes_sent variable can be used not only in the "log_format" directive. *) Feature: the $ssl_protocol and $ssl_cipher variables. *) Feature: the cache line size detection for widespread CPUs at start time. *) Feature: now the "accept_mutex" directive is supported using fcntl(2) on platforms different from i386, amd64, sparc64, and ppc. *) Feature: the "lock_file" directive and the --with-lock-path=PATH autoconfiguration directive. *) Bugfix: if the HTTPS protocol was used in the "proxy_pass" directive then the requests with the body was not transferred.
2005-11-15nginx-0.3.10-RELEASE importrelease-0.3.10Igor Sysoev1-1/+1
*) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
2005-10-12nginx-0.3.2-RELEASE importrelease-0.3.2Igor Sysoev1-8/+71
*) Feature: the Sun Studio 10 C compiler support. *) Feature: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", and "fastcgi_upstream_fail_timeout" directives.
2005-03-19nginx-0.1.25-RELEASE importrelease-0.1.25Igor Sysoev1-2/+2
*) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
2004-11-25nginx-0.1.9-RELEASE importrelease-0.1.9Igor Sysoev1-2/+2
*) Bugfix: the proxied request was sent without arguments if the request contains "//", "/./", "/../" or "%XX". *) Bugfix: the large compressed responses may be transferred not completely. *) Bugfix: the files bigger than 2G was not transferred on Linux that does not support sendfile64(). *) Bugfix: while the build configuration on Linux the --with-poll_module parameter was required; the bug had appeared in 0.1.8.
2004-11-20nginx-0.1.8-RELEASE importrelease-0.1.8Igor Sysoev1-2/+2
*) Bugfix: in the ngx_http_autoindex_module if the long file names were in the listing. *) Feature: the "^~" modifier in the location directive. *) Feature: the proxy_max_temp_file_size directive.