summaryrefslogtreecommitdiffstats
path: root/lib/librthread (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace the malloc spinlock with a mutex. This lock is held over system callskettenis2016-01-273-7/+28
| | | | | | | | | | | | | which run for many cycles and may even sleep. This leads to other threads spinning for a long time waiting on the lock. Using a mutex means those threads go to sleep and get woken up when the lock is released, which results in a lot less CPU usage. More work is needed to improve the performance of threaded code that suffers from malloc lock contention, but this diff makes ports like Firefox significantly more usable. Tested by many. ok mpi@, guenther@, tedu@, jca@
* use geteuid to allow root to communicate with others.tedu2015-12-101-2/+2
| | | | report from Jeunder Yu
* Split the intra-thread functionality from kill(2) into its own syscallguenther2015-11-103-39/+15
| | | | | | | | | | | | thrkill(2), rolling the kill(2) syscall number with the ABI change to avoid breaking binaries during during the transition. thrkill(2) includes a 'tcb' argument that eliminates the need for locking in pthread_kill() and simplifies pthread_cancel(). Switch __stack_smash_handler() to use thrkill(2) and explicitly unblock SIGABRT. Minor bump to both libc and libpthread: make sure you install a new kernel! ok semarie@
* delete old lint ARGSUSED commentsguenther2015-11-012-4/+2
|
* Merge the sigaction() and sigprocmask() overloads/wrappers from libpthreadguenther2015-10-233-42/+4
| | | | | | | | | into libc, and move pthread_sigmask() as well (just a trivial wrapper). This provides consistent handling of SIGTHR between single- and multi-threaded programs and is a step in the merge of all the libpthread overloads, providing some ASM and Makefile bits that the other wrappers will need. ok deraadt@ millert@
* ld.so no longer needs or uses a bind lock, so stop setting it. Thisguenther2015-10-183-48/+5
| | | | | eliminates a chunk of complexity from the libpthread init and the fork wrapper, as it was the bind lock that needed prebinding before use.
* Handle F_ISATTY in the fcntl() stub as wellderaadt2015-10-151-1/+2
| | | | ok guenther
* Instead of testing for __ELF__ and/or vax, leave out the bits for interfacingguenther2015-05-194-22/+21
| | | | | | | with ld.so locking whenever building NOPIC pointless use of __ELF__ noted by brad@ ok miod@
* Put the right number of leading underscores in ___cerror and __cerror, formiod2015-05-121-2/+3
| | | | | the sake of libpthread. Probably missed during the a.out->ELF switch, I can't believe this went unnoticed for so long.
* In the child after fork, the dl lock has to be forced as its inner spinlockguenther2015-05-102-11/+18
| | | | | | may have been grabbed by another thread in the parent before the fork problem report from dcoppa@, ok kettenis@
* Delete the duplicated sched_{policy,param} members from the internal structguenther2015-04-293-13/+20
| | | | | | | | pthread and instead use the values from the embedded struct pthread_attr. For bonus points, pay attention to the sched_inherit attribute and possibly set the values from the parent thread. Problem noted by natano of bitrig.
* Make pthread_atfork() track the DSO that called it like atexit() does,guenther2015-04-074-56/+27
| | | | | | | | | | unregistering callbacks if the DSO is unloaded. Move the callback handling from libpthread to libc, though libpthread still overrides the inner call to handle locking and thread-library reinitialization. Major version bump for both libc and libpthread. verification that this fixes various ports ajacoutot@ asm assistance miod@; ok millert@ deraadt@
* Add back <sys/param.h>; it's needed for MACHINE_STACK_GROWS_UP.kettenis2015-01-242-2/+4
| | | | ok millert@, tobiasu@
* Move to the <limits.h> universe.deraadt2015-01-163-6/+4
| | | | review by millert, binary checking process with doug, concept with guenther
* avoid void arithmetic. from david carliertedu2014-12-081-2/+3
|
* Don't restart syscalls on SIGTHR. When a cancellation happens, we need toguenther2014-11-161-2/+1
| | | | | | unroll to the cancellation check ok tedu@
* Don't assume __thrsigdivert() autorestarts on EINTR. This lets us check forguenther2014-11-161-4/+6
| | | | | | cancellation properly when a handled (but not waited for) signal occurs ok tedu@
* accept4() should be a cancellation point.guenther2014-08-312-2/+20
| | | | | | Update the list in the pthread_testcancel(3) manpage: several were missing. noted by miod@
* Declare and document getthrid()guenther2014-08-311-2/+1
| | | | indirectly prodded by krw@
* Only need <stdint.h> and not <inttypes.h> hereguenther2014-08-092-4/+4
|
* zap trailing newlines; "go for it" deraadtokan2014-07-161-2/+1
|
* __tfork_thread is in libc, so move the manpage over tooguenther2014-07-102-147/+1
| | | | ok deraadt@
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-2/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Use a flag on the pthread_t to indicate that the thread's stack wasguenther2014-07-013-9/+9
| | | | | | allocated by the kernel's execve bits. ok matthew@
* Fix mmap() flag usage: explicitly specify MAP_PRIVATE and drop uselessmatthew2014-06-272-4/+5
| | | | | | MAP_FILE and MAP_HASSEMAPHORE flags. Discussed with deraadt, tedu, and kettenis
* Remove unintended statement from my copyright blockguenther2014-06-231-2/+1
|
* - Adjust pthread_stackseg_np to return the page aligned addressable stackkurt2014-05-021-4/+11
| | | | range. okay kettenis@, guenther@, deraadt@
* It's been a quarter century: we can assume volatile is present with that name.guenther2014-04-182-4/+4
|
* Retire hp300, mvme68k and mvme88k ports. These ports have no users, keepingmiod2014-03-182-90/+0
| | | | | | | this hardware alive is becoming increasingly difficult, and I should heed the message sent by the three disks which have died on me over the last few days. Noone sane will mourn these ports anyway. So long, and thanks for the fish.
* lint is dead (long live the lint!), so stop using it as a cpp conditionalguenther2014-03-161-5/+1
| | | | | | (namespace pollution!) or talking about its opinion on code. ok krw@
* Provide a random stackgrap on pthread frames. Use _STACKALIGNBYTES toderaadt2013-12-181-5/+15
| | | | | | ensure the frames are aligned correctly. Discussed at length with guenther and kettenis ok kettenis, this is the right first step
* Fix static linking of libpthread: have crt0 invoke __init_tcb() if it'sguenther2013-12-121-6/+29
| | | | | | defined and we don't think ld.so has already done the TCB setup. ok and much discussion miod@
* revert to return EPERM for sem_init pshared until it really workstedu2013-12-111-4/+10
| | | | reported by zhuk
* Reduce the random name length when sem_init is called with psharedfgsch2013-12-081-2/+2
| | | | | | following what is recommended for mkstemp. This reduces the number of calls to sched_yield considerably. tedu@ ok.
* Don't try to reuse _initial_thread in the fork() wrapper, as theguenther2013-11-294-14/+17
| | | | | | | | | thread's existing handle must continue to be valid and it didn't fully 'change' the thread handle anyway. For pthread_main_np(), use a new flag, THREAD_ORIGINAL, to indicate that the flagged thread is the original thread for *this* process. Fixes some ConsoleKit failures according to aja@
* Remove unused var and include. Fix errno values as per spec.fgsch2013-11-261-44/+37
| | | | | NULL semaphore in sem_close(). Minor cosmetic changes. tedu@ zhuk@ ok
* don't use PAGE_SIZE, it is not portable. Ted can polish this afterderaadt2013-11-221-2/+2
| | | | if he wants, but let us get the tree building.
* remove dead assignment as reported by llvm.fgsch2013-11-211-2/+2
|
* handle the fourth vararg value to sem_opentedu2013-11-211-3/+16
| | | | ok zhuk and presumably fgsch who just sent me a similar diff
* shared semaphore fixes. first, eliminate the sem inside a sem indirection.tedu2013-11-202-44/+55
| | | | | | | it's not needed (mindless holdover from earlier prototype). everything is simpler and sem_init shared semaphores even work now (confirmed by sthen). correct the einval checks to not deref a pointer before the null check. in sem_open, if we created the semaphore, we need to initialize the spinlock.
* oops, forgot about unnamed shared semstedu2013-11-201-1/+4
|
* zhuk and i have slightly different styles. unify and consistifytedu2013-11-201-23/+14
|
* interprocess semaphores ala sem_open. mostly following in the patterntedu2013-11-182-24/+170
| | | | of shm_open. with some additions and fixes from zhuk.
* use sysctl vm.psstrings to calculate stack bounds, rather than USRSTACK.deraadt2013-11-131-18/+31
| | | | long discussions with guenther, kurt, kettenis etc etc etc
* remove unnecessary spinlock that slowed down pthread_getspecific.tedu2013-11-021-4/+2
| | | | original report and fix provided by John Carr. ok guenther kettenis
* In pthread_kill()/pthread_cancel(), hold the target thread's flagsguenther2013-10-231-5/+42
| | | | | | | lock across the kill, so that it can't exit (and its tid be reused!) before the kill() discussed with tedu@ marc@
* _thread_sys_tcdrain() doesn't exist and isn't usedguenther2013-10-041-2/+1
|
* Following the ARM manuals and cookbooks, ldrex/strex don't have implicitpatrick2013-08-281-1/+2
| | | | | | | barriers. Therefore it is required to add a memory berrier, so that it is ensured that all observers observed the change. ok rapha@
* Use %r27 as the thread control block pointer, allowing for __get_tcb() callsmiod2013-08-261-6/+18
| | | | | | | | | | | | | | | | | | | | in libpthread to be optimized away. While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno. Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno(). This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet). Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
* Switch time_t, ino_t, clock_t, and struct kevent's ident and dataguenther2013-08-131-2/+2
| | | | | | | | | | | | | | | | | | | | members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@