summaryrefslogtreecommitdiff
path: root/lib/librthread
AgeCommit message (Collapse)Author
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@
2013-01-11Add END() directives to the various functions.Miod Vallat
Make the code PIC-aware when necessary (i.e. invoke other functions through the PLT, and access global data through the GOT). No change for non-PIC compilation.
2013-01-05Switch m88k ports to ELF.Miod Vallat
2012-11-22Do not pass -Wmissing-prototypes when building on a non-ELF platform withMiod Vallat
gcc 3 as the compiler. The way constructors are built triggers this warning, which is fatal because of -Werror. ok espie@ guenther@
2012-11-10raise() is now correctly defined in libcPhilip Guenthe
2012-09-12Define empty CDIAGFLAGS for programs that use Werror.Christiano F. Haesbaert
Makes "make build" build with WARNINGS=Yes on amd64. ok espie
2012-08-22We want to check that the dynamic linker is available at run-time, soMatthew Dempsky
we should actually check for _DYNAMIC at run-time rather than checking for __PIC__ at compile time, since the two are actually independent. Problem and solution identified by guenther; minor tweaks by me. ok guenther
2012-08-22Test for __PIC__ instead of PIC in preparation for eliminating -DPICMatthew Dempsky
from bsd.lib.mk for C source files. ok deraadt, pascal
2012-08-22Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure ccPascal Stumpf
invocations. This allows us to use the compiler builtin define __PIC__ to check for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot. ok matthew@, conceptually ok kurt@
2012-08-15A couple small but long anticipated changes:Matthew Dempsky
- Link libpthread.so with -znodlopen. Because libpthread overrides the weak symbols in libc, we can't allow it to be dynamically loaded or else libc's weak symbols might have already been resolved by ld.so. (Also, major bump because this is technically a backwards incompat change in behavior, although dlopen()ing libpthread never really worked.) - Link libc.so with -nodefaultlibs -lgcc. This ensures that libc doesn't try to link against itself (which ld.so wouldn't like). - Change GCC 4 to link shared objects with -lpthread and -lc as appropriate, now that there's no issues with doing so. This means that it's no longer necessary to patch software to use -pthread instead of -lpthread. (Ports tree rejoice!) Also, to preemptively answer this question: No, this does not eliminate the need for LD_PRELOAD=libpthread.so. That's a separate issue that won't be resolved until we eliminate libc's weak symbols. Discussed extensively on email and icb over the past few months. ok deraadt
2012-08-15Oops, on a.out architectures __cerror() is called _cerror(). FixMatthew Dempsky
accordingly so vax can build again. ok deraadt
2012-08-13Add explicit references from rthread.o to all of the weak symbolMatthew Dempsky
overrides provided by libpthread.a. This ensures that statically linked threaded programs use (e.g.) __cerror() from libpthread.a instead of libc.a. (Same idea previously used by libuthread.) Thanks to fgsch@ for pointing out libuthread's solution to the static linking problem. ok guenther@, tedu@;
2012-08-04Fix caching of stacks allocated with the default attributes.Philip Guenthe
based on a diff from Christian Schulte (cs at schulte.it)
2012-08-02remove leftover NOLINT, WANTLINT, LINTFLAGS, LOBJ vars and lint targets.Okan Demirmen
ok guenther@
2012-06-21Update to reflect API changesPhilip Guenthe
2012-06-21__tfork() needs to set the stack address of the new thread in the kernel,Philip Guenthe
so that it can't get a signal while still running on the parent thread's stack. Also, pass in sizeof(struct __tfork) to provide forward compat when more members are added. This is an ABI change, so switch syscall numbers and bump lib majors this time. ok deraadt@ matthew@