summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
Commit message (Collapse)AuthorAgeFilesLines
...
* Avoid garbage bits in c_flags by direct assigning value.davidxu2003-09-141-1/+1
| | | | Reviewed by: deischen
* If user is seting scope process flag, clear PTHREAD_SCOPE_SYSTEM bitdavidxu2003-09-141-2/+4
| | | | | | accordingly. Reviewed by: deischen
* Check invalid parameter and return EINVAL.davidxu2003-09-141-0/+3
| | | | Reviewed by: deischen
* Get rid of duplicates.ru2003-09-141-1/+1
|
* Original pthread_once code has memory leak if pthread_once_t is used indavidxu2003-09-092-9/+52
| | | | | | | | | | | | | | | a shared library or any other dyanmic allocated data block, once pthread_once_t is initialized, a mutex is allocated, if we unload the shared library or free those data block, then there is no way to deallocate the mutex, result is memory leak. To fix this problem, we don't use mutex field in pthread_once_t, instead, we use its state field and an internal mutex and conditional variable in libkse to do any synchronization, we introduce a third state IN_PROGRESS to wait if another thread is already in invoking init_routine(). Also while I am here, make pthread_once() conformed to pthread cancellation point specification. Reviewed by: deischen
* Add code to support pthread spin lock.davidxu2003-09-094-0/+171
| | | | Reviewed by: deischen
* mdoc(7): Use the new feature of the .In macro.ru2003-09-081-1/+1
|
* Add small piece of code to support pthread_rwlock_timedrdlock anddavidxu2003-09-062-8/+47
| | | | pthread_rwlock_timedrwlock.
* The caller is expected to set up PIC register corectly beforekan2003-09-051-0/+2
| | | | | jumping to .cerror. This means .cerror has to be present in the same module with its consumers, or bad things will happen.
* Add code to support barrier synchronous object and implementdavidxu2003-09-047-6/+363
| | | | | | pthread_mutex_timedlock(). Reviewed by: deischen
* Remove repeated macro THR_IN_CONDQ.davidxu2003-09-041-1/+0
|
* Allow hooks registered by atexit() to run with current thread pointer set,davidxu2003-09-041-1/+4
| | | | without this change, my atexit test dumps core.
* Don't assume sizeof(long) = sizeof(int) on x86; use intdeischen2003-09-0313-21/+63
| | | | | | | | | | | | instead of long types for low-level locks. Add prototypes for some internal libc functions that are wrapped by the library as cancellation points. Add memory barriers to alpha atomic swap functions (submitted by davidxu). Requested by: bde
* Move kse_wakeup_multi call to just before KSE_SCHED_UNLOCK.davidxu2003-09-031-4/+2
| | | | Tested on: SMP
* Rethink the way thr_libc.So is generated. Relying on GCC to extractkan2003-09-022-10/+32
| | | | | | only needed symbols from libc_pic is not working on sparc64. Requested by: jake
* Allow the concurrency level to be reduced.deischen2003-08-303-35/+63
| | | | Reviewed by: davidxu
* Repost masked signal to kernel for scope system thread, it hardly happensdavidxu2003-08-211-6/+25
| | | | | | in real world. Reviewed by: deischen
* _thr_sig_check_pending is also called by scope system thread when it leavesdavidxu2003-08-201-0/+3
| | | | | | | | | critical region, we wrap some syscalls for thread cancellation point, and when syscalls returns, we call _thr_leave_cancellation_point, at the time if a signal comes in, it would be buffered, and when the thread leaves _thr_leave_cancellation_point, buffered signals will be processed, to avoid messing up normal syscall errno, we should save and restore errno around signal handling code.
* Add back a loop for up to PTHREAD_DESTRUCTOR_ITERATIONS todeischen2003-08-201-12/+20
| | | | | | | destroy thread-specific data. Display a warning when thread specific data remains after PTHREAD_DESTRUCTOR_ITERATIONS. Reviewed by: davidxu
* Support printing 64 bits pointer and long integer.davidxu2003-08-191-10/+27
| | | | Reviewed by: deischen
* Save and restore errno around sigprocmask.davidxu2003-08-191-1/+5
|
* Direct call exit if thread was never created. This makes it safe to calldavidxu2003-08-181-0/+2
| | | | | | pthread_exit in main() without creating any thread. Tessted by: deischen
* Treat initial thread as scope system thread when KSE mode is not activateddavidxu2003-08-1812-81/+47
| | | | | | | | | yet, so we can protect some locking code from being interrupted by signal handling. When KSE mode is turned on, reset the thread flag to scope process except we are running in 1:1 mode which we needn't turn it off. Also remove some unused member variables in structure kse. Tested by: deischen
* If threaded mode is not turned on yet, direct call __sys_sched_yield.davidxu2003-08-161-2/+3
|
* Keep initial kse and kse group just like we keep initial thread,davidxu2003-08-161-9/+11
| | | | | | Don't free them, so some code can still reference them. Reviewed by: deischen
* Access user provided pointer out of lock, and also check the case whendavidxu2003-08-161-8/+10
| | | | a key is less than 0.
* Don't run verify directly as that would require the perl script tomarcel2003-08-131-3/+4
| | | | | | have execute permissions. Run "perl verify" instead. Replace all occurences of the hardcoding of ./verify with $(VERIFY) to allow it to be overridden as well.
* Always set tcb for bound thread, and switch tcb for M:N thread at correctdavidxu2003-08-131-7/+18
| | | | time.
* Don't forget to set kcb_self.davidxu2003-08-121-0/+1
|
* Correctly set current tcb. This fixes some IA64/KSE problems.davidxu2003-08-121-17/+11
| | | | Reviewed by: deischen, julian
* Add some quick pathes to exit process when signal action is default anddavidxu2003-08-101-0/+21
| | | | | | signal can causes process to exit. Reviewed by: deischen
* Initialize rtld lock just before turning on thread mode anddavidxu2003-08-103-35/+37
| | | | uninitialize rtld lock after thread mode shutdown.
* If thread mode is not activated yet, just call __sys_fork() directly,davidxu2003-08-101-1/+22
| | | | | | | | otherwise masks all signals until fork() returns, in child process, we reset library state before restoring signal masks until we reach a safe to point. Reviewed by: deischen
* Tweak rtld lock to allow recursive on reader lock and detect recursivedavidxu2003-08-101-10/+67
| | | | | | on writer lock. This is first cut at rwlock for rtld. Submitted by: desichen
* If thread mode is not activated yet, don't do extra work.davidxu2003-08-101-0/+4
| | | | Reviewed by: deischen
* Add alpha support to libpthread. It compiles but hasn't been tested;deischen2003-08-096-1/+761
| | | | | | there is still some missing kernel support. Reviewed by: marcel
* o Add code to GC freed KSEs and KSE groupsdavidxu2003-08-081-25/+116
| | | | | | | o Fix a bug in kse_free_unlocked(), kcb_dtor shouldn't be called because the KSE is cached and will be resued in _kse_alloc(). Reviewed by: deischen
* Allow gcc driver to process -r option iself, do not use -Wl,-r tokan2003-08-081-1/+1
| | | | | | | bypass it. Doing otherwise did not allow compiler to detect and disable conflicting options generated from specs. Reported by: jake
* Grok async contexts. When a thread is interrupted and an upcallmarcel2003-08-072-9/+41
| | | | | | | | | | | | | | | | | | | | | happens, the context of the interrupted thread is exported to userland. Unlike most contexts, it will be an async context and we cannot easily use our existing functions to set such a context. To avoid a lot of complexity that may possibly interfere with the common case, we simply let the kernel deal with it. However, we don't use the EPC based syscall path to invoke setcontext(2). No, we use the break-based syscall path. That way the trapframe will be compatible with the context we're trying to restore and we save the kernel a lot of trouble. The kind of trouble we did not want to go though ourselves... However, we also need to set the threads mailbox and there's no syscall to help us out. To avoid creating a new syscall, we use the context itself to pass the information to the kernel so that the kernel can update the mailbox. This involves setting a flag (_MC_FLAGS_KSE_SET_MBOX) and setting ifa (the address) and isr (the value).
* Fix a typo. s/Line/Like/deischen2003-08-061-1/+1
|
* Avoid a level of indirection to get from the thread pointer to themarcel2003-08-062-39/+27
| | | | | | | | | | | TCB. We know that the thread pointer points to &tcb->tcb_tp, so all we have to do is subtract offsetof(struct tcb, tcb_tp) from the thread pointer to get to the TCB. Any reasonably smart compiler will translate accesses to fields in the TCB as negative offsets from TP. In _tcb_set() make sure the fake TCB gets a pointer to the current KCB, just like any other TCB. This fixes a NULL-pointer dereference in _thr_ref_add() when it tried to get the current KSE.
* Don't call kse_set_curthread() when scheduling a new bounddeischen2003-08-061-2/+3
| | | | | | | thread. It should only be called by the current kse and never by a KSE on behalf of another. Submitted by: davidxu
* Fix an off by one error in the number of arguments passed tomarcel2003-08-061-1/+1
| | | | | | makecontext(). We only supply 3, not 4. This is mostly harmless, except that on ia64 the garbage can include NaT bits, resulting in NaT consumption faults.
* Define the static TLS as an array of long double. This will guaranteemarcel2003-08-061-2/+6
| | | | | | | that the TLS is 16-byte aligned, as well as guarantee that the thread pointer is 16-byte aligned as it points to struct ia64_tp. Likewise, struct tcb and struct ksd are also guaranteed to be 16-byte aligned (if they weren't already).
* Use auto LDT allocation for i386.deischen2003-08-051-63/+6
|
* Rethink the MD interfaces for libpthread to account fordeischen2003-08-0520-676/+983
| | | | | | | | | archs that can (or are required to) have per-thread registers. Tested on i386, amd64; marcel is testing on ia64 and will have some follow-up commits. Reviewed by: davidxu
* Define THR_GETCONTEXT and THR_SETCONTEXT in terms of the userlandmarcel2003-08-051-4/+5
| | | | | | | | | context functions. We don't need to enter the kernel anymore. The contexts are compatible (ie a context created by getcontext() can be restored by _ia64_restore_context()). While here, make the use of THR_ALIGNBYTES and THR_ALIGN a no-op. They are going to be removed anyway.
* o In _ia64_save_context() clear the return registers except for r8.marcel2003-08-051-13/+25
| | | | | | | | | | We write 1 for r8 in the context so that _ia64_restore_context() will return with a non-zero value. _ia64_save_context() always return 0. o In _ia64_restore_context(), don't restore the thread pointer. It is not normally part of the context. Also, restore the return registers. We get called for contexts created by getcontext(), which means we have to restore all the syscall return values.
* -15 is incorrect to be used to align stack to 16 bytes, use ~15 instead.davidxu2003-08-021-1/+1
|
* Use FSBase to map kse, GCC generates code which uses %fs to access TLS data.davidxu2003-07-311-4/+4
| | | | Reminded by: marcel
OpenPOWER on IntegriCloud