aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_file.c
Commit message (Collapse)AuthorAge
* 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.
* Dav: changed ngx_copy_file() to preserve access and mtime.Maxim Dounin2018-08-01
| | | | | | | | | | | | This fixes wrong permissions and file time after cross-device MOVE in the DAV module (ticket #1577). Broken in 8101d9101ed8 (0.8.9) when cross-device copying was introduced in ngx_ext_rename_file(). With this change, ngx_copy_file() always calls ngx_set_file_time(), either with the time provided, or with the time from the original file. This is considered acceptable given that copying the file is costly anyway, and optimizing cases when we do not need to preserve time will require interface changes.
* Dav: fixed ngx_copy_file() to truncate destination file.Maxim Dounin2018-08-01
| | | | | | Previously, ngx_open_file(NGX_FILE_CREATE_OR_OPEN) was used, resulting in destination file being partially rewritten if exists. Notably, this affected WebDAV COPY command (ticket #1576).
* Removed excessive casts for ngx_file_info().Ruslan Ermilov2017-06-14
|
* Cache: prefix-based temporary files.Maxim Dounin2016-11-03
| | | | | | | | | | | On Linux, the rename syscall can be slow due to a global file system lock, acquired for the entire rename operation, unless both old and new files are in the same directory. To address this temporary files are now created in the same directory as the expected resulting cache file when using the "use_temp_path=off" parameter. This change mostly reverts 99639bfdfa2a and 3281de8142f5, restoring the behaviour as of a9138c35120d (with minor changes).
* Core: ngx_conf_set_access_slot() user access (ticket #1096).Maxim Dounin2016-10-07
| | | | | | Previously, user access bits were always set to "rw" unconditionally, even with "user:r" explicitly specified. With this change we only add default user access bits (0600) if they weren't set explicitly.
* Use NGX_MAX_PATH_LEVEL where appropriate.Ruslan Ermilov2016-07-06
| | | | The macro was unused since 0.7.44.
* Fixed logging.Sergey Kandaurov2016-03-31
|
* Style.Ruslan Ermilov2016-03-30
|
* Win32: additional error code NGX_EEXIST_FILE (ticket #910).Maxim Dounin2016-03-29
| | | | | | | | | | On Windows there are two possible error codes which correspond to the EEXIST error code: ERROR_FILE_EXISTS used by CreateFile(CREATE_NEW), and ERROR_ALREADY_EXISTS used by CreateDirectory(). MoveFile() seems to use both: ERROR_ALREADY_EXISTS when moving within one filesystem, and ERROR_FILE_EXISTS when copying a file to a different drive.
* 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.
* Core: limited levels of subdirectory hierarchy used for temp files.Sergey Kandaurov2015-04-07
| | | | | | | | Similar to ngx_http_file_cache_set_slot(), the last component of file->name with a fixed length of 10 bytes, as generated in ngx_create_temp_path(), is used as a source for the names of intermediate subdirectories with each one taking its own part. Ensure that the sum of specified levels with slashes fits into the length (ticket #731).
* Core: removed excessive initialization in ngx_conf_set_path_slot().Sergey Kandaurov2015-04-07
| | | | Level hierarchy is pre-zeroed in ngx_pcalloc() of the surrounding ngx_path_t.
* Core: fixed error handling on ngx_conf_full_name() failure.Sergey Kandaurov2015-04-07
|
* Core: reverted prefix-based temp files (a9138c35120d).Roman Arutyunyan2015-02-02
| | | | | The use_temp_path http cache feature is now implemented using a separate temp hierarchy in cache directory. Prefix-based temp files are no longer needed.
* Core: supported directory skipping in ngx_walk_tree().Roman Arutyunyan2015-02-02
| | | | If pre_tree_handler() returns NGX_DECLINED, the directory is ignored.
* Core: added prefix-based temporary files.Valentin Bartenev2014-12-26
| | | | | Now, if the "path" parameter is NULL, ngx_create_temp_file() will use file->name as a predefined file path prefix.
* Unified handling of ngx_create_temp_file() return value.Valentin Bartenev2014-12-26
| | | | | | | The original check for NGX_AGAIN was surplus, since the function returns only NGX_OK or NGX_ERROR. Now it looks similar to other places. No functional changes.
* Improved check for duplicate path names in ngx_add_path().Valentin Bartenev2013-09-16
| | | | | | | | | The same path names with different "data" context should not be allowed. In particular it rejects configurations like this: proxy_cache_path /var/cache/ keys_zone=one:10m max_size=1g inactive=5m; proxy_cache_path /var/cache/ keys_zone=two:20m max_size=4m inactive=30s;
* Removed surplus initializations from ngx_conf_set_path_slot().Valentin Bartenev2013-09-16
| | | | An instance of ngx_path_t is already zeroed by ngx_pcalloc().
* Use ngx_pcalloc() in ngx_conf_merge_path_value().Valentin Bartenev2013-09-16
| | | | | It initializes the "data" pointer of ngx_path_t that will be checked after subsequent changes.
* Backed out f1a91825730a and 7094bd12c1ff.Maxim Dounin2013-08-20
| | | | | | | While ngx_get_full_name() might have a bit more descriptive arguments, the ngx_conf_full_name() is generally easier to use when parsing configuration and limits exposure of cycle->prefix / cycle->conf_prefix details.
* Replaced ngx_conf_full_name() with ngx_get_full_name().Valentin Bartenev2013-08-06
| | | | The ngx_get_full_name() function takes more readable arguments list.
* Fixed memory leaks in the root and auth_basic_user_file directives.Valentin Bartenev2013-08-06
| | | | | | | | If a relative path is set by variables, then the ngx_conf_full_name() function was called while processing requests, which causes allocations from the cycle pool. A new function that takes pool as an argument was introduced.
* Fixed handling of ngx_write_fd() and ngx_read_fd() errors.Valentin Bartenev2012-12-14
| | | | | | | | | The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error, so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows platforms) might result in inaccurate error message in the error log. Also the ngx_errno global variable is being set only if the returned value is -1.
* Correct plural form for "path" in the whole source base.Andrey Belov2012-09-28
|
* Fixed spelling in multiline C comments.Ruslan Ermilov2012-04-03
|
* Copyright updated.Maxim Konovalov2012-01-18
|
* elimination of reading cache files by cache loaderIgor Sysoev2011-07-24
|
* ngx_str_set() and ngx_str_null()Igor Sysoev2010-05-14
|
* do not set file time in ngx_copy_file() if the time is -1,Igor Sysoev2010-03-30
| | | | this fixes an issue when file is moved across devices
* fix Win32 error message when an temporary file replaces an existent file:Igor Sysoev2009-12-17
| | | | | return at once if ngx_win32_rename_file() was not failed and do not try to delete already the renamed temporary file
* fix Win32 error messages when an temporary file replaces an existent file:Igor Sysoev2009-12-15
| | | | | | *) do not rename an already renamed file *) now ngx_win32_rename_file() returns error code *) do not log failure inside ngx_win32_rename_file()
* ignore EACCES errors for top level directories in ngx_create_full_path()Igor Sysoev2009-10-14
|
* do not create Win32 drive letter in ngx_create_full_path()Igor Sysoev2009-10-14
|
* *) share temporary number between workersIgor Sysoev2009-08-21
| | | | *) randomize collision offset
* test EXDEV after path creationIgor Sysoev2009-08-20
|
* fix copy failure logging and stale files removal, introduced in r3025Igor Sysoev2009-08-20
|
* fix copy destination name length, introduced in r3025Igor Sysoev2009-08-20
|
* fix building on 64-bit platforms, introduced in r3025Igor Sysoev2009-08-13
|
* allow cross device temporary files atomic copying:Igor Sysoev2009-08-12
| | | | | *) ngx_copy_file() *) delete ngx_ext_rename_file_t.log_rename_error and .rename_error fields
* NGX_ENOPATHIgor Sysoev2009-08-11
|
* cache loader processIgor Sysoev2009-08-10
|
* Win32 returns ERROR_PATH_NOT_FOUND instead of ERROR_FILE_NOT_FOUNDIgor Sysoev2009-05-28
|
* uniform ngx_file_info() interface with ngx_fd_info()Igor Sysoev2009-04-29
|
* introduce cache manager instead of cache cleanerIgor Sysoev2009-03-30
|
* a prelimiary proxy cache supportIgor Sysoev2009-03-23
|
* small optimization: " == NGX_ERROR" > " != NGX_OK"Igor Sysoev2009-02-24
|
* use ngx_ext_rename_file() for single file MOVEIgor Sysoev2008-12-10
|
* *) back out r2040Igor Sysoev2008-06-17
| | | | | | *) refactor ngx_palloc() *) introduce ngx_pnalloc() *) additional pool blocks have smaller header