summaryrefslogtreecommitdiff
path: root/lib/librthread
AgeCommit message (Collapse)Author
2013-12-18Provide a random stackgrap on pthread frames. Use _STACKALIGNBYTES toTheo de Raadt
ensure the frames are aligned correctly. Discussed at length with guenther and kettenis ok kettenis, this is the right first step
2013-12-12Fix static linking of libpthread: have crt0 invoke __init_tcb() if it'sPhilip Guenther
defined and we don't think ld.so has already done the TCB setup. ok and much discussion miod@
2013-12-11revert to return EPERM for sem_init pshared until it really worksTed Unangst
reported by zhuk
2013-12-08Reduce the random name length when sem_init is called with psharedFederico G. Schwindt
following what is recommended for mkstemp. This reduces the number of calls to sched_yield considerably. tedu@ ok.
2013-11-29Don't try to reuse _initial_thread in the fork() wrapper, as thePhilip Guenther
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@
2013-11-26Remove unused var and include. Fix errno values as per spec.Federico G. Schwindt
NULL semaphore in sem_close(). Minor cosmetic changes. tedu@ zhuk@ ok
2013-11-22don't use PAGE_SIZE, it is not portable. Ted can polish this afterTheo de Raadt
if he wants, but let us get the tree building.
2013-11-21remove dead assignment as reported by llvm.Federico G. Schwindt
2013-11-21handle the fourth vararg value to sem_openTed Unangst
ok zhuk and presumably fgsch who just sent me a similar diff
2013-11-20shared semaphore fixes. first, eliminate the sem inside a sem indirection.Ted Unangst
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.
2013-11-20oops, forgot about unnamed shared semsTed Unangst
2013-11-20zhuk and i have slightly different styles. unify and consistifyTed Unangst
2013-11-18interprocess semaphores ala sem_open. mostly following in the patternTed Unangst
of shm_open. with some additions and fixes from zhuk.
2013-11-13use sysctl vm.psstrings to calculate stack bounds, rather than USRSTACK.Theo de Raadt
long discussions with guenther, kurt, kettenis etc etc etc
2013-11-02remove unnecessary spinlock that slowed down pthread_getspecific.Ted Unangst
original report and fix provided by John Carr. ok guenther kettenis
2013-10-23In pthread_kill()/pthread_cancel(), hold the target thread's flagsPhilip Guenther
lock across the kill, so that it can't exit (and its tid be reused!) before the kill() discussed with tedu@ marc@
2013-10-04_thread_sys_tcdrain() doesn't exist and isn't usedPhilip Guenther
2013-08-28Following the ARM manuals and cookbooks, ldrex/strex don't have implicitPatrick Wildt
barriers. Therefore it is required to add a memory berrier, so that it is ensured that all observers observed the change. ok rapha@
2013-08-26Use %r27 as the thread control block pointer, allowing for __get_tcb() callsMiod Vallat
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@
2013-08-13Switch time_t, ino_t, clock_t, and struct kevent's ident and dataPhilip Guenther
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@
2013-08-06Remove support for COMPILER_VERSION == gcc2.Miod Vallat
Change the logic depending upon COMPILER_VERSION everywhere, to assume gcc4 is the norm and to explicitely test for gcc3 when a different behaviour is required. No functional change intended. Be sure to `make install' in share/mk before attempting to do anything.
2013-07-30Free the list used for tracking the pthread_{get,set}specific()Philip Guenther
data after calling all the destructors. noted by kettenis@ diff by tedu@
2013-07-30Stop overwriting the dying thread's struct thread as its tid member mayPhilip Guenther
be concurrently updated by __threxit() prompted by a report from Alf Schlichting (a.schlichting (at) lemarit.com) ok kettenis@
2013-07-05ELF_TOOLCHAIN bye bye.Miod Vallat
2013-07-05VAX ELF userland bits. Consists mostly of register prefix additions.Miod Vallat
2013-06-25nmask and omask only used on ELF. Noted by todd@Philip Guenther
2013-06-21The bind lock must only be grabbed with all signals masked.Philip Guenther
backtrace of example case from sthen@ ok kettenis@ millert@
2013-06-21Move the declaration of _thread_sys_sigprocmask() to rthread.hPhilip Guenther
2013-06-17Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,Philip Guenther
including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and {clock,pthread}_getcpuclockid() functions. Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@ ok matthew@
2013-06-04fix typo in commentMiod Vallat
2013-06-03unbreakMiod Vallat
2013-06-03Despite tedu's efforts, fix ERRNOPTR_OFFSET which has changed due to recentMiod Vallat
struct pthread layout change.
2013-06-03THE MACHINE DEPENDENT CERROR CODE HAS HARD CODED OFFSETS INTO PTHREAD_T!Ted Unangst
found the hard way by miod. resize and realign all the locks and semaphores back to the way they were. sometimes i just can't win.
2013-06-02Make arm compile again. -mojMats O Jansson
2013-06-01something's not quite right yet. ticket locks result in more CPU usageTed Unangst
and spinning in kernel. partially back out, but in a way that makes going forward again easy. seen by ajacoutot
2013-06-01cleanup and consolidate the spinlock_lock (what a name!) code.Ted Unangst
it's now atomic_lock to better reflect its usage, and librthread now features a new spinlock that's really a ticket lock. thrlseep can handle both types of lock via a flag in the clock arg. (temp back compat hack) remove some old stuff that's accumulated along the way and no longer used. some feedback from dlg, who is concerned with all things ticket lock. (you need to boot a new kernel before installing librthread)
2013-06-01fix wrong fn name in debugTed Unangst
2013-06-01Add utrace(2), a system call allowing for userland to send its own ktraceMiod Vallat
records. From FreeBSD via otto@, with tweaks suggested by guenther@. Commite on behalf of otto@ who is not around, to ride the libc minor bump. Causes a librthread minor bump as well (new syscall).
2013-05-06If the lock is contended, such that the 'sc' fails, then we need toPhilip Guenther
reset the %2 register with _SPINLOCK_LOCKED before retrying. tobiasu@ hit the problem and figured out that ".set noreorder" is needed in the ASM
2013-04-29Extend P_SIGSUSPEND handling in userret() to properly restore theMatthew Dempsky
sigmask even if there are no pending signals under the temporary sigmask. Refactor existing select() and poll() system calls to introduce the pselect() and ppoll() system calls. Add rthread wrappers for pselect() and ppoll(). While there, update cancellation point comments to reflect recent fdatasync() addition. Minor bumps for libc and librthread due to new symbols. ok guenther, millert, deraadt, jmc
2013-04-06remove more references to kern.rthreads sysctl.Ted Unangst
many thanks to jmc for noticing
2013-04-06fix race when exiting a detached thread. observed by and ok guentherTed Unangst
2013-03-31- Don't include guard pages in the stack size.Kurt Miller
From Christian Schulte (cs at schulte.it) - Use stack->sp instead of recalculating it. From guenther@ okay guenther@
2013-03-24SEM_VALUE_MAX belongs in <limits.h> (via sys/syslimits.h)Philip Guenther
struct sem --> struct __sem (doesn't belong in public namespace) Zap pointless _KERNEL tests ok deraadt@
2013-03-21Do not need machine/param.hTheo de Raadt
2013-02-15Revert previous diff: sparc and sparc64 don't set the TCB to NULL in exec, yet,Philip Guenther
and vax doesn't support symbols that are both weak and undefined (yet?). sparc issue diagnosed by kettenis@, vax problem found by todd@
2013-02-14Make libpthread compatible with an ld.so that does TCB allocation:Philip Guenther
if the initial thread already has a TCB then don't override it, and if the _dl_allocate_tls() and _dl_free_tls() symbols exist then use them instead of malloc/free ok kettenis@
2013-02-02Userland bits for m68k/ELF. Mostly addition of register prefixes to theMiod Vallat
assembler instructions, and cope with the few changes in return values location.
2013-01-27Make this PIC-aware.Miod Vallat
2013-01-23ARMv7 doesn't support the atomic SWP instruction anymore. Use the atomicPatrick Wildt
load and store instructions instead. ok miod@