summaryrefslogtreecommitdiff
path: root/lib/librthread
AgeCommit message (Collapse)Author
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@
2012-05-06Style nits from Brad.Paul Irofti
2012-05-03Add pthread spinlock support.Paul Irofti
Implementation, documentation and naive regression tests for: - pthread_spin_init() - pthread_spin_destroy() - pthread_spin_lock() - pthread_spin_trylock() - pthread_spin_unlock() Implementation okay guenther@, documentation okay jmc@.
2012-04-23Honor subsystem style.Paul Irofti
`Visual inspection looks ok' kurt@. >From Brad
2012-04-17Remove "#define _POSIX_THREADS" line before include <pthread.h>.Miod Vallat
The latter contains "#define _POSIX_THREADS 1" which makes gcc 2.95 complain.
2012-04-14Add new mutex type, PTHREAD_MUTEX_STRICT_NP which checks for applicationKurt Miller
errors similar to PTHREAD_MUTEX_ERRORCHECK, however upon error it aborts. The rational is that many applications don't check the return values on pthread functions and will miss the errors that ERRORCHECK returns. PTHREAD_MUTEX_STRICT_NP will be our default mutex type for awhile okay guenther@ dcoppa@
2012-04-13Provide _atomic_lock() and __cerror() for hppa64. Makes hppa64 build again.Joel Sing
2012-04-13Use PTHREAD_MUTEX_DEFAULT in static init and mutexattr_init. If theKurt Miller
default mutex type changes to NORMAL, when there is an uninitialized mutex provided to unlock, allow it to succeed similar to an unlocked mutex. For other cases abort instead of segfault. okay guenther@
2012-04-13Per POSIX, PTHREAD_MUTEX_NORMAL type mutexes have undefined behavior forKurt Miller
certain conditions. In the case of unlocking an unlocked mutex we will allow that to succeed, all other undefined behaviors will result in an immediate abort(). okay guenther@
2012-04-13Add sigwaitinfo and sigtimedwait stubs under #if 0; a bit more kernelPhilip Guenthe
support is needed before they can be usefully enabled but I don't want to misplace this diff yet again
2012-04-12remove rfork(); ok guenther miodTheo de Raadt
2012-04-11Minor bump after my previous commit. Noticed by deraadt@.Paul Irofti
2012-04-11Add pthread barrier support.Paul Irofti
Implementation and documentation for: - pthread_barrier_init() - pthread_barrier_destroy() - pthread_barrier_wait() - pthread_barrierattr_init() - pthread_barrierattr_destroy() - pthread_barrierattr_getpshared() - pthread_barrierattr_setpshared() Currently only private barriers are supported. Okay guenther@.
2012-04-10pthread_setcanceltype() shouldn't be a cancelation pointPhilip Guenthe
ok kurt@
2012-04-06Fix typo.Joel Sing
2012-03-22Remove pthread_suspend* and related functions. This is part of theKurt Miller
rthreads major library bump from last night. okay kettenis@
2012-03-22bump majors on libc and rthreads for the additions to libc and transferPhilip Guenthe
of __tfork_thread from rthreads to libc
2012-03-22closefrom() should be a cancellation pointPhilip Guenthe
2012-03-22tfork_thread has been moved to libcPhilip Guenthe
2012-03-22Move __tfork_thread() from rthreads (libpthread) to libc so thatPhilip Guenthe
it can be used for not-strictly-threading purposes ok matthew@ kurt@
2012-03-20Clean up unnecessary prototypes. Pointed out by brad@Philip Guenthe
2012-03-20Permit recursive locking in _rthread_dl_lock(), as an so's destructorPhilip Guenthe
may need to call dlclose(). problem observed by Antti Harri (iku at openbsd.fi), ok kurt@
2012-03-14Force sched_yield() to be resolved before calling dlctl(DL_SET*LCK) withPhilip Guenthe
a function that can call sched_yield(), to avoid recursion ok kurt@ kettenis@
2012-03-13Don't trust the environment if issetugid()Philip Guenthe
2012-03-03Sync the assembly statements with <machine/lock.h> for consistency.Miod Vallat
2012-03-03Bump minor for recent additionsPhilip Guenthe
2012-03-03sem_timedwait() should return ETIMEDOUT instead of EWOULDBLOCK on timeoutPhilip Guenthe
2012-03-03Add sem_timewait() and fix sem_wait()'s handling of signals, soPhilip Guenthe
that it resumes waiting unless the thread was canceled. As part of this, change the internal _sem_wait() function to return zero on success and an errno value on failure instead of 1 on success and zero on failure.
2012-03-02fix check when setting the contention scope. harmless atm but still wrong.Federico G. Schwindt
guenther@ ok.
2012-03-02for readability, put the label on it's own line.Federico G. Schwindt
2012-03-02_SPINLOCK_UNLOCKED isn't zero everywhere (*cough*hppa*cough*), soPhilip Guenthe
sem_init() can't assume that calloc will leave the embedded spinlock in the unlocked state ok miod@ otto@
2012-02-28Our default mutex type is PTHREAD_MUTEX_ERRORCHECK, for which tryingPhilip Guenthe
to unlock an uninitialized mutex is required to return EPERM, so add the necessary checks. For recursive mutexes, return an error from pthread_mutex_lock() if the count would overflow. problem observed in glib testing by aja@
2012-02-27fix __errno symbol nameMiod Vallat
2012-02-26Fix buglets.Miod Vallat
2012-02-26__cerror gets invoked with errno in v0, not a0.Miod Vallat
2012-02-26Fix label for threaded binaries to link.Miod Vallat
2012-02-24sched_yield() is the standard name while pthread_yield() is thePhilip Guenthe
non-standard alias, so prefer the former
2012-02-23PTHREAD_MUTEX_NORMAL mutexes are supposed to self-deadlock, not abort.Philip Guenthe
That deadlock can be exited via a timeout for pthread_mutex_timedlock(). Unwind all the state when pthread_mutex_timedlock() times out