summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* On 'win32-pollset-wakeup-no-file-socket-emulation' branch: Merge changes fromwin32-pollset-wakeup-no-file-socket-emulationIvan Zhakov2022-02-0914-124/+581
|\ | | | | | | | | | | trunk. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897894 13f79535-47bb-0310-9956-ffa450edef68
| * apr_thread: Follow up to r1897207: apr_thread_current_create() compilation.Yann Ylavic2022-02-085-2/+7
| | | | | | | | | | | | | | | | | | Fix compilation of apr_thread_current_create() for OS/2 and Windows. Set *current to NULL on failure. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897879 13f79535-47bb-0310-9956-ffa450edef68
| * * test/testbuckets.c (flatten_match): Avoid GCC 12 -Wformat-overflowJoe Orton2022-02-011-4/+4
| | | | | | | | | | | | | | warnings with sprintf. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897646 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Follow up to r1897521: Clarify what APR_POLLEXCL means.Yann Ylavic2022-01-271-1/+1
| | | | | | | | | | | | | | | | | | This is to avoid the thundering herd issue when multiple threads/processes poll on the same descriptor (usually listening/to-be-accept()ed descriptors). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897549 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Follow up to r1897521: struct epoll_event's events field is unsigned int.Yann Ylavic2022-01-271-3/+3
| | | | | | | | | | | | | | | | | | EPOLLEXCLUSIVE is 1u << 28 so it doesn't fit in an int16_t, use unsigned for the native epoll events type. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897548 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Provide APR_POLLEXCL for exclusive wake up on systems that support it.Yann Ylavic2022-01-262-0/+5
| | | | | | | | | | | | | | | | epoll has EPOLLEXCLUSIVE, start with that. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897521 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Implement APR_POLLSET_NOCOPY for kqueue.Yann Ylavic2022-01-262-50/+79
| | | | | | | | | | | | | | | | | | Like with epoll, it allows to be lockless if the lifetime of the pollfd(s) is garanteed by the user. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897520 13f79535-47bb-0310-9956-ffa450edef68
| * Revert r1897518 (spurious changes).Yann Ylavic2022-01-263-234/+168
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897519 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Implement APR_POLLSET_NOCOPY for kqueue.Yann Ylavic2022-01-263-168/+234
| | | | | | | | | | | | | | | | | | Like with epoll, it allows to be lockless if the lifetime of the pollfd(s) is garanteed by the user. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897518 13f79535-47bb-0310-9956-ffa450edef68
| * apr_thread: Follow up to r1897207: Provide apr_thread_current_after_fork().Yann Ylavic2022-01-2510-1/+54
| | | | | | | | | | | | | | | | | | | | | | thread_local variables are not (always?) reset on fork(), so APR (and the user) needs a way to set the current_thread to NULL. Use apr_thread_current_after_fork() in apr_proc_fork()'s child process. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897470 13f79535-47bb-0310-9956-ffa450edef68
| * apr_thread: Follow up to r1897207: Make APR_HAS_THREAD_LOCAL a boolean..Yann Ylavic2022-01-256-24/+28
| | | | | | | | | | | | | | | | .. rather than a defined(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897447 13f79535-47bb-0310-9956-ffa450edef68
| * apr_thread: Follow up to r1897207: Don't NULLify current_thread on exit.Yann Ylavic2022-01-255-33/+5
| | | | | | | | | | | | | | | | It's not needed, when the thread exits it's not accessible anyway. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897445 13f79535-47bb-0310-9956-ffa450edef68
| * apr_thread: Follow up to r1897179: abort_fn on apr_allocator_create() failure.Yann Ylavic2022-01-245-10/+20
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897419 13f79535-47bb-0310-9956-ffa450edef68
| * apr_thread: Use compiler's TLS to track the current apr_thread_t's pointer.Yann Ylavic2022-01-196-56/+435
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All modern compilers provide a Thread Local Storage keyword that allows to store per-thread data efficiently (C++11 's thread_local, C11's _Thread_local, gcc/clang's __thread or MSVC's __declspec(thread)). Use that to have an apr_thread_t pointer associated with each thread created by apr_thread_create() or any native thread (like the process' initial thread) that registered itself with the new apr_thread_current_create() function. This mechanism allows to implement apr_thread_current() quite efficiently, if available, otherwise the function returns NULL. If available APR_HAS_THREAD_LOCAL is #define'd to 1 and the APR_THREAD_LOCAL macro is the keyword usable to register TLS variables natively. Both APR_HAS_THREAD_LOCAL and APR_THREAD_LOCAL are #undef'ined if the compiler does not provide the mechanism. This allows to test for the functionality at compile time. When APR_HAS_THREAD_LOCAL, the user can load his/her own TLS data with: apr_thread_data_get(&my_data, my_key, apr_thread_current()); and store them with: apr_thread_data_set(my_data, my_key, my_data_cleanup, apr_thread_current()); which can be nice to avoid the proliferation of native TLS keys. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897207 13f79535-47bb-0310-9956-ffa450edef68
* | On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-202-39/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove code in win32 apr_file_t implementation that emulates working with sockets as files. Sockets on Windows are not kernel objects and should be used only via Winsock API. * file_io/win32/readwrite.c (): Do not include apr_arch_networkio.h. (read_with_timeout): Remove APR_FILETYPE_SOCKET support code. * include/arch/win32/apr_arch_file_io.h (apr_filetype_e): Remove APR_FILETYPE_SOCKET enum value. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897254 13f79535-47bb-0310-9956-ffa450edef68
* | On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-206-189/+207
| | | | | | | | | | | | | | | | | | Windows: Use term `socket_pipe` instead for `file_socket_pipe` for internal poll wakeup socket API. Move implementation to network_io/win32/socket_pipe.c from file_io/win32/pipe.c. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897246 13f79535-47bb-0310-9956-ffa450edef68
* | On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-201-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Set socket nonblocking mode for socket using apr_socket_timeout_set(). Patch by: ylavic * file_io/win32/pipe.c (create_socket_pipe): Remove code to set SOCKET to nonblocking mode. (apr_file_socket_pipe_create): Set IN socket to nonblocking mode. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897245 13f79535-47bb-0310-9956-ffa450edef68
* | On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-198-84/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows: For the pollset wakeup, use apr_socket_t directly instead of using a socket disguised as an apr_file_t. * file_io/win32/pipe.c (): Include apr_arch_networkio.h. (socket_pipe_cleanup, apr_file_socket_pipe_create, apr_file_socket_pipe_close): Update to use apr_socket_t instead of apr_file_t. * include/arch/unix/apr_arch_poll_private.h (WAKEUP_USES_PIPE): New #define to specify mechanism used for pollset wakeup. (apr_pollset_t, apr_pollcb_t): Add wakeup_socket if not WAKEUP_USES_PIPE. (apr_poll_create_wakeup_socket, apr_poll_close_wakeup_socket, apr_poll_drain_wakeup_socket): Declare if not WAKEUP_USES_PIPE. * include/arch/win32/apr_arch_file_io.h (apr_file_socket_pipe_create, apr_file_socket_pipe_close): Update to use apr_socket_t instead of apr_file_t. * poll/unix/poll.c (impl_pollset_add): Remove hack that allows apr_file_t even if APR_FILES_AS_SOCKETS == 0. (impl_pollset_poll, impl_pollcb_poll): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/pollcb.c (pollcb_cleanup, apr_pollcb_create_ex, apr_pollcb_wakeup): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/pollset.c (pollset_cleanup, apr_pollset_create_ex, apr_pollset_wakeup): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/select.c (impl_pollset_add): Remove hack that allows apr_file_t even if APR_FILES_AS_SOCKETS == 0. (impl_pollset_poll): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/wakeup.c (apr_poll_create_wakeup_pipe): Rename to apr_poll_create_wakeup_socket() on Windows and use apr_socket_t instead of apr_file_t. (apr_poll_close_wakeup_pipe): Rename to apr_poll_close_wakeup_socket() on Windows and use apr_socket_t instead of apr_file_t. (apr_poll_drain_wakeup_socket): New. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897208 13f79535-47bb-0310-9956-ffa450edef68
* | New development branch to rework win32 poll wakeup implemention. The plan is:Ivan Zhakov2022-01-190-0/+0
|/ | | | | | | | | - Explicitly use apr_socket_t instead of apr_file_t for wakeup `pipe` - Remove code in win32 apr_file_t implementation that emulates working with sockets as files. Sockets on Windows are not kernel objects and should be used only via Winsock API. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897199 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: Follow up to r1897197: Safer apr_thread_join().Yann Ylavic2022-01-193-20/+15
| | | | | | | | | Make sure apr_thread_join() behaves correctly w.r.t. the returned value and pool destroy for all archs. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897198 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: Allocate the apr_thread_t struct on the thread's pool.Yann Ylavic2022-01-195-64/+71
| | | | | | | | | | | | | | | | apr_thread_create() was allocating the created apr_thread_t on the given pool, which caused e.g. short-living threads to leak memory on that pool without a way to clear it (while some threads are still running). Change this by allocating the apr_thread_t on the thread's pool itself, which is safe in the implementations of all archs because none uses the apr_thread_t after the thread exits, and it's safe for the users provided they don't use the apr_thread_t for detached threads or for attached threads after the call to apr_thread_join(). These are hardly new requirements though. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897197 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: Follow up to r1884078: Unmanaged pools for attached threads too.Yann Ylavic2022-01-186-265/+155
| | | | | | | | | | | | | | | | | | | | | | | | r1884078 fixed lifetime issues with detached threads by using unmanaged pool destroyed by the thread itself on exit, with no binding to the parent pool. This commit makes use of unmanaged pools for attached threads too, they needed their own allocator anyway due to apr_thread_detach() being callable anytime later. apr__pool_unmanage() was a hack to detach a subpool from its parent, but if a subpool needs its own allocator for this to work correctly there is no point in creating a subpool for threads (no memory reuse on destroy for short living threads for instance). Since an attached thread has its own lifetime now, apr_thread_join() must be called to free its resources/pool, though it's no different than before when destroying the parent pool was UB if the thread was still running (i.e. not joined yet). Let's acknoledge that threads want no binding with the pool passed to them at creation time, besides the abort_fn which they can steal :) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897179 13f79535-47bb-0310-9956-ffa450edef68
* apr_cstr: Follow up to r1897102: Yet better apr_cstr_casecmp[n]().Yann Ylavic2022-01-161-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | This ones have a shorter prologue and epilogue (-O2 still). Dump of assembler code for function apr_cstr_casecmp: 0x0000000000049fd0 <+0>: xor %edx,%edx 0x0000000000049fd2 <+2>: lea 0x3d567(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fd9 <+9>: nopl 0x0(%rax) 0x0000000000049fe0 <+16>: movzbl (%rsi,%rdx,1),%eax 0x0000000000049fe4 <+20>: movzbl (%r8,%rax,1),%ecx 0x0000000000049fe9 <+25>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fed <+29>: add $0x1,%rdx 0x0000000000049ff1 <+33>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff6 <+38>: sub %ecx,%eax 0x0000000000049ff8 <+40>: jne 0x49ffe <apr_cstr_casecmp+46> 0x0000000000049ffa <+42>: test %ecx,%ecx 0x0000000000049ffc <+44>: jne 0x49fe0 <apr_cstr_casecmp+16> 0x0000000000049ffe <+46>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897121 13f79535-47bb-0310-9956-ffa450edef68
* apr_cstr: Improve apr_cstr_casecmp() and apr_cstr_casecmpn() performances.Yann Ylavic2022-01-151-26/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new versions [1] compile to a shorter/faster assembly than the previous ones [2], no functionnal change. [1] apr_cstr_casecmp() after this commit: Dump of assembler code for function apr_cstr_casecmp: 0x0000000000049fc0 <+0>: movzbl (%rdi),%eax 0x0000000000049fc3 <+3>: movzbl (%rsi),%edx 0x0000000000049fc6 <+6>: lea 0x3d573(%rip),%r8 # 0x87540 <ucharmap> 0x0000000000049fcd <+13>: movzbl (%r8,%rax,1),%eax 0x0000000000049fd2 <+18>: movzbl (%r8,%rdx,1),%ecx 0x0000000000049fd7 <+23>: cmp %ecx,%eax 0x0000000000049fd9 <+25>: jne 0x49ffe <apr_cstr_casecmp+62> 0x0000000000049fdb <+27>: xor %edx,%edx 0x0000000000049fdd <+29>: jmp 0x49ffa <apr_cstr_casecmp+58> 0x0000000000049fdf <+31>: nop 0x0000000000049fe0 <+32>: add $0x1,%rdx 0x0000000000049fe4 <+36>: movzbl (%rdi,%rdx,1),%eax 0x0000000000049fe8 <+40>: movzbl (%rsi,%rdx,1),%ecx 0x0000000000049fec <+44>: movzbl (%r8,%rax,1),%eax 0x0000000000049ff1 <+49>: movzbl (%r8,%rcx,1),%ecx 0x0000000000049ff6 <+54>: cmp %ecx,%eax 0x0000000000049ff8 <+56>: jne 0x49ffe <apr_cstr_casecmp+62> 0x0000000000049ffa <+58>: test %eax,%eax 0x0000000000049ffc <+60>: jne 0x49fe0 <apr_cstr_casecmp+32> 0x0000000000049ffe <+62>: sub %ecx,%eax 0x000000000004a000 <+64>: ret End of assembler dump. [2] apr_cstr_casecmp() before this commit: Dump of assembler code for function apr_cstr_casecmp: 0x000000000004a000 <+0>: movzbl (%rdi),%eax 0x000000000004a003 <+3>: movzbl (%rsi),%edx 0x000000000004a006 <+6>: lea 0x3d533(%rip),%r8 # 0x87540 <ucharmap> 0x000000000004a00d <+13>: mov %rdi,%r9 0x000000000004a010 <+16>: mov %rax,%rcx 0x000000000004a013 <+19>: movswl (%r8,%rdx,2),%edx 0x000000000004a018 <+24>: movswl (%r8,%rax,2),%eax 0x000000000004a01d <+29>: sub %edx,%eax 0x000000000004a01f <+31>: jne 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a021 <+33>: mov $0x1,%edx 0x000000000004a026 <+38>: test %ecx,%ecx 0x000000000004a028 <+40>: je 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a02a <+42>: nopw 0x0(%rax,%rax,1) 0x000000000004a030 <+48>: movzbl (%r9,%rdx,1),%eax 0x000000000004a035 <+53>: movzbl (%rsi,%rdx,1),%ecx 0x000000000004a039 <+57>: add $0x1,%rdx 0x000000000004a03d <+61>: mov %rax,%rdi 0x000000000004a040 <+64>: movswl (%r8,%rcx,2),%ecx 0x000000000004a045 <+69>: movswl (%r8,%rax,2),%eax 0x000000000004a04a <+74>: sub %ecx,%eax 0x000000000004a04c <+76>: jne 0x4a052 <apr_cstr_casecmp+82> 0x000000000004a04e <+78>: test %edi,%edi 0x000000000004a050 <+80>: jne 0x4a030 <apr_cstr_casecmp+48> 0x000000000004a052 <+82>: ret End of assembler dump. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897102 13f79535-47bb-0310-9956-ffa450edef68
* Move misplaced comment.Yann Ylavic2022-01-131-2/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896992 13f79535-47bb-0310-9956-ffa450edef68
* Disable odbc tests with ASan for now, dlclose() leaks memory somehow.Yann Ylavic2022-01-131-1/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896990 13f79535-47bb-0310-9956-ffa450edef68
* Add Asan builds to travis.Yann Ylavic2022-01-121-4/+32
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896971 13f79535-47bb-0310-9956-ffa450edef68
* apr_sockaddr_ip_getbuf: Follow up to r1883728.Yann Ylavic2022-01-121-3/+4
| | | | | | | | Return APR_ENOSPC if returned buf is truncated for an AF_UNIX. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896956 13f79535-47bb-0310-9956-ffa450edef68
* Revert VPATH build breakage introduced in r1890191William A. Rowe Jr2022-01-121-2/+2
| | | | | | | | | | | Avoids the scenario; gcc tools/gen_test_char.c -o tools/gen_test_char gcc: error: tools/gen_test_char.c: No such file or directory gcc: fatal error: no input files Substitute the source tree path to this file rather that the target tree. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896933 13f79535-47bb-0310-9956-ffa450edef68
* apr_buckets_file: Always use the given pool for FILE buckets set aside.Yann Ylavic2022-01-071-4/+1
| | | | | | | | | | Using an ancestor pool might race if the bucket is reopened (XTHREAD) or mmap()ed later in file_bucket_read(), while there is nothing wrong with both the bucket and the file having the given/same lifetime. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896812 13f79535-47bb-0310-9956-ffa450edef68
* apr_atomic_set64: Follow up to r1868129.Yann Ylavic2022-01-071-0/+7
| | | | | | | | Like for apr_atomic_read64() in r1868502, use direct memory write on x86_x64. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896811 13f79535-47bb-0310-9956-ffa450edef68
* testcrypto: Fix warnings about unused functions (depending on the libs avail).Yann Ylavic2022-01-071-11/+55
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896805 13f79535-47bb-0310-9956-ffa450edef68
* testatomic: Fix gcc-11 warnings.Yann Ylavic2022-01-071-9/+9
| | | | | | | | | | Not sure why it wants the "a" local variable to point to something since we only use its pointer, but that's how it is.. While at it let's initialize "b" too. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896803 13f79535-47bb-0310-9956-ffa450edef68
* Since bionic is the default, switch one -Werror build to xenial.Joe Orton2022-01-071-2/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896782 13f79535-47bb-0310-9956-ffa450edef68
* apr_ring: Follow up to r1896535: Use APR_RING_{FIRST,LAST} macros.Yann Ylavic2022-01-061-6/+6
| | | | | | | | | hp->{next,prev} are APR_RING_{FIRST,LAST}(hp), so use them to make APR_RING_SPLICE_{HEAD,TAIL}() read better. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896747 13f79535-47bb-0310-9956-ffa450edef68
* Win32: Minor optimization of apr_stat() and apr_file_info_get().Ivan Zhakov2022-01-051-2/+4
| | | | | | | | | * file_io/win32/filestat.c (reparse_point_is_link, apr_stat): Use FindFirstFileExW(FindExInfoBasic) instead of FindFirstFileW(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896724 13f79535-47bb-0310-9956-ffa450edef68
* Add GCC 10 build to Travis config.Joe Orton2022-01-051-0/+10
| | | | | | | Github: closes #31 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896722 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/win32/filestat.cIvan Zhakov2022-01-051-2/+1
| | | | | | | | (reparse_point_is_link): Cast to more correct type. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896721 13f79535-47bb-0310-9956-ffa450edef68
* * file_io/win32/filestat.c:Ivan Zhakov2022-01-051-1/+0
| | | | | | | | (apr_stat): Remove unused union member. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896720 13f79535-47bb-0310-9956-ffa450edef68
* Remove Windows 95 compatibility code.Ivan Zhakov2022-01-053-78/+36
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896719 13f79535-47bb-0310-9956-ffa450edef68
* Fix a regression in apr_stat() for root path on Windows caused by the extendedIvan Zhakov2022-01-051-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | symlink detection added in r1855949 (PR47630) [1]. See [2] for the detailed problem report and discussion. The code before this patch performs FindFirstFile() whenever APR_FINFO_LINK is passed. This is problematic for at least two reasons: 1) Any attempt to detect if the root is a symlink now fails because FindFirstFile() cannot be called for the root directory 2) Any check that includes the APR_FINFO_LINK flag now calls FindFirstFile(), which essentially is a "readdir". Previously, ordinary files could have been processed with a much cheaper call to GetFileAttributesEx(). In other words, there is a significant performance penalty for stat(... | APR_FINFO_LINK) in a common case. Fix this by postponing a call to FindFirstFile() until we actually need the file tag information to resolve the reparse point. [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=47630 [2] https://lists.apache.org/thread/18x2jb81nf6zrjsnwf1k2wwooprkp0p5 * file_io/win32/filestat.c (apr_stat): Call FindFirstFile() only when asking for the true name with APR_FINFO_NAME. Adjust the related check. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896717 13f79535-47bb-0310-9956-ffa450edef68
* Follow-up to r1896625: Add typecast.Ivan Zhakov2022-01-021-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896626 13f79535-47bb-0310-9956-ffa450edef68
* Refactor code for further code improvements.Ivan Zhakov2022-01-021-1/+51
| | | | | | | | * file_io/win32/filestat.c (apr_file_info_get): Inline fillin_fileinfo() to apr_file_info_get(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896625 13f79535-47bb-0310-9956-ffa450edef68
* Optimize apr_file_mtime_set() on Windows.Ivan Zhakov2022-01-022-11/+4
| | | | | | | | | * file_io/win32/filestat.c (apr_file_mtime_set): Pass NULL as ATIME and CTIME when calling SetFileTime() to prevent changing ATIME and CTIME instead of retrieving these times using GetFileTime(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896623 13f79535-47bb-0310-9956-ffa450edef68
* apr_ring: Don't break strict-aliasing rules in APR_RING_SPLICE_{HEAD,TAIL}().Yann Ylavic2021-12-301-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC-11 complains (see [1]) about apr_brigade_split_ex() seemingly issuing an out of bounds access, the cause being that APR_RING_SPLICE_{HEAD,TAIL}() is dereferencing an APR_RING_SENTINEL() and the cast there in not very aliasing friendly (see [2] for a great explanation by Martin Sebor). The APR (and user code) should never dereference APR_RING_SENTINEL(), it's fine as a pointer only (i.e. for comparing pointers). So this commit modifies the APR_RING_SPLICE_{HEAD,TAIL}() and APR_RING_{CONCAT,PREPEND}() macros to use the passed in APR_RING_HEAD's prev/next pointers directly instead of passing the APR_RING_SENTINEL() to APR_RING_SPLICE_{BEFORE,AFTER}(). Semantically, this also clarifies that APR_RING_{SPLICE,INSERT}_{BEFORE,AFTER}() should be called for an APR_RING_ENTRY while APR_RING_SPLICE_{HEAD,TAIL}() and APR_RING_{CONCAT,PREPEND}() are to be called with an APR_RING_HEAD. [1] In file included from ./include/apr_mmap.h:28, from ./include/apr_buckets.h:32, from buckets/apr_brigade.c:22: buckets/apr_brigade.c: In function ‘apr_brigade_split’: ./include/apr_ring.h:177:43: error: array subscript ‘struct apr_bucket[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds] 177 | #define APR_RING_NEXT(ep, link) (ep)->link.next | ~~~~~~~~~~^~~~~ ./include/apr_ring.h:247:38: note: in expansion of macro ‘APR_RING_NEXT’ 247 | APR_RING_NEXT((epN), link) = APR_RING_NEXT((lep), link); \ | ^~~~~~~~~~~~~ ./include/apr_ring.h:287:9: note: in expansion of macro ‘APR_RING_SPLICE_AFTER’ 287 | APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((hp), elem, link), \ | ^~~~~~~~~~~~~~~~~~~~~ buckets/apr_brigade.c:118:9: note: in expansion of macro ‘APR_RING_SPLICE_HEAD’ 118 | APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link); | ^~~~~~~~~~~~~~~~~~~~ buckets/apr_brigade.c:90:9: note: referencing an object of size 32 allocated by ‘apr_palloc’ 90 | b = apr_palloc(p, sizeof(*b)); | ^~~~~~~~~~~~~~~~~~~~~~~~~ [2] https://bugzilla.redhat.com/show_bug.cgi?id=1957353#c2 (Note that the original comment from Martin Sebor talks about the struct "_direntry" and the global variable "anchor" which relate to some httpd code using an APR_RING in a similar way than apr_bucket_brigade does. So below I allowed myself to edit the original comment to replace "_direntry" by "apr_bucket" and "anchor" by "list" (the apr_bucket_brigade's member used as the head of the ring) to make the link with the above commit message) " The message is a bit cryptic but it says that the code accesses an object (list) of some anonymous type as it was struct apr_bucket. That's invalid because objects can only be accessed by lvalues of compatible types (or char). The APR_RING_ENTRY macro is defined like so: #define APR_RING_ENTRY(elem) \ struct { \ struct elem * volatile next; \ struct elem * volatile prev; \ } so given the definition: APR_RING_ENTRY(apr_bucket) list; list can only be accessed by lvalues of its (anonymous) type but the APR_RING_SENTINEL() macro defined like so: #define APR_RING_SENTINEL(hp, elem, link) \ (struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link)) casts the address of list's next member minus some constant to a pointer to struct apr_bucket and that pointer is then used to access the prev pointer. The anonymous struct and struct apr_bucket are unrelated and cannot be used each other's members even if the corresponding members have the same type and are at the same offset within the bounds of the object. " git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896535 13f79535-47bb-0310-9956-ffa450edef68
* Cleanup README.cmake 'experimental' claims. It works and builds perfectlyMladen Turk2021-12-071-43/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895658 13f79535-47bb-0310-9956-ffa450edef68
* Add minimal vcpkg ports/apr-2Mladen Turk2021-12-032-0/+64
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895543 13f79535-47bb-0310-9956-ffa450edef68
* Do not install import libraries for DSO modulesMladen Turk2021-12-031-3/+8
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895541 13f79535-47bb-0310-9956-ffa450edef68
* Get rid of useless APU_DSO_MODULE_BUILD for CMakeMladen Turk2021-12-031-3/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895530 13f79535-47bb-0310-9956-ffa450edef68
* Ensure that APR_HAVE_MODULAR_DSO is defined with valueMladen Turk2021-12-031-4/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895529 13f79535-47bb-0310-9956-ffa450edef68