summaryrefslogtreecommitdiff
path: root/threadproc/os2
Commit message (Collapse)AuthorAgeFilesLines
* apr_thread: Follow up to r1897207: apr_thread_current_create() is ENOTIMPL ↵Yann Ylavic2023-03-151-2/+4
| | | | | | | | | | w/o APR_HAS_THREAD_LOCAL. It's useless when !APR_HAS_THREAD_LOCAL since apr_thread_current() can't work. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1908417 13f79535-47bb-0310-9956-ffa450edef68
* Merge thread-name branch (PR 60587) [1]:Ivan Zhakov2023-01-211-0/+14
|\ | | | | | | | | | | | | | | | | * Introduce apr_thread_name_set() and apr_thread_name_get(). [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60587 [2] https://lists.apache.org/thread/z24logzc6v8tc0p2q3375cc10qo9y5yw git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1906889 13f79535-47bb-0310-9956-ffa450edef68
| * On 'thread-name' branch: Add apr_thread_name_get() and apr_thread_name_set()Ivan Zhakov2022-06-271-0/+14
| | | | | | | | | | | | 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
* | Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-203-35/+35
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* | apr_thread: Provide apr_threadattr_max_free_set().Yann Ylavic2022-07-141-10/+12
|/ | | | | | | | | | | | | | | When creating a thread, this allows to specify the "max_free" of its pool allocator (i.e. apr_allocator_max_free_set), so that one can create thread local subpools and have their memory usage regulated on cleanup/destroy. One could achieve that already with: apr_allocator_max_free_set(apr_thread_pool_get(thread), max_free); in the thread startup function, but it's more convenient, simpler and race free to handle that in the thread attribute itself at creation time. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902715 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: Follow up to r1897207 and r1897471: s/AP_HAS_/APR_HAS_/gYann Ylavic2022-06-171-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902019 13f79535-47bb-0310-9956-ffa450edef68
* apr_thread: Follow up to r1897207: apr_thread_current_create() compilation.Yann Ylavic2022-02-081-1/+2
| | | | | | | | | 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
* apr_thread: Follow up to r1897207: Provide apr_thread_current_after_fork().Yann Ylavic2022-01-252-0/+10
| | | | | | | | | | | 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-251-4/+4
| | | | | | | | .. 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-251-8/+1
| | | | | | | | 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-241-2/+4
| | | | 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-191-7/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* apr_thread: Allocate the apr_thread_t struct on the thread's pool.Yann Ylavic2022-01-191-20/+21
| | | | | | | | | | | | | | | | 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-181-51/+28
| | | | | | | | | | | | | | | | | | | | | | | | 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_thread: use unmanaged pools for detached threads.Yann Ylavic2020-12-031-2/+41
| | | | | | | | | | | | | | | | 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-031-3/+14
| | | | | | | | | | | | | | 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
* API/ABI change, drop return value of apr_thread_exit() which hasJoe Orton2019-07-031-2/+1
| | | | | | | | | | | | 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: https://svn.apache.org/repos/asf/apr/apr/trunk@1862446 13f79535-47bb-0310-9956-ffa450edef68
* stop using deprecated versions of APR_FOPEN_* and APR_FPROT_*Jeff Trawick2014-01-181-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1559343 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_pool_owner_set function to allow use of pool debugging with threadsStefan Fritsch2013-03-231-0/+1
| | | | | | | | | | | | | | 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: https://svn.apache.org/repos/asf/apr/apr/trunk@1460182 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Clean up a thread's pool when it terminates.Brian Havard2010-04-211-0/+2
| | | | git-svn-id: https://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 beenBrian Havard2010-04-023-5/+5
| | | | | | | superceded by the more general APR_FROM_OS_ERROR. git-svn-id: https://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 definingBrian Havard2010-03-301-0/+1
| | | | | | | SIGPROCMASK_SETS_THREAD_MASK. It also happens to be true. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@929139 13f79535-47bb-0310-9956-ffa450edef68
* * We need to disable inheritance in the case of success like in theRuediger Pluem2009-06-111-1/+1
| | | | | | | | cases for stdout and stdin. Fixes the same issue fixed for unix in r783398 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@783722 13f79535-47bb-0310-9956-ffa450edef68
* Remove simple ipc because of -1Mladen Turk2009-02-241-20/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@747357 13f79535-47bb-0310-9956-ffa450edef68
* Remove ipc init from apr_initialize.Mladen Turk2009-02-231-5/+0
| | | | | | | 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: https://svn.apache.org/repos/asf/apr/apr/trunk@747042 13f79535-47bb-0310-9956-ffa450edef68
* Add simple parent/child data exchange for APR processesMladen Turk2009-02-211-0/+25
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@746589 13f79535-47bb-0310-9956-ffa450edef68
* Add object perms set macros and implement them for shm and mutexMladen Turk2009-02-071-0/+8
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@741862 13f79535-47bb-0310-9956-ffa450edef68
* Fix mismatch, using child_err when dealing with stdout.Brian Havard2007-10-311-1/+1
| | | | git-svn-id: https://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.Brian Havard2007-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: https://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.Brian Havard2007-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: https://svn.apache.org/repos/asf/apr/apr/trunk@590037 13f79535-47bb-0310-9956-ffa450edef68
* Backport the std handling improvements to Netware, OS2, BeOS.William A. Rowe Jr2007-10-151-102/+138
| | | | | | | | | | | | | | | | | | | | | 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
* * Remove unnecessary assignment of pool attribute.Ruediger Pluem2007-10-131-1/+0
| | | | | | | | 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
* Fix the typo.Joe Orton2006-08-033-3/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428317 13f79535-47bb-0310-9956-ffa450edef68
* Update license header.Joe Orton2006-08-033-18/+18
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428313 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: Fix crash in apr_proc_create with non-shell type process creation whereBrian Havard2005-07-031-1/+2
| | | | | | | | | the .exe extension is not given. Was trying to close an apr_file_t that had failed to open, causing a segfault. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@208879 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright year to 2005 and standardize on current copyright owner line.Justin Erenkrantz2005-02-043-3/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@151412 13f79535-47bb-0310-9956-ffa450edef68
* Added apr_procattr_user_set and apr_procattr_group_set to allow setting ↵Mladen Turk2005-01-161-0/+13
| | | | | | uid/gid for newly created processes using apr_proc_create. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@125349 13f79535-47bb-0310-9956-ffa450edef68
* Remove .cvsignore files.Joe Orton2004-11-181-4/+0
| | | | | | | Tipped-of-by: Uwe Zeisberger git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@76269 13f79535-47bb-0310-9956-ffa450edef68
* Remove threadcancel.c which was somehow ressurected by the CVS->SVN conversion.Brian Havard2004-11-141-85/+0
| | | | | | | | | Looks like CVS is dodgy as its log shows that it was modified after deletion but a checkout doesn't get it and it's in the Attic. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65576 13f79535-47bb-0310-9956-ffa450edef68
* Add command type APR_SHELLCMD_ENV for creating a processJeff Trawick2004-06-231-1/+3
| | | | | | | | | | | | | | | which is started by the shell and which inherits the parent's environment variables. The immediate use for this is with Apache httpd's piped loggers, correcting a regression since 1.3. In general, applications starting child processes often want the child to run with the same environment variables, so this plugs a hole in the API. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65213 13f79535-47bb-0310-9956-ffa450edef68
* Added new APR API to load child process in current or new address space ↵Jean-Jacques Clar2004-06-141-0/+7
| | | | | | | | | | (NetWare ONLY). Replaced changes that added APR_PROGRAM_ADDRSPACE committed 6/11/04. Reviewed by Brad Nicholes git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65196 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_threadattr_guardsize_set function, which allows changingJoe Orton2004-06-101-0/+6
| | | | | | | | | | | | | | | | | | | the thread guard area size attribute for newly created threads. * configure.in: Check for pthread_attr_setguardsize. * include/apr_thread_proc.h (apr_threadattr_guardsize_set): Add prototype. * threadproc/unix/thread.c (apr_threadattr_guardsize_set): Add function. * threadproc/os2/thread.c, threadproc/win32/thread.c, threadproc/beos/thread.c, threadproc/netware/thread.c (apr_threadattr_guardsize_set): Add ENOTIMPL stubs. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65179 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_threadattr_stacksize_set() for overriding the defaultJeff Trawick2004-03-011-2/+10
| | | | | | | | | stack size for threads created by apr_thread_create(). This is currently a not-implemented stub for BeOS. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64934 13f79535-47bb-0310-9956-ffa450edef68
* Relicense APR under Apache License, Version 2.0Justin Erenkrantz2004-02-133-147/+30
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64904 13f79535-47bb-0310-9956-ffa450edef68
* First whack at switching to a single top-level make. This adds a dependencyGreg Stein2004-02-051-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | upon Python at packaging time, but not at end-user config/build time. As far as I can tell, the build continues to function properly. (out-of-dir config/make not tested, and apr-iconv prolly needs some work) The buildconf scripts now generate a build-outputs.mk file which is included by the root's Makefile (via the build/gen-build.py script). bulid-outputs.mk specifies all of the various files present in the distribution. The top-level Makefiles were simplified to use an $(OBJECTS) symbol rather than 'find'ing them. Similarly, a $(HEADERS) symbol is used for the exports. The corresponding delete-* targets were eliminated since we have a precise set of inputs. The subdirs' Makefiles were removed since they are no longer called/used. The apr-util/uri Makefile was responsible for compiling a C program to generate the uri_delims.h file. That process was replaced by a Python script to generate the header (called by buildconf). The .c and .dsp were left for the Windows build to continue, but that should be revamped. build/apr_rules.mk was revamped somewhat to avoid recursion, but a lot of cleanup is still needed. Much of the recursive/local/x- logic is no longer needed and can be elimianated. rules.mk was created for inclusion by N makefiles, but that isn't really true any more, so it could probably be tossed (caveat: test/Makefile). Saved for a phase 2. Some additional work was added to properly clean up files in */build/, rather than relying on a makefile in there. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64891 13f79535-47bb-0310-9956-ffa450edef68
* OS/2: when parsing #! line, adjust for the fact that apr_file_gets() noBrian Havard2003-03-311-2/+7
| | | | | | | longer removes CR characters. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64464 13f79535-47bb-0310-9956-ffa450edef68
* We don't guard against NULL args.William A. Rowe Jr2003-02-241-7/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64375 13f79535-47bb-0310-9956-ffa450edef68
* add apr_procattr_error_check_set() for telling apr_proc_create() toJeff Trawick2003-02-071-0/+9
| | | | | | | | try to anticipate any errors that might occur after fork() (no-op everywhere but Unix) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64341 13f79535-47bb-0310-9956-ffa450edef68
* Allow apr_proc_create() to call an app-provided error reportingJeff Trawick2003-02-061-0/+9
| | | | | | | | | | function when apr_proc_create() fails in the new child process after fork(). The app-provided error reporting function will only be called on platforms where apr_proc_create() first calls fork() to create the new process. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64330 13f79535-47bb-0310-9956-ffa450edef68
* rename apr_arch_fileio.h to apr_arch_file_io.h for consistencyThom May2003-01-073-3/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64275 13f79535-47bb-0310-9956-ffa450edef68