| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Fix compilation of apr_thread_current_create() for OS/2 and Windows.
Set *current to NULL on failure.
Merge r1897879 from trunk.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897880 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Merge r1897470 from trunk.
Submitted by: ylavic
Reviewed by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897471 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
.. rather than a defined().
Merge r1897447 from trunk.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897448 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
It's not needed, when the thread exits it's not accessible anyway.
Merge r1897445 from trunk.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897446 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Merge r1897419 from trunk.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897420 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Merge r1897207 from trunk:
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897223 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
apr_thread: Follow up to r1897197: Safer apr_thread_join().
Make sure apr_thread_join() behaves correctly w.r.t. the returned value
and pool destroy for all archs.
Merge r1897197, r1897198 from trunk.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897221 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 :)
Merge r1897179 from trunk.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1897220 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OS/2: Clean up a thread's pool when it terminates.
<not backported in 1.7.x>
Add apr_pool_owner_set function to allow use of pool debugging with threads
Actually this function has been mentioned in the docs for over 10 years
but has never been implemented.
</not backported in 1.7.x>
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.
apr_thread: destroy the thread's pool at _join() time, unless _detach()ed.
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().
apr_thread: use unmanaged pools for detached threads.
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.
Submitted by: bjh, sf, ylavic, ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1884103 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
Signals: Allow handling of SIGUSR2 in apr_signal_thread.
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: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1854995 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1710308 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1611061 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
The original commit message was:
Fix typo
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1594689 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Add object perms set macros and implement them for shm and mutex
Submitted by: mturk, rpluem
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1590617 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
spelling fix
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1534104 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
release critical section before returning on error path
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1534103 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1533107 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
it should really handle src==NULL
Reviewed/backported by: jim
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1533105 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
Backport of r1213382 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1528818 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
platform independent macro instead of pthread
define.
Backport of r1481265 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1481266 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
Backport of r1481262 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1481263 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Backport of r1198860 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1199082 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix various issues found by cppcheck
- 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/branches/1.5.x@1183724 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't close any of the new stdin/stdout/stderr FDs in the child if it
already has the correct FD.
PR: 51995
Submitted by: Dan Ports <drkp csail mit edu>]
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1183706 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
to resolve some gcc warnings and dead code on Windows
(the testlfsabi change from r1083183 is omitted, as the testcases
aren't in this branch)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1083869 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1080082 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1080074 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@1071966 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
* We need to disable inheritance in the case of success like in the
cases for stdout and stdin.
Fixes the same issue fixed for unix in r783398
Submitted by: rpluem
Reviewed by: rpluem
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@783725 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
* We need to disable inheritance in the case of success like in the
cases for stdout and stdin.
Submitted by: rpluem
Reviewed by: rpluem
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@783399 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@720054 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@649208 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@617375 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: https://svn.apache.org/repos/asf/apr/apr/trunk@596402 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@590849 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
We still need to restore the std handles if "no file" (filedes == -1)
is passed to the child.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@590848 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
I haven't yet verified that the code works but this is a step in the right
direction.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@590037 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@585260 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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: https://svn.apache.org/repos/asf/apr/apr/trunk@584928 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
of the pipe to uninherited. Let it be closed upon cleanup_for_exec.
The later dup2() for the parent pipe does not automagically become inherited
again, and later dup()'s are never inherited by default.
There's no longer an explicit need to close the parent-end in proc_create
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584570 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
inherited. Solve this by setting the duplicated handle to inherit.
once finished with the fork(), now that we don't waste pipe creation
resources on a single handle, watch out for closing the parent handle
inside the child.
in fact I believe that toggling parent_* handles apr_file_inherit_unset
way back in apr_procattr_io_set / apr_procattr_child_*_set would be
more efficient; comments?
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584569 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First; we absolutely do NOT want to waste our time creating a pipe,
when the caller has their own file descriptors all set up to give to
the child process (and use itself). We can also presume a single
ended pipe is about as interesting as the sound of one hand clapping.
Create the pipe only when we don't already have any child/parent pipes
set up, and when the caller passes no files for us to use. Otherwise,
we simply dup for our own use rather than dup2.
Second; we absolutely cannot dup2 into the static 'no_file' special fd,
so we'll guard against this and also dup, instead, for this case.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584500 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
apr_file_pipe_create_ex() for win32, many lines are redundant.
Thanks to Eric for picking up on this mess in the first place!
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584496 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Submitted by: Lucian Adrian Grijincu <lucian.grijincu gmail.com>
Reviewed by: rpluem
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584411 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
appropriate based on the input parameters.
PR: 43522
Submitted by: Eric Covener <covener gmail.com>
Reviewed by: trawick
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@583421 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
(we aren't trying to close our child_fd's here).
Submitted by: David Glasser <glasser@davidglasser.net>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@581089 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
for pointing this out to me on #irc.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@581042 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
| |
These can be reduced further and still remain legible.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@580632 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@580591 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
if we use apr_procattr_stderr_set() it will not close out the
previous handle parked there by _io_set(). But it also does
not attempt to touch the _io_set() no_file STATIC apr_file_t's
so there is nothing to otherwise fix here immediately.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@580515 13f79535-47bb-0310-9956-ffa450edef68
|