summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* apr_brigade_split_boundary: Rather than shaving one byte fromGraham Leggett2021-10-201-8/+7
| | | | | | | a bucket, ignore the byte instead on the next go-round. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894423 13f79535-47bb-0310-9956-ffa450edef68
* apr_brigade_split_boundary: Correctly account for the bytes we've written.Graham Leggett2021-10-201-0/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894420 13f79535-47bb-0310-9956-ffa450edef68
* apr_brigades: Add apr_brigade_split_boundary(), allowing us to splitGraham Leggett2021-10-193-0/+357
| | | | | | | brigades on boundaries of arbitrary length. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894380 13f79535-47bb-0310-9956-ffa450edef68
* Since runtime SCTP detection is dependent on kernel configuration, addJoe Orton2021-10-122-2/+19
| | | | | | | | | | | | | | flags to make SCTP support reliable: * build/apr_network.m4 (APR_CHECK_SCTP): Add --disable-sctp flag to forcibly disable SCTP support, and --enable-sctp to fail configure if is SCTP support is requested but not available. Submitted by: Lubos Uhliarik <luhliari redhat.com>, jorton Github: closes #28 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894167 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto: non-DSO drivers should have global lifetime too.Yann Ylavic2021-09-201-3/+5
| | | | | | | | | Same lifetime as the hashtable used by apr_crypto_get_driver() to cache the drivers for reloads. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893466 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1893204: restore apr_file_setaside() semantics, fix ↵Yann Ylavic2021-09-194-6/+31
| | | | | | | | | | | | | | | 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
* testcrypto: really change one bit of the seed (only) in test_crypto_prng().Yann Ylavic2021-09-121-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893275 13f79535-47bb-0310-9956-ffa450edef68
* testcrypto: run non-threaded cprng tests without APR_CRYPTO_PRNG_PER_THREAD.Yann Ylavic2021-09-121-24/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893274 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto_prng: cleanup after ourselves when apr_crypto_prng_init() fails.Yann Ylavic2021-09-121-8/+17
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893271 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto: cprng_stream_ctx_make() to return NULL *ctx on failure.Yann Ylavic2021-09-121-2/+5
| | | | | | | | | apr_crypto_prng_create() relies on cprng_stream_ctx_make() to not set a freed/dangling cprng->ctx on failure when given NULL. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893270 13f79535-47bb-0310-9956-ffa450edef68
* apr_file_setaside: don't blindly kill the old cleanup and file descriptor.Yann Ylavic2021-09-103-11/+6
| | | | | | | | | | | 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
* apr_crypto: s/APR_CRYPTO_CIPHER_CHACHA20_CTR/APR_CRYPTO_CIPHER_CHACHA20/gYann Ylavic2021-09-103-3/+3
| | | | | | | Chacha is a stream cipher, not a block cipher in counter mode. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893203 13f79535-47bb-0310-9956-ffa450edef68
* test: fix memory leaks of the test framework at exit.Yann Ylavic2021-09-103-5/+21
| | | | | | | To please memory leak analysers.. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893202 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto: fix potential memory leaks of cprng_stream_ctx_t.Yann Ylavic2021-09-101-6/+18
| | | | | | | | | | | | | | | | | | This can happen in cprng_stream_ctx_make() on error paths, or at thread exit with APR_CRYPTO_PRNG_PER_THREAD like the below. Direct leak of 64 byte(s) in 8 object(s) allocated from: #0 0x7efd954c7628 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x107628) #1 0x7efd921db6ca (<unknown module>) #2 0x7efd952937a2 in apr_crypto_prng_create crypto/apr_crypto_prng.c:367 #3 0x7efd95292c1e in apr_crypto_random_thread_bytes crypto/apr_crypto_prng.c:218 #4 0x5611dbbb9440 in thread_func /home/yle/src/apache/apr/trunk.ro/test/testcrypto.c:2597 #5 0x7efd9537dd86 in dummy_worker threadproc/unix/thread.c:148 #6 0x7efd951efea6 in start_thread nptl/pthread_create.c:477 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893201 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto: fixes for thread local storage destructor.Yann Ylavic2021-09-091-3/+8
| | | | | | | | | | | cprng_thread_destroy() should destroy the given cprng first because this might set cprng_global to NULL. apr_crypto_prng_init() shouldn't delete cprng_thread_key on failure unless APR_CRYPTO_PRNG_PER_THREAD is used. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893199 13f79535-47bb-0310-9956-ffa450edef68
* poll: don't #include sys/poll.h if poll.h is available.Yann Ylavic2021-09-092-6/+3
| | | | | | | | With musl libc, this fixes: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1893198 13f79535-47bb-0310-9956-ffa450edef68
* Update config.guess and config.sub fromRainer Jung2021-08-312-826/+998
| | | | | | | https://git.savannah.gnu.org/cgit/config.git. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1892754 13f79535-47bb-0310-9956-ffa450edef68
* apr_tables: fix petential left shift of 31 on an int.Yann Ylavic2021-08-261-2/+2
| | | | | | | | apr_tables.c:832:10: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1892618 13f79535-47bb-0310-9956-ffa450edef68
* Add minimal Travis CI configuration (no notifications currently).Joe Orton2021-08-161-0/+35
| | | | | | | Github: closes #27 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1892374 13f79535-47bb-0310-9956-ffa450edef68
* * test/proc_child.c (main): Avoid gcc -Wunused-result warning withJoe Orton2021-07-061-3/+3
| | | | | | | write() return value. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891310 13f79535-47bb-0310-9956-ffa450edef68
* * test/testsockets.c (sendto_receivefrom_helper): Add descriptiveJoe Orton2021-07-061-1/+3
| | | | | | | error message on failure case. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891308 13f79535-47bb-0310-9956-ffa450edef68
* * memory/unix/apr_pools.c: Declare apr__pool_unmanage to fixJoe Orton2021-07-061-0/+2
| | | | | | | compiler warning. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891307 13f79535-47bb-0310-9956-ffa450edef68
* * locks/unix/thread_mutex.c,Joe Orton2021-07-022-0/+11
| | | | | | | | | include/arch/unix/apr_arch_thread_mutex.h: Completely drop the code required imitate the mutex via a condition variable if HAVE_PTHREAD_MUTEX_TIMEDLOCK is defined. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891204 13f79535-47bb-0310-9956-ffa450edef68
* * test/testlock.c (thread_mutex_function): Test that locking andJoe Orton2021-07-021-17/+36
| | | | | | | | unlocking succeed. Catch thread join errors and thread exit status throughout. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891203 13f79535-47bb-0310-9956-ffa450edef68
* * memory/unix/apr_pools.c (apr_pool_create_unmanaged_ex): Destroy theJoe Orton2021-07-021-0/+2
| | | | | | | allocator if node allocation fails, rather than leaking it. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891202 13f79535-47bb-0310-9956-ffa450edef68
* * test/testdate.c: Add regression test for r1807975.Joe Orton2021-07-021-0/+27
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1891197 13f79535-47bb-0310-9956-ffa450edef68
* Use apr_psprintf() instead of apr_strerror() to avoid a worst case allocation.Graham Leggett2021-06-221-6/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1890980 13f79535-47bb-0310-9956-ffa450edef68
* Fall back on default if the dbm type is unset.Graham Leggett2021-06-221-0/+8
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1890966 13f79535-47bb-0310-9956-ffa450edef68
* apr_dbm: Add dedicated apr_dbm_get_driver() function that returnsGraham Leggett2021-06-218-21/+114
| | | | | | | | details of the driver selected and any error encountered. Add the apr_dbm_open2() function that references the driver. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1890952 13f79535-47bb-0310-9956-ffa450edef68
* Use portable make variablesMichael Osipov2021-05-251-1/+1
| | | | | | | | The usage of '$<' with BSD make results in an empty variable, therefore compilation fails. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1890191 13f79535-47bb-0310-9956-ffa450edef68
* * xml/apr_xml.c (apr_xml_parser_done): Drop variable and passJoe Orton2021-05-071-2/+1
| | | | | | | | the empty string to ->Parse(), avoiding GCC 11 warning. No functional change. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1889605 13f79535-47bb-0310-9956-ffa450edef68
* * random/unix/sha2.c (apr__SHA256_Final, apr__SHA256_End): Fix parameterJoe Orton2021-05-071-2/+2
| | | | | | | | buffer lengths to match declaration, avoiding GCC 11 warning. (no functional change) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1889604 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1884109: Fix synchronization in thread_pool_cleanup().Yann Ylavic2021-04-261-20/+16
| | | | | | | | | Ask each thread to signal its task completion individually when being waited in wait_on_busy_threads(), and ignore threads that have already finished their task (elt->current_owner == NULL). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1889217 13f79535-47bb-0310-9956-ffa450edef68
* testfile: don't generate .txt files since it distorts testfnmatch results.Yann Ylavic2021-03-311-8/+8
| | | | | | | Change to .dat files instead (also in svn:ignore). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1888251 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887279: fix new APR_TRY_COMPILE_NO_WARNING.Yann Ylavic2021-03-241-2/+9
| | | | | | | | | | | | AC_LANG_PROGRAM generates an "int main()" prototype which some compilers warn about. Restore AC_LANG_SOURCE to manually set the correct main() but do not #include "confdefs.h" if it is inlined already by AC_LANG_SOURCE (i.e. check whether PACKAGE_NAME is already defined). Github: closes #25 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1888017 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887060: fix compilation on BEOS.Yann Ylavic2021-03-111-2/+4
| | | | | | | poffset is undefined there, by inspection (no BEOS at hand..). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887506 13f79535-47bb-0310-9956-ffa450edef68
* More revert of r1887500.Yann Ylavic2021-03-112-18/+26
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887505 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887060: fix compilation on BEOS.Yann Ylavic2021-03-111-4/+2
| | | | | | | poffset is undefined there, by inspection (no BEOS at hand..). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887502 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887060: fix compilation on BEOS.Yann Ylavic2021-03-113-28/+22
| | | | | | | poffset is undefined there, by inspection (no BEOS at hand..). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887500 13f79535-47bb-0310-9956-ffa450edef68
* testfnmatch: fix number of expected test/data/*.txt files.Yann Ylavic2021-03-111-1/+1
| | | | | | | Maybe there used to be 10 test/data/*.txt files, there are 3 only now. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887490 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1887481: fix skiplisti_init() returned pointer.Yann Ylavic2021-03-111-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887482 13f79535-47bb-0310-9956-ffa450edef68
* apr_skiplist: Handle ENOMEM from skiplisti_init(), fixing a compiler warning.Yann Ylavic2021-03-111-4/+16
| | | | | | | | | | | | | | | | gcc-10 raises: tables/apr_skiplist.c: In function ‘apr_skiplist_add_index’: tables/apr_skiplist.c:284:16: error: ‘ni’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 284 | nsln = apr_skiplist_insert(ni, m->data); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ because above skiplisti_init() might return with ENOMEM, leaving ni uninitialized. Since apr_skiplist_add_index returns void, the only option is to abort() in this case. For apr_skiplist_init(), we can forward the APR_ENOMEM to the caller. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887481 13f79535-47bb-0310-9956-ffa450edef68
* build/apr_common.m4: avoid explicit inclusion of "confdefs.h"Yann Ylavic2021-03-061-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The failure is observed on `autoconf-2.69d` (soon to be released as `autoconf-2.70`). There `int64_t` detection fails as: $ autoreconf && ./configure checking whether int64_t and int use fmt %d... no checking whether int64_t and long use fmt %ld... no checking whether int64_t and long long use fmt %lld... no configure: error: could not determine the string function for int64_t ``` This happens because `./configure` always stumbles on warning: configure:3350: gcc -c -g -O2 -Werror conftest.c >&5 In file included from conftest.c:31: confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror] 22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 | It's triggered by double inclusion of `"confdefs.h"` contents: explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly via `AC_LANG_SOURCE` use. To fix it and avoid having to define `main()` declaration the change uses `AC_LANG_PROGRAM` instead. Tested on both `autoconf-2.69` and `autoconf-2.69d`. Github: closes #25 Submitted by: Sergei Trofimovich <slyfox gentoo.org> Reviewed by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887279 13f79535-47bb-0310-9956-ffa450edef68
* Remove Windows apr_mmap_t members pstart, psize and poffset.Yann Ylavic2021-03-023-13/+15
| | | | | | | They are only used locally in apr_mmap_create(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887062 13f79535-47bb-0310-9956-ffa450edef68
* Align apr_mmap()ing offset to a page boundary. PR 65158.Yann Ylavic2021-03-025-36/+96
| | | | | | | | | | | | | | | This is requirement for unix systems, and otherwise can cause failures or undefined behaviour with some filesystems. Add apr_mmap_t->poffset on unixes to track the offset to the previous page, relative to the user requested/actual offset. This allows ->mm and ->size to still point to the actual data, while munmap() still deletes the full range from the start of the page. Tests updated accordingly. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1887060 13f79535-47bb-0310-9956-ffa450edef68
* * test/testthread.c: Use a user-range apr_status_t value for theJoe Orton2020-12-171-3/+6
| | | | | | | | test thread exit code. (thread_func1): Exit if mutex lock/unlock fails. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1884544 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread_pool: don't detach worker threads (and always join them).Yann Ylavic2020-12-041-156/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detached threads are out of control and don't give the user a way to synchronize when the program ends (or when the thread_pool is destroyed). Rework the synchronization logic so that dead threads are always joined. This is done by adding dead_thds ring and a join_dead_threads() function called from several places: on termination when the thread_pool is destroyed, on resizing with apr_thread_pool_{thread,idle}_max_set() when stopping off limits threads, on maintenance when a task is added/cancelled. Since join_dead_threads() waits for threads already dead (not the idle/busy ones asked to die) the operation is not blocking indefinitely, so there is no indefinite (nor much) overhead added to these places due to waiting for dead threads. The thread_pool_func() worker function is reworked to have a single point of exit, and to always update the rings and counters accurately according to the thread state, which allows for simpler maintenance and/or termination from the other functions. The threads now put themselves into the (new) dead_thds ring before exit, and the apr_thread_pool_{thread,idle}_max_set() functions don't modify the idle or busy rings concurrently with the thread_pool_func() workers anymore. They only ask the threads to stop and put themselves in dead_thds. To join all the threads in thread_pool_cleanup(), cancel all the tasks and wait for the busy threads handling them to die/idle (thanks to the new "work_done" condition variable triggered by the thread after its task), then stop all the remaining threads by calling apr_thread_pool_thread_max_set(0), and finally wait for the last thread to exit (thanks to the new "all_done" condition var triggered by the last thread exiting, replacing the spin wait). So destroying the thread_pool (or a parent pool) may wait (indefinitely) for all the active tasks to complete, which is the purpose of this commit: avoid undefined behaviour in this case. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1884098 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: use unmanaged pools for detached threads.Yann Ylavic2020-12-036-11/+203
| | | | | | | | | | | | | | | | A detached thread is by definition out of control, unjoinable, unmanaged, and it can terminate/exit after its parent pool is detroyed. To avoid use-after-free in this case, let's use an unmanaged pool for detached threads, either by creating an unmanaged pool from the start if the thread is created detached, or by "unmanaging" the pool if the thread is detached later with apr_thread_detach(). To "umanage" the pool, provide a new internal helper, apr__pool_unmanage() which takes care of removing the pool from its parent's list. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1884078 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: destroy the thread's pool at _join() time, unless _detach()ed.Yann Ylavic2020-12-039-28/+101
| | | | | | | | | | | | | | Destroying a joinable thread pool from apr_thread_exit() or when the thread function returns, i.e. from inside the thread itself, is racy or deadlocky with APR_POOL_DEBUG, with the parent pool being destroyed. This commit adds a ->detached flag in each arch's apr_thread_t struct to track whether a thread is detached (either at _create() or _detach() time). If detached, the pool is destroyed when the thread exits, otherwise when the thread is joined with apr_thread_join(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1884077 13f79535-47bb-0310-9956-ffa450edef68
* apr_errno: add APR_EALREADY, eventually mapped from system's [WSA]EALREADY.Yann Ylavic2020-11-272-1/+18
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1883874 13f79535-47bb-0310-9956-ffa450edef68