summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* On 'thread-name' branch: Merge changes from trunk.thread-nameIvan Zhakov2022-06-298-111/+134
|\ | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902353 13f79535-47bb-0310-9956-ffa450edef68
| * apr_strings: Provide apr_memzero_explicit() in APR.Yann Ylavic2022-06-285-42/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is handy outside apu_crypto usage, don't require users to link to APU for the feature. This commit moves the apr_crypto_memzero() implementation to apr_strings under the apr_memzero_explicit() name, and replaces the calls to the former with the latter, and apr_crypto_memzero() now calls apr_memzero_explicit() directly. * include/apr_strings.h(): Declare apr_memzero_explicit(). * strings/apr_strings.c(): Implement apr_memzero_explicit() by moving/renaming the code from apu_crypto. * crypto/apr_crypto.c(apr_crypto_memzero): Fall back to apr_memzero_explicit(). * crypto/apr_crypto.c(crypto_clear): Use apr_memzero_explicit() instead of apr_crypto_memzero(). * crypto/apr_crypto_prng.c(cprng_cleanup, cprng_stream_bytes, apr_crypto_prng_reseed, cprng_bytes, apr_crypto_prng_rekey, apr_crypto_prng_after_fork): Use apr_memzero_explicit() instead of apr_crypto_memzero(). * crypto/apr_md4.c(MD4Transform): Use apr_memzero_explicit() instead of apr_crypto_memzero(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902323 13f79535-47bb-0310-9956-ffa450edef68
| * more whitespaceEric Covener2022-06-281-28/+28
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902321 13f79535-47bb-0310-9956-ffa450edef68
| * whitespace onlyEric Covener2022-06-281-16/+16
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902320 13f79535-47bb-0310-9956-ffa450edef68
| * detabEric Covener2022-06-281-50/+50
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902319 13f79535-47bb-0310-9956-ffa450edef68
| * apr_socket_sendv: unix: APR_INCOMPLETE_WRITE pre to post processing.Yann Ylavic2022-06-281-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | Rather than precomputing requested_len before writev() and later comparing with what has been sent, we can walk the iovec after only to see if it's exhausted. This saves useless precomputation on error (e.g. nonblocking EAGAIN) and avoids a poteential invalid/overflowed requested_len should the iovec point to more than SIZE_MAX bytes. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902314 13f79535-47bb-0310-9956-ffa450edef68
| * apr_socket_sendv: WIN32: Limit the number of WSABUFs allocated for a single ↵Yann Ylavic2022-06-281-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | call. * network_io/win32/sendrecv.c(): Define WSABUF_ON_HEAP to 500. * network_io/win32/sendrecv.c(apr_socket_sendv): Do not sendv more than WSABUF_ON_HEAP WSABUFs. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902312 13f79535-47bb-0310-9956-ffa450edef68
* | On 'thread-name' branch: Check pthread_setname_np()/pthread_getname_np()Ivan Zhakov2022-06-291-0/+8
| | | | | | | | | | | | | | | | | | | | support. * threadproc/unix/thread.c (apr_thread_name_set, apr_thread_name_get): Return APR_ENOTIMPL if not HAVE_PTHREAD_SETNAME_NP. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902352 13f79535-47bb-0310-9956-ffa450edef68
* | crude check for pthread_setname_npEric Covener2022-06-282-0/+25
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902326 13f79535-47bb-0310-9956-ffa450edef68
* | On 'thread-name' branch: Add apr_thread_name_get() and apr_thread_name_set()Ivan Zhakov2022-06-278-0/+223
| | | | | | | | | | | | API to get/set thread name. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902297 13f79535-47bb-0310-9956-ffa450edef68
* | Branch to added API to get/set thread name. See issue PR 60587.Ivan Zhakov2022-06-270-0/+0
|/ | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902296 13f79535-47bb-0310-9956-ffa450edef68
* Run GitHub Action CI for commits to all branches.Ivan Zhakov2022-06-273-3/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902295 13f79535-47bb-0310-9956-ffa450edef68
* .editorconfig: Use indent_size = 2 for CMakeLists.txt.Ivan Zhakov2022-06-271-0/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902294 13f79535-47bb-0310-9956-ffa450edef68
* .editorconfig: Use spaces for all files.Ivan Zhakov2022-06-271-0/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902293 13f79535-47bb-0310-9956-ffa450edef68
* Add empty .editorconfig.Ivan Zhakov2022-06-271-0/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902292 13f79535-47bb-0310-9956-ffa450edef68
* testencode: Follow up to r1902281: Inline, no calling convention assumptions.Yann Ylavic2022-06-271-54/+64
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902286 13f79535-47bb-0310-9956-ffa450edef68
* testencode: Follow up to r1902281: Correct call convention for encdec_fn ↵Yann Ylavic2022-06-271-1/+5
| | | | | | (try 2). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902285 13f79535-47bb-0310-9956-ffa450edef68
* testencode: Follow up to r1902281: Correct call convention for encdec_fn.Yann Ylavic2022-06-271-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902284 13f79535-47bb-0310-9956-ffa450edef68
* tests: Configure VC runtime to write errors to stderr instead of displayingIvan Zhakov2022-06-271-0/+17
| | | | | | popup message box on Windows. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902283 13f79535-47bb-0310-9956-ffa450edef68
* testencode: Follow up to r1902281: error tests for apr_decode_base16_binary.Yann Ylavic2022-06-271-2/+28
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902282 13f79535-47bb-0310-9956-ffa450edef68
* encoding: Better check inputs of apr_{encode,decode}_* functions.Yann Ylavic2022-06-275-806/+1184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check that the given sources can be encoded without overflowing. Return APR_EINVAL if the given "slen" is negative, APR_NOTFOUND if "dest" is not NULL and "src" is NULL, or APR_ENOSPC if "dest" is NULL and the source length (based on "slen" or APR_ENCODE_STRING) is too big to encode. * include/private/apr_encode_private.h(): Rename ENCODE_TO_ASCII() and ENCODE_TO_NATIVE() to respectively TO_ASCII() and TO_ENCODE(), and make them return an unsigned char. * encoding/apr_escape.c(): Use the new TO_ASCII() and TO_NATIVE(). * encoding/apr_encode.c(apr_encode_*, apr_decode_*): Forbid negative "slen" but APR_ENCODE_STRING, and use apr_size_t arithmetics to check for overflows when encoding. When "dest" is NULL, "src" can be NULL too. Better check for trailing '='s or base16's APR_ENCODE_COLON ':' separators. Rename ENCODE_TO_ASCII and ENCODE_TO_NATIVE to their new names, and remove casts to (unsigned char) now unnecessary. * include/apr_encode.h(): Update dox about acceptable inputs and returned errors. * test/testencode.c(): Tests for error conditions. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902281 13f79535-47bb-0310-9956-ffa450edef68
* win32: Fix potential race condition in apr_thread_create.Ivan Zhakov2022-06-272-1/+5
| | | | | | | | | | | * CHANGES: Add changelog entry. * threadproc/win32/thread.c (apr_thread_create): Create suspended thread, initialize apr_thread_t->td and only after that resume thread. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902277 13f79535-47bb-0310-9956-ffa450edef68
* test/testshm: Fix synchronization of msgput/msgwait IPC functions.Yann Ylavic2022-06-264-62/+65
| | | | | | | | | | | | | | | | * test/testshm.h(): Move (APR_INLINE) common msgput/msgwait() functions there. * test/testshm.h(msgput, msgwait): Use atomics (cas) to prevent producer and consumer from writing to the same box. * testshm.c, testshmconsumer.c, testshmproducer.c: Use common helpers. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902267 13f79535-47bb-0310-9956-ffa450edef68
* atomic: Detect 32bit and 64bit atomic builtins separately.Yann Ylavic2022-06-263-9/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some 32bit platforms provide 32bit but not 64bit atomics, detect and distinctly set/use HAVE_ATOMIC_BUILTINS/HAVE_ATOMIC_BUILTINS64 and USE_ATOMICS_BUILTINS/USE_ATOMICS_BUILTINS64. These platforms NEED_ATOMICS_GENERIC64 as 64bit implementation. * configure.in(): Use stdint.h's uint{32,64}_t as atomic type for testing atomic builtins when available, otherwise "unsigned int" for 32bit testing and "unsigned long long" as 64bit. * configure.in(): AC_TRY_RUN each 32bit and 64bit type separately, the former determining HAVE_ATOMIC_BUILTINS and the latter HAVE_ATOMIC_BUILTINS64. * include/arch/unix/apr_arch_atomic.h(): Define USE_ATOMICS_BUILTINS64 when HAVE_ATOMIC_BUILTINS64, otherise define NEED_ATOMICS_GENERIC64 * include/arch/unix/apr_arch_atomic.h(): Check defined(__powerpc__) for USE_ATOMICS_PPC. * atomic/unix/builtins64.c(): Implement for USE_ATOMICS_BUILTINS64 only. BZ 63566. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902266 13f79535-47bb-0310-9956-ffa450edef68
* time: Don't apr_sleep() less than the requested time on OS2/Netware.Yann Ylavic2022-06-261-2/+2
| | | | | | | | Round to upper milliseconds when converting from microseconds. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902263 13f79535-47bb-0310-9956-ffa450edef68
* atomic: Follow up r1902257: No cast for InterlockedCompareExchangePointer().Yann Ylavic2022-06-261-9/+5
| | | | | | | | | Both 32 and 64 bit InterlockedCompareExchangePointer() seem to have the same API, so be it.. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902259 13f79535-47bb-0310-9956-ffa450edef68
* poll: Follow up to r1902236: Fix poll() sleeps cases.Yann Ylavic2022-06-263-10/+18
| | | | | | | | | | Don't convert timeout to milliseconds before potentially callig apr_sleep(). Tests for "poll() didn't sleep" now use the real timeout as lower limit. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902258 13f79535-47bb-0310-9956-ffa450edef68
* atomic: Avoid casts and/or use correct ones.Yann Ylavic2022-06-263-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | * atomic/os390/atomic.c(apr_atomic_xchgptr): Dereferencing without casting is fine/better. * atomic/unix/mutex.c(apr_atomic_casptr, apr_atomic_xchgptr): Dereferencing without casting is fine/better. * atomic/win32/apr_atomic.c(apr_atomic_add32, apr_atomic_sub32, apr_atomic_inc32, apr_atomic_dev32, apr_atomic_set32, apr_atomic_cas32, apr_atomic_xchg32): Native Interlocked 32bit functions expect "long volatile *", don't cast out volatility. * atomic/win32/apr_atomic.c(apr_atomic_casptr): 32bit InterlockedCompareExchangePointer() expects "long volatile *", don't cast to (void **). * atomic/win32/apr_atomic.c(apr_atomic_xchgptr): InterlockedExchangePointer() for both 32bit and 64bit expects "void *volatile *", no need to cast. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902257 13f79535-47bb-0310-9956-ffa450edef68
* poll: Round up milliseconds timeouts.Yann Ylavic2022-06-246-19/+19
| | | | | | | | | When converting appr_interval_time_t (usecs) to system call's msecs, round up. apr_*poll() calls should wait *at least* the given timeout, not less. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902236 13f79535-47bb-0310-9956-ffa450edef68
* atomic: Fix -Wincompatible-pointer-types-discards-qualifiersYann Ylavic2022-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | atomic/unix/builtins.c:117:38: warning: passing 'void **' to parameter of type 'volatile void **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers] __atomic_compare_exchange_n(mem, (void **)&cmp, ptr, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); ^~~~~~~~~~~~~ This warning is weird, because 'volatile void **' is not a thing usually, it happens on macos in apr-1.x, where apr_atomic_casptr() is (ill-)defined as: APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *ptr, const void *cmp); but not on trunk's: APR_DECLARE(void*) apr_atomic_casptr(void *volatile *mem, void *ptr, const void *cmp); The mark clearly indicates that (void **)&cmp is the culprit though (compiler bug?). Let's see if using the generic (void *) cast helps, the goal of the (void **) cast was to remove constantness only (__atomic_compare_exchange_n will modify the pointer on stack, but not the pointed to value), (void *) will do that too without any volatile qualifier issue possibly. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902233 13f79535-47bb-0310-9956-ffa450edef68
* ci: Set native eol-style on github yamls.Yann Ylavic2022-06-242-101/+101
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902226 13f79535-47bb-0310-9956-ffa450edef68
* apr_json_decode: Return APR_ENOSPC if a decoded array is above INT_MAX.Yann Ylavic2022-06-231-1/+4
| | | | | | | | | * json/apr_json_decode.c(apr_json_decode_array): Return APR_ENOSPC should the int counter overflow. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902207 13f79535-47bb-0310-9956-ffa450edef68
* apr_base64: Make sure encoding/decoding lengths fit in an int >= 0.Yann Ylavic2022-06-231-18/+28
| | | | | | | | | | | | | | | | | | | | | | The (old) API of apr_base64 functions has always used int for representing lengths and it does not return errors. Make sure to abort() if the provided data don't fit. * encoding/apr_base64.c(): #define APR_BASE64_ENCODE_MAX and APR_BASE64_DECODE_MAX as the hard length limits for encoding and decoding respectively. * encoding/apr_base64.c(apr_base64_encode_len, apr_base64_encode, apr_base64_encode_binary, apr_pbase64_encode): abort() if the given length is above APR_BASE64_ENCODE_MAX. * encoding/apr_base64.c(apr_base64_decode_len, apr_base64_decode, apr_base64_decode_binary, apr_pbase64_decode): abort() if the given plain buffer length is above APR_BASE64_DECODE_MAX. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902206 13f79535-47bb-0310-9956-ffa450edef68
* tests: Fix numeric types warnings.Yann Ylavic2022-06-235-9/+12
| | | | | | | | By using the right numeric comparison assertions and some explicit casts. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902205 13f79535-47bb-0310-9956-ffa450edef68
* testatomic: Follow up to r1902199: More numeric types assertions.Yann Ylavic2022-06-231-2/+2
| | | | | | | | | | | | * test/testatomic.c(busyloop_dec32): Use ABTS_UINT_EQUAL(). * test/testatomic.c(busyloop_dec64): Use ABTS_ULLONG_EQUAL(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902204 13f79535-47bb-0310-9956-ffa450edef68
* testatomic: Use new numeric types assertions from r1902191 to avoid warnings.Yann Ylavic2022-06-231-46/+46
| | | | | | | | | | * test/testatomic.c(): Use ABTS_UINT_EQUAL() to compare apr_uint32_t atomics, and ABTS_ULLONG_EQUAL() for apr_uint64_t ones. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902199 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: Fix pointer to int conversion warning.Yann Ylavic2022-06-231-1/+1
| | | | | | | | | * threadproc/win32/thread.c(dummy_worker): First cast to apr_uinptr_t before conversion pointer to int. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902198 13f79535-47bb-0310-9956-ffa450edef68
* proc: Fix different 'const' qualifiers warning.Yann Ylavic2022-06-231-3/+3
| | | | | | | | | * threadproc/win32/proc.c(apr_proc_create): Don't assign const strings to "cmdline". git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902197 13f79535-47bb-0310-9956-ffa450edef68
* apr_json_decode: apr_array_header_t uses ints.Yann Ylavic2022-06-231-2/+2
| | | | | | | | | * json/apr_json_decode.c(apr_json_decode_array): apr_array_make() want an int. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902196 13f79535-47bb-0310-9956-ffa450edef68
* crypto/blowfish: Fix wrnings for ints used as size_t.Yann Ylavic2022-06-232-13/+15
| | | | | | | | | | | | | | | | * crypto/crypt_blowfish.c(BF_decode, BF_encode, _crypt_output_magic, _crypt_blowfish_rn, _crypt_gensalt_blowfish_rn): Use apr_size_t instead of int size. * crypto/crypt_blowfish.c(_crypt_gensalt_blowfish_rn): Fix conversion from 'unsigned long' to 'char'. * crypto/crypt_blowfish.h(): Use apr_size_t instead of int size, and #include "apr.h". git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902195 13f79535-47bb-0310-9956-ffa450edef68
* apr_brigade: Fix conversion from 'apr_off_t' to 'size_t', possible loss of data.Yann Ylavic2022-06-231-2/+2
| | | | | | | | | * buckets/apr_brigade.c(apr_brigade_split_boundary): "ignore" and "inbytes" vars are size_t and used as such. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902194 13f79535-47bb-0310-9956-ffa450edef68
* apr_pools: Fix signed/unsigned mismatch waning.Yann Ylavic2022-06-231-2/+2
| | | | | | | | | * memory/unix/apr_pools.c(apr_pool_initialize): Use 1u for shifting to unsigned. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902193 13f79535-47bb-0310-9956-ffa450edef68
* test/abts: Follow up to r1902191: Fix IMPL_abts_T_nequal.Yann Ylavic2022-06-231-1/+1
| | | | | | | | | * test/abts.c(IMPL_abts_T_nequal): Invert logic from IMPL_abts_T_equal (bad copypasta) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902192 13f79535-47bb-0310-9956-ffa450edef68
* test/abts: More numeric types to compare/assert.Yann Ylavic2022-06-232-45/+78
| | | | | | | | | | | | | * test/abts.h(): Declare abts_{uint,long,ulong,llong,ullong}_{n,}equal() and the corresponding ABTS_{UINT,LONG,ULONG,LLONG,ULLONG}_{N,}EQUAL() wrappers. * test/abts.c(): Implement abts_{uint,long,ulong,llong,ullong}_{n,}equal() using a common macro. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902191 13f79535-47bb-0310-9956-ffa450edef68
* debug for CIEric Covener2022-06-231-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902184 13f79535-47bb-0310-9956-ffa450edef68
* test/testmutexscope: Fix -Wvoid-pointer-to-enum-castYann Ylavic2022-06-231-2/+2
| | | | | | | | | * test/testmutexscope.c(test_mech_mode, eachThread): Cast to apr_uintptr_t first before converting pointer to/from enum. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902182 13f79535-47bb-0310-9956-ffa450edef68
* test/testlock: Fix -Werror=return-typeYann Ylavic2022-06-231-0/+2
| | | | | | | | | | * test/testlock.c(thread_mutex_function, thread_mutex_sleep_function): Thread (APR_THREAD_FUNC) functions should return a pointer (NULL). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902181 13f79535-47bb-0310-9956-ffa450edef68
* test/testfile.c: apr_file_datasync() fails with ENOTSUP for streams on macos.Yann Ylavic2022-06-231-0/+4
| | | | | | | | | * test/testfile.c(test_datasync_on_stream): Handle ENOTSUP on macos. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902180 13f79535-47bb-0310-9956-ffa450edef68
* poll: kqueue: Fix -Wincompatible-pointer-types-discards-qualifiersYann Ylavic2022-06-221-2/+2
| | | | | | | | | * poll/unix/kqueue.c(impl_pollset_add): Cast to (void *) to "break" constantnes of descriptor. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902178 13f79535-47bb-0310-9956-ffa450edef68
* set -lxml2 in non xml2-config caseEric Covener2022-06-221-0/+2
| | | | | | | Closes #36 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902176 13f79535-47bb-0310-9956-ffa450edef68