summaryrefslogtreecommitdiffstats
path: root/lib/librthread (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Change threxit() to take a pointer to a pid_t to zero out from theguenther2009-11-275-102/+43
| | | | | | | | | | kernel so that librthread can detect when a thread is completely done with its stack without need a kqueue. The dying thread moves itself to a GC list, other threads scan the GC list on pthread_create() and pthread_join() and free the stack and handle once the thread's thread id is zeroed. "get it in" deraadt@, tedu@, cheers by others
* pthread_rwlock_wrlock() should increment the count of writers justguenther2009-11-191-4/+3
| | | | | | once and not on every wakeup. ok kurt@
* - bump the majors of libpthread and librthread, as they used to return anjasper2009-10-271-1/+1
| | | | | | aliased ENOTSUP. i should've done this earlier, but missed it. my bad. as discussed with deraadt@ guenther@
* Add f*lockfile() routines to librthreadguenther2009-10-213-3/+311
| | | | ok kurt@
* After forking, the child is single threaded, so tell libc that. Thisguenther2009-10-211-1/+4
| | | | | | is needed to avoid deadlocks in popen() on FILE locking. ok kurt@
* rfork_thread() lacked PIC handling for CERROR, resulting in a text relocationguenther2009-09-271-1/+8
| | | | pointed out by brad, ok djm@
* rfork_thread() lacked PIC handling for CERROR, resulting in a text relocationguenther2009-09-241-1/+6
| | | | ok kettenis@, art@
* A much better atomic lock routine.miod2009-06-011-27/+10
|
* Correct the _atomic_lock() asm so that gcc accepts the constraintsguenther2009-06-011-4/+4
| | | | | | when compiling without optimization; fix copied from the kernel's atomic.h ok miod@
* Increase default thread stack size to 256K on 32bit archs and 512K onkurt2009-04-211-2/+6
| | | | | 64bit archs to accommodate the growing number of ports that put large buffers on the stack. Supported by many with no objections.
* thrsigdivert() takes a sigset_t, not a pointer to one. Detected byguenther2009-02-202-4/+4
| | | | | | finally reading the lint warnings (sigh) ok tedu@
* apparently all the other libraries get linted, so I'll just have to live with ittedu2009-02-201-2/+2
|
* Fix a race in the reaper discovered by Tobias Ulmer. kevents are identified by pid,tedu2009-02-201-2/+3
| | | | | | | | so in the event that two threads get the same pid in a row, as the second is dying it will update (not add) the kevent for the previous thread with its own stack, which it will then unmap soon after, which is bad. Doing the reaping first guarantees that there are no kevents with the same pid as the exiting thread when it registers itself. ok guenther kurt
* the lint warnings are more annoying than anything else. we already have a full set of warnings from the compilertedu2009-02-201-2/+2
|
* these are public domain, verified with author; spotted by jjderaadt2009-02-151-1/+4
|
* use calloc() instead of malloc() and memset()kevlo2008-10-134-26/+15
| | | | "look good" tedu@
* Make sigwait() work correctly. In particular, it'll work when theguenther2008-10-032-40/+8
| | | | | | | | | | | | | signal is already pending in the calling thread or the main thread and there's no longer a race condition where the signal could be diverted but sigwait() would still block. There were some off-by-one errors too. (The checking of the main thread's pending list is just until a pending list for the process can be added to struct process. For now, such signals end up as pending on the main thread.) oks tedu@ and art@
* the license on this is PD; david leonard says soderaadt2008-10-023-3/+9
|
* Assert my copyright on files I gave to d@ back in 1998.drahn2008-10-011-2/+18
|
* Match libpthread's behavior and make pthread_join(NULL, whatever) failguenther2008-08-141-2/+4
| | | | | | | instead of crashing ok kurt@ first observed by Jung <moorang at gmail.com>
* Fix 5771/library: in pthread_exit(), delay the call to _sem_post() thatguenther2008-08-141-4/+4
| | | | | | | | | unblocks the pthread_join() for this thread until the exiting thread is completely done with its thread structure, as the joining thread will free it once unblocked. Also, don't bother to call _sem_post() if the thread is detached. ok kurt@
* If the initial thread calls pthread_exit(), don't overwrite its threadguenther2008-08-141-3/+5
| | | | | structure, as the 'tid' member there is used by other parts of librthread to determine whether the current thread is the initial thread
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
* remove _MALLOC_LOCK_INIT; major bump; ok deraadt@otto2008-06-132-7/+2
|
* - Add fork/vfork wrapper functions to reset state in the child process.kurt2008-06-054-21/+208
| | | | | | | | | | | - Make an effort to protect important libc and ld.so critical areas during the fork(2)/vfork(2) sys call. - Add pthread_atfork(3) implementation based on Daniel Eischen's code. Original diff by Philip Guenther <guenther at gmail.com> with some additions and refinements by me. Positive test report from brad@ with many kde apps. fork(2) and pthread_atfork(3) pthread regresses pass. okay tedu@, kettenis@, marc@
* Use _C_LABEL when appropriate.miod2008-05-211-2/+2
|
* Return the proper values upon failure per POSIX for pthread_sigmask(3) andkurt2008-04-241-2/+2
| | | | | | | sigprocmask(2) in threaded programs. From Philip Guenther <guenther at sendmail.com> via PR library/5795. okay marc@
* fix rwlocks to work with the "initialized" form, from Philip Guenthertedu2008-02-221-3/+45
|
* - add missing libc locking functions for _thread_atexit_lock() andkurt2008-01-231-1/+18
| | | | _thread_atexit_unlock(). okay tedu@
* - make arc4random*() functions thread safe. Use a custom spinlock functionkurt2008-01-011-1/+18
| | | | | | | | | | | instead of the generic pthread macros since free(3) uses __arc4_getbyte() when freeing small sized allocations and the generic pthread macros call malloc(3). - eliminate passing pointers to a static variable with global scope (rs) for additional code clarity and reduction. - shlib minor bumps for libc and libpthread due to new functions. From andreas@ with some bits from me. okay tedu@ marc@ w/some spot checking from millert@
* Report the correct stack size and top for the primordial thread inkurt2007-07-081-16/+21
| | | | pthread_stackseg_np(). With input and okay marc@
* _FD_LOCK/UNLOCK() is libpthread specific and not needed for librthread, sokurt2007-06-052-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | isolate its usage to libpthread only and replace with generic non-static mutex support in the one place it is needed: - remove _FD_LOCK/UNLOCK from lseek and ftruncate in libc and make the functions weak so that libpthread can override with its own new versions that do the locking. - remove _thread_fd_lock/unlock() weak functions from libc and adjust libpthread for the change. - add generic _thread_mutex_lock/unlock/destroy() weak functions in libc to support non-static mutexes in libc and add libpthread and librthread implementations for them. libc can utilize non-static mutexes via the new _MUTEX_LOCK/UNLOCK/DESTROY() macros. Actually these new macros can support both static and non-static mutexes but currently only using them for non-static. - make opendir/closedir/readdir/readdir_r/seekdir/telldir() thread-safe for both thread libraries by using a non-static mutex in the struct _dirdesc (typedef DIR), utilizing it in the *dir functions and remove remaining and incorrect _FD_LOCK/UNLOCK() use in libc. - add comments to both thread libraries to indicate libc depends on the current implementation of static mutex initialization. suggested by marc@ - major bump libc and libpthread due to function removal, structure change and weak symbol conversions. okay marc@, tedu@
* protect against races while initializing static mutexes. okay marc@ tedu@kurt2007-05-251-6/+13
|
* Register the locking hooks with ld.so.art2007-05-181-1/+45
| | | | drahn@ ok (long time ago)
* when kevent fails, the errno is a lot more interesting to print than -1tedu2007-04-101-5/+7
|
* new lines in error messagestedu2007-04-101-3/+3
|
* rfork sh bits.miod2007-03-242-0/+121
|
* two comment typos from tberttedu2006-10-272-4/+194
|
* make rthreads compile againhenning2006-04-121-2/+2
| | | | pthreads header changed, char * -> const char *
* When suspending, check the tid of the arg, not of ourselves, dohotto2006-01-061-2/+2
|
* Initialize thread debug in _rthread_init. The debug verbositymarc2006-01-061-1/+3
| | | | | can be set in the environment using RTHREAD_DEBUG. ok, tedu@
* guess it's time to remove the init printf; sturm found a port thattedu2006-01-061-3/+1
| | | | didn't like it.
* Use the system include <spinlock.h> to get the proper functionmarc2006-01-0511-22/+22
| | | | prototype for _atomic_lock
* In pthread_join(), check if we create a deadlock trying to joinotto2006-01-051-7/+9
| | | | with ourself and only free thread after a succesful join. ok marc@
* Fixup stack, it needs 16 bytes headroom. Help from miod@ and drahn.otto2006-01-051-2/+2
| | | | ok drahn@
* Remove redundant mprotect() calls (we're unmapping the region anyway)otto2006-01-052-7/+13
| | | | and check user stack for proper alignment. ok tedu@ marc@
* move malloc lock to libc interface filetedu2006-01-052-24/+24
|
* add -Wstrict-prototypes -Wmissing-prototypes -Wsign-comparemarc2006-01-056-16/+157
| | | | | | Minor tweaks to compile with the above, primarily in fixing the conflicts between semaphore.h and rthread.h "i like the additional warnings" tedu@
* Cleanup struct pthread and stack after thread exits. This version doesotto2006-01-044-23/+148
| | | | not use a separate reaper thread. ok tedu@ marc@
* allow threads to be created in a detached statemarc2006-01-042-9/+22
| | | | | do not allow a join to a detached thread "it looks good" otto@