aboutsummaryrefslogtreecommitdiff
path: root/file_io/unix
Commit message (Collapse)AuthorAge
* Revert r1918258.Joe Orton2024-06-13
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1918296 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/unix/pipe.c (file_pipe_create): Use pipe2(,O_NONBLOCK) byJoe Orton2024-06-11
| | | | | | | | | | | default unless APR_FULL_BLOCK was used; unconditionally set the blocking state later. Saves two syscalls per invocation for both APR_READ_BLOCK and APR_WRITE_BLOCK, no [intended] functional change. Github: closes #56 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1918258 13f79535-47bb-0310-9956-ffa450edef68
* Add support for pipe2() on Linux.Joe Orton2024-05-10
| | | | | | | | | | | | | | * configure.in: Test for working pipe2(). * file_io/unix/pipe.c (file_pipe_create): Use pipe2(,O_NONBLOCK) if APR_FULL_NONBLOCK is requested. * test/testpipe.c (nonblock_pipe): New test. Github: closes #55 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1917641 13f79535-47bb-0310-9956-ffa450edef68
* Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-20
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1893204: restore apr_file_setaside() semantics, fix ↵Yann Ylavic2021-09-19
| | | | | | | | | | | | | | | file_bucket_setaside(). apr_file_setasidea() needs to invalidate the old file descriptor per semantics: * @remark After calling this function, old_file may not be used So to avoid the setaside issue with splitted file buckets, file_bucket_setaside() will now apr_file_dup() instead of apr_file_setaside() when the bucket is shared (i.e. refcount > 1). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893445 13f79535-47bb-0310-9956-ffa450edef68
* apr_file_setaside: don't blindly kill the old cleanup and file descriptor.Yann Ylavic2021-09-10
| | | | | | | | | | | There is no cleanup with APR_FOPEN_NOCLEANUP, so apr_pool_cleanup_kill() can go in the !(old_file->flags & APR_FOPEN_NOCLEANUP) block. The file descriptor can't be invalidated either, the file may be split in multiple buckets and setting aside one shouldn't invalidate the others. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893204 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1790200: fall back to fsync() if F_FULLFSYNC is not supportedBranko Čibej2020-11-12
| | | | | | | | | by the file descriptor, filesystem or underlying device. See, e.g.: https://github.com/vim/vim/pull/4025 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1883340 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/unix/readwrite.c (apr_file_write, apr_file_writev): FixJoe Orton2020-06-01
| | | | | | | | Coverity warnings from ignored lseek() return value in ->buffered handling. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878343 13f79535-47bb-0310-9956-ffa450edef68
* apr_file_mktemp: clear APR_FOPEN_NOCLEANUP if not requested.Yann Ylavic2020-05-29
| | | | | | | | | | | | | | | apr_os_file_put() adds no cleanup so it forces APR_FOPEN_NOCLEANUP, but when apr_file_mktemp() adds the cleanup implicitely (unless the user specifies APR_FOPEN_NOCLEANUP explicitely), it needs to clear APR_FOPEN_NOCLEANUP for the resulting file. Note: Without this fix, a file created with apr_file_mktemp() and later passed to apr_file_setaside(), or within a file bucket passed to apr_bucket_setaside(), will leak both the fd and inode because the cleanup gets dropped (e.g. httpd's BZ 64452). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1878279 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1862435, r1862071 per veto from ivanJoe Orton2019-08-28
| | | | | | | msgid: <CABw-3YcK0qbeYWDOwE684XtBj3rCT2CuVOBWWqda4gMtRyRJEw@mail.gmail.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866019 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_dir_pread(), a variant of apr_dir_read() which allows callersJoe Orton2019-06-25
| | | | | | | | | | | | | | | | | to read a directory with constant memory consumption: * include/apr_file_info.h: Add warning on memory consumption for apr_dir_read; declare apr_dir_pread. * file_io/unix/dir.c (apr_dir_pread): Rename from apr_dir_read and take pool argument. (apr_dir_read): Reimplement using it. * file_io/win32/dir.c, file_io/os2/dir.c: Likewise, but untested. * test/testdir.c (test_pread) [APR_POOL_DEBUG]: Add test case. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1862071 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/unix/filedup.c (file_dup): Add assert() for possible values Joe Orton2019-06-25
| | | | | | | of which_dup to help static analysers. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1862068 13f79535-47bb-0310-9956-ffa450edef68
* Fix typoChristophe Jaillet2019-06-13
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1861263 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1789258, r1856189, r1856191 following discussion on list, in favorWilliam A. Rowe Jr2019-04-01
| | | | | | | | | | | | | | | of a simpler path of avoiding dirread_r always, by default. This saves us various additional detection logic, and follows advice of library maintainers and our library's behavior, any apparent "thread safety" offered by the _r() flavors of this function were not truly supported by APR's allocation or dirread_r reentrancy of parallel threads attemping to access the same open directory descriptor. Retains r1856192, r1856196 to avoid wasteful allocation in the dirread() case. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1856755 13f79535-47bb-0310-9956-ffa450edef68
* apr_dir: no need to allocate our dir entry if readdir{,64}_r() is not used.Yann Ylavic2019-03-25
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1856196 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1856189: use NAME_MAX from limits.h when available.Yann Ylavic2019-03-25
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1856192 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1789258: configure to detect whether readdir() is thread-safe.Yann Ylavic2019-03-25
| | | | | | | | | | | | | On platforms where readdir_r() is available but deprecated, readdir() is to be used although it's not in libc_r (e.g. Linux has no libc_r). In this case we can APR_TRY_COMPILE_NO_WARNING readdir_r() and, if it's deprecated, define READDIR_IS_THREAD_SAFE. With this we don't need user-defined APR_USE_READDIR{,64}_R from r1789258. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1856189 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/unix/filepath.c (apr_filepath_merge): Fix Coverity warning;Joe Orton2019-03-22
| | | | | | | don't copy bogus pointer after apr_filepath_get() error return. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1856030 13f79535-47bb-0310-9956-ffa450edef68
* pipe: factorize apr_file_pipe_create*() in terms of static helperYann Ylavic2017-09-26
| | | | | | | | file_pipe_create(), to avoid duplicated code. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1809757 13f79535-47bb-0310-9956-ffa450edef68
* Set perms correctly on file copy where destination existsNick Kew2017-04-11
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1791029 13f79535-47bb-0310-9956-ffa450edef68
* Do not try to use fdatasync() on macOS.Branko Čibej2017-04-05
| | | | | | | | | Use the platform-specific fcntl(fd, F_FULLFSYNC) instead. See http://apr.markmail.org/thread/hlgqd5yr6j4auxol git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1790200 13f79535-47bb-0310-9956-ffa450edef68
* apr_dir_read: Since readdir() is now thread safe on most (if not all) unixesYann Ylavic2017-03-29
| | | | | | | | | and readdir_r() is defective and deprecated, use the former by default unless APR_USE_READDIR_R is defined (no use case currently hence not autoconfigured). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1789258 13f79535-47bb-0310-9956-ffa450edef68
* Fix two issues with apr_file_trunc() for buffered files:Ivan Zhakov2017-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The Win32 implementation incorrectly flushes the buffered writes _after_ truncating a file. Such files will have unexpected data written after the position at which they should've been truncated. PR 51017. (Under Unix, this issue has been fixed in r1044440) - Both Win32 and Unix implementations incorrectly keep the data read into a buffer after the file is truncated. Thus, reading from a file after apr_file_trunc() can return invalid data from the previous file offset. * file_io/win32/seek.c (apr_file_trunc): Flush the write buffer or discard the read buffer before truncating. Propely update the internal file offset (filePtr) and the eof_hit marker. * file_io/unix/seek.c (apr_file_trunc): Discard the read buffer before truncating. * test/testfile.c (test_file_trunc): Extend the checks. Factor out part of this test... (test_file_trunc_buffered_write): ...into this new test. (test_file_trunc_buffered_write2, test_file_trunc_buffered_read): New tests. (testfile): Run the new tests. Patch by: Evgeny Kotkov <evgeny.kotkov {at} visualsvn.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1788929 13f79535-47bb-0310-9956-ffa450edef68
* apr_file_io: Add apr_file_pipe_create_pools() allowing a pair ofGraham Leggett2016-03-13
| | | | | | | pipes to be created, each in a different pool. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1734816 13f79535-47bb-0310-9956-ffa450edef68
* Fix comments for fcntl lockStefan Fritsch2015-08-20
| | | | | | | | | | | apr_file_lock() should lock the whole file. The code uses SEEK_SET which means 'start of file' and is correct, but the comments describe the SEEK_CUR behavior. Fix comments. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1696767 13f79535-47bb-0310-9956-ffa450edef68
* * configure.in: Detect mkostemp, mkostemp64.Joe Orton2015-06-04
| | | | | | | | | * file_io/unix/mktemp.c (apr_file_mktemp): Use glibc mkostemp or mkostemp64 where available to set FD_CLOEXEC without the extra system calls. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1683520 13f79535-47bb-0310-9956-ffa450edef68
* Correct nonsense test for non-exported sys/stat.h autoconf flagWilliam A. Rowe Jr2014-02-12
| | | | | | | Introduce non-exported sys/attr.h autoconf flag for OS/X git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1567722 13f79535-47bb-0310-9956-ffa450edef68
* stop using deprecated versions of APR_FOPEN_* and APR_FPROT_*Jeff Trawick2014-01-18
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1559343 13f79535-47bb-0310-9956-ffa450edef68
* APR_FOPEN_NONBLOCK is expected to be critical for an appJeff Trawick2013-11-02
| | | | | | | | that uses it; return APR_ENOTIMPL instead of ignoring it if not supported. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1538171 13f79535-47bb-0310-9956-ffa450edef68
* clang scan-build noted that we sometimes assigned garbageJeff Trawick2013-10-23
| | | | | | | | to the mutex field, since the conditions under which we got the mutex vs. accessed it were different; simplify git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1534873 13f79535-47bb-0310-9956-ffa450edef68
* Avoid fcntl() calls if support for O_CLOEXEC works.Stefan Fritsch2011-10-15
| | | | | | | | PR: 48557 Submitted by: Mike Frysinger <vapier gentoo org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1183698 13f79535-47bb-0310-9956-ffa450edef68
* Fix race condition that could lead to EEXIST being returnedStefan Fritsch2011-10-15
| | | | | | | | | PR: 51254 Submitted by: William Lee <william lee rainstor com>, Wim Lewis <wiml omnigroup com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1183688 13f79535-47bb-0310-9956-ffa450edef68
* * Update the correct structure element in the case thatRuediger Pluem2011-05-04
| | | | | | | | | HAVE_STRUCT_STAT_ST_MTIME_N / HAVE_STRUCT_STAT_ST_ATIME_N is defined. PR: 51146 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1099348 13f79535-47bb-0310-9956-ffa450edef68
* change apr_palloc+memcpy to apr_pmemdupJeff Trawick2011-04-06
| | | | | | | | PR: 47776 Submitted by: Boya Sun <boya.sun case.edu> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1089438 13f79535-47bb-0310-9956-ffa450edef68
* fix undeclared variable issue with --disable-threadsJeff Trawick2011-03-30
| | | | | | | Submitted by: Carlo Bramini <carlo.bramix libero.it> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1087027 13f79535-47bb-0310-9956-ffa450edef68
* fix a bit of 'if FOO'/'ifdef FOO' confusionJeff Trawick2011-03-29
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1086695 13f79535-47bb-0310-9956-ffa450edef68
* apr_file_flush_locked(): Handle short writesStefan Fritsch2011-02-21
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1073142 13f79535-47bb-0310-9956-ffa450edef68
* Ooops. Don't leave file lockedMladen Turk2010-12-10
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1044447 13f79535-47bb-0310-9956-ffa450edef68
* Fix file_trunc for buffered files. Make sure the write buffer is flushed ↵Mladen Turk2010-12-10
| | | | | | before truncate call git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1044440 13f79535-47bb-0310-9956-ffa450edef68
* Fix various issues found by cppcheckStefan Fritsch2010-07-27
| | | | | | | | | | | | - error handling issues - use of uninitialized data - null pointer dereference - unused variables - memory/fd leaks - broken code in threadproc/beos/proc.c git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@979891 13f79535-47bb-0310-9956-ffa450edef68
* Hide apr_wait_for_io_or_timeout() from public view and add insteadBrian Havard2010-04-12
| | | | | | | apr_socket_wait() and apr_file_pipe_wait(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@933338 13f79535-47bb-0310-9956-ffa450edef68
* include malloc() prototypeJeff Trawick2010-04-07
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@931553 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Share the unix implementation of apr_file_printf() which passes theBrian Havard2010-04-04
| | | | | | | >HUGE_STRING_LEN test in testfile. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@930676 13f79535-47bb-0310-9956-ffa450edef68
* Enable platform specific support for the opening of a file orGraham Leggett2010-03-02
| | | | | | | pipe in non blocking module through the APR_FOPEN_NONBLOCK flag. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@917819 13f79535-47bb-0310-9956-ffa450edef68
* Use the APR_FOPEN_* constants instead of the deprecated APR_* constantsGraham Leggett2010-03-01
| | | | | | | within the file_io code. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@917675 13f79535-47bb-0310-9956-ffa450edef68
* * Reverse order of manual and check to conform to naming styleRuediger Pluem2010-02-04
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@906390 13f79535-47bb-0310-9956-ffa450edef68
* Add two new features to APR Files:Paul Querna2010-02-03
| | | | | | | | | | | | | | | | - When opened with normal rotating flag, every 60 seconds the file will check if the file it is writing to has changed inode (ie, been replaced/moved). - When opened with the manual rotating flag, the consumer must call the check, but can provider the current timestamp, to avoid a apr_time call. This is based off of the patch from Brian, but I've modified it for style, and adding the manual rotation flag after discussion with brian at the httpd hackathon. Submitted by: Brian J. France <brian brianfrance.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@905970 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/unix/open.c (apr_file_open): Don't set FD_CLOEXEC if it wasJoe Orton2010-01-31
| | | | | | | | | already set via O_CLOEXEC. PR: 46297 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@905040 13f79535-47bb-0310-9956-ffa450edef68
* Catch filepath_util.c flaws, unix build works againWilliam A. Rowe Jr2009-12-18
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@892134 13f79535-47bb-0310-9956-ffa450edef68
* Nothing interesting existed in apr_common_private.h, this wouldWilliam A. Rowe Jr2009-12-18
| | | | | | | | | | | | | | | | have just as well been an include/arch/unix/apr_arch_common.h but is entirely unnecessary. The right solution is dozens of lines less code and confusion, simply drive apr_filepath_list_split|merge from filepath_util.c brought in from the unix/ directory, across all platforms. One 'temporary' cast was in use by apr_pools.c, the other was entirely unused. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@892127 13f79535-47bb-0310-9956-ffa450edef68