aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_files.h
Commit message (Collapse)AuthorAge
* Cache: introduced min_free cache clearing.Maxim Dounin2020-06-22
| | | | | | | | | | | Clearing cache based on free space left on a file system is expected to allow better disk utilization in some cases, notably when disk space might be also used for something other than nginx cache (including nginx own temporary files) and while loading cache (when cache size might be inaccurate for a while, effectively disabling max_size cache clearing). Based on a patch by Adam Bambuch.
* Too large st_blocks values are now ignored (ticket #157).Maxim Dounin2020-06-22
| | | | | | | | | | | | | | With XFS, using "allocsize=64m" mount option results in large preallocation being reported in the st_blocks as returned by fstat() till the file is closed. This in turn results in incorrect cache size calculations and wrong clearing based on max_size. To avoid too aggressive cache clearing on such volumes, st_blocks values which result in sizes larger than st_size and eight blocks (an arbitrary limit) are no longer trusted, and we use st_size instead. The ngx_de_fs_size() counterpart is intentionally not modified, as it is used on closed files and hence not affected by this problem.
* Win32: removed NGX_DIR_MASK concept.Maxim Dounin2018-12-24
| | | | | | | | | | | | 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.
* Threads: offloading of temp files writing to thread pools.Maxim Dounin2016-03-18
| | | | | | | | | | | | | | | | | 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.
* Threads: task pointer stored in ngx_file_t.Maxim Dounin2016-03-18
| | | | | | | | | | | | | | 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.
* Core: added support for writing to stdout.Vladimir Homutov2015-06-16
|
* Added support for offloading read() in thread pools.Valentin Bartenev2015-03-14
|
* Refactored sendfile() AIO preload.Valentin Bartenev2015-02-11
| | | | | | | | This reduces layering violation and simplifies the logic of AIO preread, since it's now triggered by the send chain function itself without falling back to the copy filter. The context of AIO operation is now stored per file buffer, which makes it possible to properly handle cases when multiple buffers come from different locations, each with its own configuration.
* Added #ifndef around NGX_HAVE_CASELESS_FILESYSTEM define.Maxim Dounin2014-03-31
| | | | | | 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.
* Added ngx_filename_cmp() with "/" sorted to the left.Maxim Dounin2013-09-23
| | | | | | | | | | | | | | | | | | | | | | 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.
* Disable symlinks: use O_PATH to open path components.Valentin Bartenev2013-09-02
| | | | | | | | | | | | | | | | | 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.
* Make macros safe.Gleb Smirnoff2013-07-05
|
* Fixed unconditional MAX_PATH usage (ticket #22).Maxim Dounin2012-03-27
| | | | | | 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.
* Workaround for fs_size on ZFS (ticket #46).Maxim Dounin2012-02-28
| | | | | | | | | | 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).
* Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.Valentin Bartenev2012-02-21
|
* Disable symlinks: added explicit cast of AT_FDCWD (ticket #111).Maxim Dounin2012-02-20
| | | | | | 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.
* Added openat()/fstatat().Andrey Belov2012-02-13
|
* Copyright updated.Maxim Konovalov2012-01-18
|
* Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()Igor Sysoev2011-11-14
| | | | | for output of ./configure options, etc., since ngx_log_stderr() output length is limited by 2048 characters defined as NGX_MAX_ERROR_STR.
* elimination of reading cache files by cache loaderIgor Sysoev2011-07-24
|
* Use more precise stat.st_blocks to account cache size on UnixIgor Sysoev2011-04-22
| | | | | 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.
* ngx_create_file_mapping()Igor Sysoev2010-06-29
|
* use lstat() for WebDAV DELETE, COPY, and MOVE to handle symlinksIgor Sysoev2010-04-22
|
* use non-blocking open() not to hang on FIFO files, etc.Igor Sysoev2010-04-21
|
* fix posix_fadvise() error handlingIgor Sysoev2009-11-15
|
* export aio presence knowledge to prevent using "aio sendfile",Igor Sysoev2009-11-05
| | | | if aio does not present
* fix "if (!-x ...)"Igor Sysoev2009-11-03
|
* *) reset cached dirent.d_type after stat()Igor Sysoev2009-10-14
| | | | | | | 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
* read_aheadIgor Sysoev2009-09-30
|
* FreeBSD and Linux AIO supportIgor Sysoev2009-08-28
|
* style fixIgor Sysoev2009-06-11
|
* introduce ngx_write_console() to support OEM code pagesIgor Sysoev2009-04-28
|
* -p and --prefix=Igor Sysoev2009-04-27
|
* ngx_path_separator()Igor Sysoev2009-04-23
|
* issue start up errors and warning on both stderr and error_logIgor Sysoev2009-04-23
|
* adopt NGX_FILE_TRUNCATE for win32Igor Sysoev2009-04-08
|
* Win32 appends synchronized if only FILE_APPEND_DATA and SYNCHRONIZE are setIgor Sysoev2009-03-31
| | | | | without any other flags. On the other hand, Unix requires at least the write flag to be set together with O_APPEND.
* ngx_fs_bsize()Igor Sysoev2009-03-30
|
* a prelimiary proxy cache supportIgor Sysoev2009-03-23
|
* XFS on Linux does not set dirent.d_type,Igor Sysoev2009-03-06
| | | | | | 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
* compatibility with glibc 2.3, warn_unused_result attribute for write()Igor Sysoev2008-11-11
|
* $realpath_rootIgor Sysoev2008-09-27
|
* disable directio for unaligned reads in LinuxIgor Sysoev2008-09-12
|
* *) autoconfigure struct dirent capabilitiesIgor Sysoev2008-09-05
| | | | | *) move src/os/.../ngx_types.h's content into src/os/.../ngx_files.h and delete src/os/.../ngx_types.h
* style fixIgor Sysoev2008-09-05
|
* fix log messageIgor Sysoev2008-08-15
|
* Solaris directio()Igor Sysoev2008-08-04
|
* directioIgor Sysoev2008-07-30
|
* case insensitive file system location support provided by locale onlyIgor Sysoev2008-07-29
|
* ignore glob no match errorIgor Sysoev2008-04-29
|