summaryrefslogtreecommitdiffstats
path: root/lib/libkse
Commit message (Collapse)AuthorAgeFilesLines
* Don't panic when sigsuspend is interrupted by a cancellation.deischen2004-12-191-2/+7
| | | | PR: 75273
* Use a generic way to back threads out of wait queues when handlingdeischen2004-12-1816-347/+411
| | | | | | | | | | | | | | | | | | | | | | | | | signals instead of having more intricate knowledge of thread state within signal handling. Simplify signal code because of above (by David Xu). Use macros for libpthread usage of pthread_cleanup_push() and pthread_cleanup_pop(). This removes some instances of malloc() and free() from the semaphore and pthread_once() implementations. When single threaded and forking(), make sure that the current thread's signal mask is inherited by the forked thread. Use private mutexes for libc and libpthread. Signals are deferred while threads hold private mutexes. This fix also breaks www/linuxpluginwrapper; a patch that fixes it is at http://people.freebsd.org/~deischen/kse/linuxpluginwrapper.diff Fix race condition in condition variables where handling a signal (pthread_kill() or kill()) may not see a wakeup (pthread_cond_signal() or pthread_cond_broadcast()). In collaboration with: davidxu
* i386_set_ldt() is not available when running 32 bit binaries on amd64peter2004-11-062-0/+13
| | | | | kernels. Use the recently exposed direct-set routines instead. This is only activated for when we compile i386 support libraries on amd64.
* Cosmetic tweaks to reduce diffs to the i386 counterpart.peter2004-11-061-2/+3
|
* Partial support of KSE for arm.cognet2004-11-054-59/+66
|
* Save cancelflags in signal frame, this fixes a problem thatdavidxu2004-11-012-0/+3
| | | | | | | a thread in pthread_cond_wait handled a signal can no longer be canceled. Reviewed by: deischen
* Make pthread_mutex_trylock(3) return EBUSY on failure, as all softwaregreen2004-10-311-8/+1
| | | | | | | | | packages expect and seems to be most correct according to the slightly- ambiguous standards. MFC after: 1 month Corroborated by: POSIX <http://tinyurl.com/4uvub> Reviewed by: silence on threads@
* For variables that are only checked with defined(), don't provideru2004-10-241-1/+1
| | | | any fake value.
* Check unhandled signals before thread marks itself as DEAD,davidxu2004-10-231-1/+14
| | | | | this reduces chances of signal losting problem found by Peter Holm <peter@holm.cc>
* 1. Move thread list flags into new separate member, and atomicallydavidxu2004-10-235-24/+45
| | | | | | | | | | | put DEAD thread on GC list, this closes a race between pthread_join and thr_cleanup. 2. Introduce a mutex to protect tcb initialization, tls allocation and deallocation code in rtld seems no lock protection or it is broken, under stress testing, memory is corrupted. Reviewed by: deischen patch partly provided by: deischen
* Decrease reference count if we won't use the thread, this avoids memorydavidxu2004-10-211-0/+4
| | | | leak under some cases.
* if system scope thread didn't set timeout, don't call clock_gettime syscalldavidxu2004-10-081-8/+9
| | | | | | before and after sleeping. Reviewed by: deischen
* Use PTHREAD_SCOPE_SYSTEM to decide what should be done.davidxu2004-10-071-3/+2
|
* Follow kernel change, restore signal mask correctly by using a commanddavidxu2004-10-071-21/+17
| | | | of kse_thr_interrupt.
* Allocate red zone and stack space together and then split red zone fromdavidxu2004-10-061-7/+17
| | | | | allocated space, orignal code left red zone unallocated, but those space can be allocated by user code, and result was providing no protection.
* Add a wrapper for execve(). The exec'd process must be started withdeischen2004-09-262-0/+69
| | | | | | | | | | | | | | the signal mask and pending signals of the calling thread. These are stored in userland in libpthread. There is a small race condition in this patch which could cause problems if a signal arrives after setting the (kernel) signal mask and before exec'ing. The thread's set of pending signals also are not yet installed in the exec'd process. Both of these will be corrected with the addition of a special syscall. Reported & Tested by: Joost Bekkers <joost at jodocus dot org> Reviewed by: julian, davidxu
* _tcb_ctor takes two args.cognet2004-09-242-2/+2
|
* Make sure we don't call _thr_start_sig_daemon() when SYSTEM_SCOPE_ONLY is ↵ssouhlal2004-09-241-2/+3
| | | | | | defined. This makes libpthread usable on powerpc. Approved by: grehan (mentor), deischen
* Add missing brackets. It was committed from wrong tree.davidxu2004-08-261-1/+1
|
* gcc -O2 cleanup. tested for a long time.davidxu2004-08-252-4/+4
| | | | Reviewed by: deischen
* Pull debug symbols in for statically linked binary.davidxu2004-08-211-0/+4
| | | | Reviewed by: desichen
* Fix compile, s/tp_dtv/tp_tdv/g.davidxu2004-08-163-3/+3
|
* Bring PPC up to date with latest TLS changes.grehan2004-08-162-3/+3
|
* 1. Add macro DTV_OFFSET to calculate dtv offset in tcb.davidxu2004-08-168-0/+10
| | | | 2. Export symbols needed by debugger.
* Add a file to collection all symbols will be needed by debugger.davidxu2004-08-161-0/+60
|
* Add TLS support for i386 and amd64.dfr2004-08-159-32/+41
|
* As long as we have a knob to force system scope threads, why not havedeischen2004-08-124-8/+13
| | | | | | | | | | | | | a knob to force process scope threads. If the environment variable LIBPTHREAD_PROCESS_SCOPE is set, force all threads to be process scope threads regardless of how the application creates them. If LIBPTHREAD_SYSTEM_SCOPE is set (forcing system scope threads), it overrides LIBPTHREAD_PROCESS_SCOPE. $ # To force system scope threads $ LIBPTHREAD_SYSTEM_SCOPE=anything threaded_app $ # To force process scope threads $ LIBPTHREAD_PROCESS_SCOPE=anything threaded_app
* Check debugger suspending flag for system scope thread.davidxu2004-08-081-3/+7
| | | | Reviewed by: deischen
* Add a way to force 1:1 mode for libpthread. To do this, definedeischen2004-08-075-42/+41
| | | | | | | | | | | LIBPTHREAD_SYSTEM_SCOPE in the environment. You can still force libpthread to be built in strictly 1:1 by adding -DSYSTEM_SCOPE_ONLY to CFLAGS. This is kept for archs that don't yet support M:N mode. Requested by: rwatson Reviewed by: davidxu
* s/TMDF_DONOTRUNUSER/TMDF_SUSPEND/gdavidxu2004-08-033-4/+4
| | | | Dicussed with: deischen
* Save context in kernel fashion, so it can be restored bydavidxu2004-07-311-2/+5
| | | | kse_switchin syscall.
* Remove unused field.davidxu2004-07-311-1/+0
|
* Macro optimize, this increases context switch speed about 2% on mydavidxu2004-07-311-2/+2
| | | | athlon64 machine.
* PPC MD bits for KSE. Runs test cases OK. Crippled to 1:1 mode forgrehan2004-07-198-0/+820
| | | | the time being.
* Don't include lock.h and pthread_md.h when we're being included bymarcel2004-07-181-0/+2
| | | | libthread_db. Both headers are included seperately.
* Copy lwp id to thread mailbox.davidxu2004-07-141-0/+1
|
* Call kse_switchin to switch context when being debugged.davidxu2004-07-134-24/+69
|
* Remove unused symbols.davidxu2004-07-131-14/+0
|
* Let debugger check signal, make SIGINFO works.davidxu2004-07-131-12/+25
|
* If _libkse_debug is not zero, activate thread mode.davidxu2004-07-131-0/+6
|
* Add code to support thread debugging.davidxu2004-07-135-44/+146
| | | | | | | | | | | | | | | 1. Add global varible _libkse_debug, debugger uses the varible to identify libpthread. when the varible is written to non-zero by debugger, libpthread will take some special action at context switch time, it will check TMDF_DOTRUNUSER flags, if a thread has the flags set by debugger, it won't be scheduled, when a thread leaves KSE critical region, thread checks the flag, if it was set, the thread relinquish CPU. 2. Add pq_first_debug to select a thread allowd to run by debugger. 3. Some names prefixed with _thr are renamed to _thread prefix. which is allowed to run by debugger.
* kse_switchin ABI was changed in kernel.davidxu2004-07-121-3/+2
|
* Check pending signals, if there is signal will be unblocked bydavidxu2004-06-124-22/+25
| | | | | | | | | | | | | | | | | | sigsuspend, thread shouldn't wait, in old code, it may be ignored. When a signal handler is invoked in sigsuspend, thread gets two different signal masks, one is in thread structure, sigprocmask() can retrieve it, another is in ucontext which is a third parameter of signal handler, the former is the result of sigsuspend mask ORed with sigaction's sa_mask and current signal, the later is the mask in thread structure before sigsuspend is called. After signal handler is called, the mask in ucontext should be copied into thread structure, and becomes CURRENT signal mask, then sigsuspend returns to user code. Reviewed by: deischen Tested by: Sean McNeil <sean@mcneil.com>
* Avoid clobbering the red zone when running on the new context's stack intjr2004-06-071-0/+5
| | | | _amd64_restore_context().
* Arm bits for libpthread. It has no chances to work and should be consideredcognet2004-05-145-0/+471
| | | | as stubs.
* After forking and initializing the library to single-threadeddeischen2004-04-081-2/+3
| | | | | | | | | | mode (where the forked thread is the one and only thread and is marked as system scope), set the system scope flag before initializing the signal mask. This prevents trying to use internal locks that haven't yet been initialized. Reported by: Dan Nelson <dnelson at allantgroup.com> Reviewed by: davidxu
* Fix a POSIX conformance bug. POSIX says sigwait should return error numberdavidxu2004-03-171-3/+3
| | | | in return value not in errno.
* Fixed a misspelling of 0 as NULL.bde2004-03-141-1/+1
|
* style cleanup: Remove duplicate $FreeBSD$ tags.cperciva2004-02-101-2/+0
| | | | | | | | These files had tags after the copyright notice, inside the comment block (incorrect, removed), and outside the comment block (correct). Approved by: rwatson (mentor)
* Add cancellation point to sem_wait() and sem_timedwait() for pshareddeischen2004-02-061-10/+18
| | | | | | | | semaphores. Also add cancellation cleanup handlers to keep semaphores in a consistent state. Submitted in part by: davidxu Reviewed by: davidxu
OpenPOWER on IntegriCloud