summaryrefslogtreecommitdiff
path: root/lib/librthread
AgeCommit message (Collapse)Author
2010-12-03Sync with amd64, to allow this to compile without warnings with gcc4:Miod Vallat
``Correct the _atomic_lock() asm so that gcc accepts the constraints when compiling without optimization; fix copied from the kernel's atomic.h'' spotted by jim@
2010-05-26If the stack size attribute isn't larger than the guard-page sizePhilip Guenthe
attribute then make pthread_create() return EINVAL instead of whatever was in errno on entry (possibly making it appear it succeeded when it really failed). Encountered by Jung (moorang at gmail.com).
2010-04-12New functions: bump the minorPhilip Guenthe
2010-04-12Add pthread_rwlock_timed{rd,wr}lock().Philip Guenthe
Avoid missed wakeups in pthread_rwlock_{rd,wr}lock() by linking the spinlocks. ok tedu@
2010-02-03Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependentMiod Vallat
files or directories when applicable. The inspiration and name of MACHINE_CPU come from NetBSD, although the way to provide it to Makefiles is completely different. ok kettenis@
2009-11-28This might not be necessary, but Just In Case: since the underlyingPhilip Guenthe
syscall ABI has changed and everything is going to need to be relinked anyway, bump the rthread major
2009-11-27Convert thrsleep() to an absolute timeout with clockid to eliminate aPhilip Guenthe
race condition and prep for later support of pthread_condattr_setclock() "get it in" deraadt@, tedu@, cheers by others
2009-11-27Convert thrsigdivert to (almost) be sigtimedwait by adding siginfo_tPhilip Guenthe
and struct timespec * argument. sigtimedwait is just a one line wrapper after this. "get it in" deraadt@, tedu@, cheers by others
2009-11-27Change threxit() to take a pointer to a pid_t to zero out from thePhilip Guenthe
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
2009-11-19pthread_rwlock_wrlock() should increment the count of writers justPhilip Guenthe
once and not on every wakeup. ok kurt@
2009-10-27- bump the majors of libpthread and librthread, as they used to return anJasper Lievisse Adriaanse
aliased ENOTSUP. i should've done this earlier, but missed it. my bad. as discussed with deraadt@ guenther@
2009-10-21Add f*lockfile() routines to librthreadPhilip Guenthe
ok kurt@
2009-10-21After forking, the child is single threaded, so tell libc that. ThisPhilip Guenthe
is needed to avoid deadlocks in popen() on FILE locking. ok kurt@
2009-09-27rfork_thread() lacked PIC handling for CERROR, resulting in a text relocationPhilip Guenthe
pointed out by brad, ok djm@
2009-09-24rfork_thread() lacked PIC handling for CERROR, resulting in a text relocationPhilip Guenthe
ok kettenis@, art@
2009-06-01A much better atomic lock routine.Miod Vallat
2009-06-01Correct the _atomic_lock() asm so that gcc accepts the constraintsPhilip Guenthe
when compiling without optimization; fix copied from the kernel's atomic.h ok miod@
2009-04-21Increase default thread stack size to 256K on 32bit archs and 512K onKurt Miller
64bit archs to accommodate the growing number of ports that put large buffers on the stack. Supported by many with no objections.
2009-02-20thrsigdivert() takes a sigset_t, not a pointer to one. Detected byPhilip Guenthe
finally reading the lint warnings (sigh) ok tedu@
2009-02-20apparently all the other libraries get linted, so I'll just have to live with itTed Unangst
2009-02-20Fix a race in the reaper discovered by Tobias Ulmer. kevents are identified ↵Ted Unangst
by pid, 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
2009-02-20the lint warnings are more annoying than anything else. we already have a ↵Ted Unangst
full set of warnings from the compiler
2009-02-15these are public domain, verified with author; spotted by jjTheo de Raadt
2008-10-13use calloc() instead of malloc() and memset()Kevin Lo
"look good" tedu@
2008-10-03Make sigwait() work correctly. In particular, it'll work when thePhilip Guenthe
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@
2008-10-02the license on this is PD; david leonard says soTheo de Raadt
2008-10-01Assert my copyright on files I gave to d@ back in 1998.Dale Rahn
2008-08-14Match libpthread's behavior and make pthread_join(NULL, whatever) failPhilip Guenthe
instead of crashing ok kurt@ first observed by Jung <moorang at gmail.com>
2008-08-14Fix 5771/library: in pthread_exit(), delay the call to _sem_post() thatPhilip Guenthe
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@
2008-08-14If the initial thread calls pthread_exit(), don't overwrite its threadPhilip Guenthe
structure, as the 'tid' member there is used by other parts of librthread to determine whether the current thread is the initial thread
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
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@
2008-06-13remove _MALLOC_LOCK_INIT; major bump; ok deraadt@Otto Moerbeek
2008-06-05- Add fork/vfork wrapper functions to reset state in the child process.Kurt Miller
- 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@
2008-05-21Use _C_LABEL when appropriate.Miod Vallat
2008-04-24Return the proper values upon failure per POSIX for pthread_sigmask(3) andKurt Miller
sigprocmask(2) in threaded programs. From Philip Guenther <guenther at sendmail.com> via PR library/5795. okay marc@
2008-02-22fix rwlocks to work with the "initialized" form, from Philip GuentherTed Unangst
2008-01-23- add missing libc locking functions for _thread_atexit_lock() andKurt Miller
_thread_atexit_unlock(). okay tedu@
2008-01-01- make arc4random*() functions thread safe. Use a custom spinlock functionKurt Miller
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@
2007-07-08Report the correct stack size and top for the primordial thread inKurt Miller
pthread_stackseg_np(). With input and okay marc@
2007-06-05_FD_LOCK/UNLOCK() is libpthread specific and not needed for librthread, soKurt Miller
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@
2007-05-25protect against races while initializing static mutexes. okay marc@ tedu@Kurt Miller
2007-05-18Register the locking hooks with ld.so.Artur Grabowski
drahn@ ok (long time ago)
2007-04-10when kevent fails, the errno is a lot more interesting to print than -1Ted Unangst
2007-04-10new lines in error messagesTed Unangst
2007-03-24rfork sh bits.Miod Vallat
2006-10-27two comment typos from tbertTed Unangst
2006-04-12make rthreads compile againHenning Brauer
pthreads header changed, char * -> const char *
2006-01-06When suspending, check the tid of the arg, not of ourselves, dohOtto Moerbeek
2006-01-06Initialize thread debug in _rthread_init. The debug verbosityMarco S Hyman
can be set in the environment using RTHREAD_DEBUG. ok, tedu@
2006-01-06guess it's time to remove the init printf; sturm found a port thatTed Unangst
didn't like it.