summaryrefslogtreecommitdiff
path: root/threadproc
Commit message (Collapse)AuthorAgeFilesLines
* * threadproc/win32/proc.c: Remove Windows CE and non-unicode code.ivan2019-07-101-217/+93
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1862856 13f79535-47bb-0310-9956-ffa450edef68
* API/ABI change, drop return value of apr_thread_exit() which hasjorton2019-07-035-14/+6
| | | | | | | | | | | | no useful (nor documented) semantic: * include/apr_thread_proc.h (apr_thread_exit): Make void function; mark with gcc noreturn attribute. * threadproc/*/thread.c (apr_thread_exit): Update accordingly. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1862446 13f79535-47bb-0310-9956-ffa450edef68
* Use native one-time initialization [1] to implement apr_thread_once_t onivan2019-05-191-4/+24
| | | | | | | | | | | Windows. This also fixes problem that apr_thread_once() may return before the other read completes initialization on Windows. [1] https://docs.microsoft.com/en-gb/windows/desktop/Sync/one-time-initialization git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1859517 13f79535-47bb-0310-9956-ffa450edef68
* Use API constant instead of magic number.ivan2019-05-131-1/+1
| | | | | | | | * threadproc/win32/threadpriv.c (apr_threadkey_private_create): Use TLS_OUT_OF_INDEXES instead of hardcoded 0xFFFFFFFF. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1859171 13f79535-47bb-0310-9956-ffa450edef68
* Signals: Allow handling of SIGUSR2 in apr_signal_thread.ylavic2019-02-221-6/+0
| | | | | | | | It's not like users have so many free signals to play with, let's increase this number by 100% here, not so bad :) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1854123 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto: follow up to r1833359: better cprng_stream_bytes() semantics.ylavic2018-06-281-2/+2
| | | | | | | | | | | | Make cprng_stream_ctx_bytes() rekey in any case, this is exactly what we need both when generating pooled random bytes and when handling fork() the parent and child key should not leak to each other. There is no use case for a keystream without setting the key first and burning it afterward, and there shouldn't be. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1834600 13f79535-47bb-0310-9956-ffa450edef68
* apr_crypto: follow up to r1833359: improve CPRNGs fork()ing.ylavic2018-06-271-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework apr_crypto_prng_after_fork() which now handles rekeying of all the CPRNGs created within apr_crypto, by maintaining them in a global APR_RING, with the notable exception of per-thread ones (never forked). For each maintained CPRNG, apr_crypto_prng_after_fork() will now first rekey both the parent and child processes (determined by the 'in_child' argument provided by the caller), and for the parent only rekey a second time so that the initial states finally differ for both processes. Once these new keys are committed to their respective CPRNGs, thanks to and in continuity with the forward secrecy construct of apr_crypto_prng, there will be no in memory key material or stream that one process can inherit or infer from the other. The user can also rekey a CPRNG explicitely by calling the new function apr_crypto_prng_rekey(), and this is done by apr_fork() implicitely before forking any child, thus for the parent process. This safe guard ensures both the clearing of the pooled random bytes (buffered keystream) and the renewal of key material (cheap and preventive against _atfork() handlers or alike). Rekeying is done by using each CPRNG's keystream directly, there isn't anymore the use of a PID (or SHA256 thereof) for children processes nor any extra reads from the system RNG. All the apr_crypto_prng API is now self contained and can work entirely with a single stream cipher as primitive (Chacha20 or AES256-CTR, in that order of availability) and the initial entropy of 32 bytes gathered from the system. IOW, there is only one call issued to the system RNG for the global CPRNG's initial key, and if more CPRNGs are created their own initial key is produced by the global CPRNG. The KAT arrays in the tests suite needed adjustment too because the initial seed (if provided, like the zeros-input for the KAT) is no more used directly as the first key. Instead the first 32 bytes of the keystream generated from the seed are, and the seed (like any just used key) is then cleared immediatly from internal memory. Finally some private APR_CRYPTO_PRNG_* macros (in .c file only) are renamed to CPRNG_* to shorten colomns and avoid multilines in several cases. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1834551 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1833359: apr_crypto_prng_after_fork() can now use a PID.ylavic2018-06-121-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1833382 13f79535-47bb-0310-9956-ffa450edef68
* Cryptographic Pseudo Random Number Generator (CPRNG).ylavic2018-06-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | New apr_crypto_prng API and apr_crypto[_thread]_random_bytes() functions. Allows to generate cryptographically secure random bytes indefinitely given an initial seed of APR_CRYPTO_PRNG_SEED_SIZE bytes (32), which is either provided by the caller or automatically gathered from the system. The CPRNG can also be re-seeded at any time, or after a process is fork()ed. The internal key is renewed every APR_CRYPTO_PRNG_SEED_SIZE random bytes produced and those data once returned to the caller are cleared from the internal state, which ensures forward secrecy. This CPRNG is fast, based on a stream cipher, and will never block besides the initial seed or any reseed if it depends on the system entropy. Finally, it can be used either globally (locked in multithread environment), per-thread (a lock free instance is automatically created for each thread on first use), or created as standalone instance (manageable independently). For now it's only implemented with the OpenSSL library as underlying crypto, that is --with-crypto --with-openssl needs to be configured, and the latter links libcrypto with APR. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1833359 13f79535-47bb-0310-9956-ffa450edef68
* Use 'apr_pstrmemdup' instead of 'apr_pstrndup' when applicable in order to ↵jailletc362015-10-241-3/+3
| | | | | | save a few cycles. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1710307 13f79535-47bb-0310-9956-ffa450edef68
* Fixed indent - no code change.fuankg2014-07-161-12/+11
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1611050 13f79535-47bb-0310-9956-ffa450edef68
* Fixed type; fixed comments.fuankg2014-07-161-4/+4
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1611046 13f79535-47bb-0310-9956-ffa450edef68
* stop using deprecated versions of APR_FOPEN_* and APR_FPROT_*trawick2014-01-181-1/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1559343 13f79535-47bb-0310-9956-ffa450edef68
* Followup on r1481262: use already existingrjung2013-05-111-1/+1
| | | | | | | | platform independent macro instead of pthread define. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1481265 13f79535-47bb-0310-9956-ffa450edef68
* Use correct pthread constant.rjung2013-05-111-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1481262 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_pool_owner_set function to allow use of pool debugging with threadssf2013-03-235-4/+25
| | | | | | | | | | | | | | Actually this function has been mentioned in the docs for over 10 years but has never been implemented. Also consistently destroy the thread's pool when it exits normally, not only on apr_thread_exit(). This was already done on OS2. Other platforms than unix are untested. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1460182 13f79535-47bb-0310-9956-ffa450edef68
* spelling fixtrawick2012-09-141-2/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1384764 13f79535-47bb-0310-9956-ffa450edef68
* release critical section before returning on error pathtrawick2012-08-121-0/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1372093 13f79535-47bb-0310-9956-ffa450edef68
* definAtelytrawick2011-12-121-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1213382 13f79535-47bb-0310-9956-ffa450edef68
* Clarify what happens to the proc structure used by apr_fork(). sctemme2011-11-071-7/+3
| | | | | | | | | Set the proc->pid field to the pid of the newly created child. Note that a mere pid value provides little entropy to mix into the child random pool. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1198860 13f79535-47bb-0310-9956-ffa450edef68
* Don't close any of the new stdin/stdout/stderr FDs in the child if itsf2011-10-151-3/+6
| | | | | | | | | | already has the correct FD. PR: 51995 Submitted by: Dan Ports <drkp csail mit edu>] git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1183685 13f79535-47bb-0310-9956-ffa450edef68
* fix declaration of apr_signal_description_get()trawick2011-03-191-1/+1
| | | | | | | (exposed by r1083169) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1083178 13f79535-47bb-0310-9956-ffa450edef68
* clean up some low hanging gcc warnings on Wintrawick2011-03-192-1/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1083169 13f79535-47bb-0310-9956-ffa450edef68
* Fixed NetWare prototype warnings.fuankg2011-03-072-5/+4
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1078658 13f79535-47bb-0310-9956-ffa450edef68
* Fixed compilation when APR_HAVE_STRUCT_RLIMIT=0.fuankg2011-03-072-4/+20
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1078655 13f79535-47bb-0310-9956-ffa450edef68
* Axed C++ comments.fuankg2011-02-091-2/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1068870 13f79535-47bb-0310-9956-ffa450edef68
* Removed tabs.fuankg2010-09-011-6/+6
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@991647 13f79535-47bb-0310-9956-ffa450edef68
* The Tab Police removed 119 tabs.fuankg2010-08-031-25/+25
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@981793 13f79535-47bb-0310-9956-ffa450edef68
* Fix various issues found by cppchecksf2010-07-273-9/+9
| | | | | | | | | | | | - 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: http://svn.apache.org/repos/asf/apr/apr/trunk@979891 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Clean up a thread's pool when it terminates.bjh2010-04-211-0/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@936323 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Remove all remaining uses of APR_OS2_STATUS macro which has beenbjh2010-04-024-6/+6
| | | | | | | superceded by the more general APR_FROM_OS_ERROR. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@930224 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Prevent pthread_sigmask() being used on OS/2 by definingbjh2010-03-301-0/+1
| | | | | | | SIGPROCMASK_SETS_THREAD_MASK. It also happens to be true. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@929139 13f79535-47bb-0310-9956-ffa450edef68
* Finish removing apu_config.h[n]w templates, these need synchronization w/unixwrowe2009-12-182-2/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@892148 13f79535-47bb-0310-9956-ffa450edef68
* * We need to disable inheritance in the case of success like in therpluem2009-06-113-3/+3
| | | | | | | | cases for stdout and stdin. Fixes the same issue fixed for unix in r783398 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@783722 13f79535-47bb-0310-9956-ffa450edef68
* * We need to disable inheritance in the case of success like in therpluem2009-06-101-1/+1
| | | | | | | cases for stdout and stdin. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@783398 13f79535-47bb-0310-9956-ffa450edef68
* Remove simple ipc because of -1mturk2009-02-245-341/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@747357 13f79535-47bb-0310-9956-ffa450edef68
* Remove ipc init from apr_initialize.mturk2009-02-234-40/+84
| | | | | | | On posix make unique tmp name and add that to child environment. The env var name made of child making it almost unique for that process instance git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@747042 13f79535-47bb-0310-9956-ffa450edef68
* Although compiles, it doesn't look nice ;)mturk2009-02-211-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@746590 13f79535-47bb-0310-9956-ffa450edef68
* Add simple parent/child data exchange for APR processesmturk2009-02-215-0/+296
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@746589 13f79535-47bb-0310-9956-ffa450edef68
* Fix typomturk2009-02-071-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@741867 13f79535-47bb-0310-9956-ffa450edef68
* Add object perms set macros and implement them for shm and mutexmturk2009-02-075-1/+62
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@741862 13f79535-47bb-0310-9956-ffa450edef68
* Clear up this wording a bitwrowe2008-11-231-2/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@720054 13f79535-47bb-0310-9956-ffa450edef68
* mplement apr_proc_wait_all_procs for windowsmturk2008-04-171-15/+126
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@649208 13f79535-47bb-0310-9956-ffa450edef68
* Check for bogus (negative) signal numbersmartin2008-02-011-2/+2
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@617375 13f79535-47bb-0310-9956-ffa450edef68
* Simplify handling of z/OS pthread API nuances. Beyond thetrawick2007-11-192-13/+17
| | | | | | | | | | | | | simplification, it fixes a compile error in the call to pthread_yield() on z/OS. Submitted by: David Jones I modified it slightly to use AC_DEFINE() as suggested by jorton. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@596402 13f79535-47bb-0310-9956-ffa450edef68
* Fix mismatch, using child_err when dealing with stdout.bjh2007-10-311-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@590849 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Fix condition for restoring std handles after spawning a process.bjh2007-10-311-6/+15
| | | | | | | | We still need to restore the std handles if "no file" (filedes == -1) is passed to the child. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@590848 13f79535-47bb-0310-9956-ffa450edef68
* Fix build breakage due to syntax errors in threadproc/os2/proc.c.bjh2007-10-301-9/+10
| | | | | | | | I haven't yet verified that the code works but this is a step in the right direction. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@590037 13f79535-47bb-0310-9956-ffa450edef68
* Fix up a few netware'isms and missing brackets left over from the refactoring.bnicholes2007-10-161-6/+10
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@585260 13f79535-47bb-0310-9956-ffa450edef68
* Backport the std handling improvements to Netware, OS2, BeOS.wrowe2007-10-153-285/+384
| | | | | | | | | | | | | | | | | | | | | These may need massaging and do need review by their respective communities. Note that someone from the OS2 community needs to ping me with resolving the missing apr_arch_inherit.h mess; this should be very easy to translate into DosSetFHState(handle, OPEN_FLAGS_NOINHERIT); bits, but to more thoroughly resolve the issue, we should take it a step further and consider the NT implementation which toggles inheritance on only for handles as they hit proc_create, so that you don't have cross-process handle leakage into the wrong processes. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@584928 13f79535-47bb-0310-9956-ffa450edef68