Age | Commit message (Collapse) | Author |
|
Not enabled yet, it needs some SPINLOCK_SPIN_HOOK love and
some bumps.
Tested by many including sthen@ in a bulk.
ok visa@, sthen@, kettenis@, tedu@
|
|
ok tedu@
|
|
ok tedu@ mpi@
|
|
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!
Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!
Clean up libpthread's symbol exports like libc.
On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.
Testing by various, particularly sthen@ and patrick@
ok kettenis@
|
|
from Kari Tristan Helgason
|
|
aliases by using a macro REDIRECT_SYSCALL() to map the symbols. Apply
that to getthrid(), sysctl(), and issetugid() as well.
ok mpi@ beck@
|
|
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@
|
|
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@
|
|
eliminates a chunk of complexity from the libpthread init and the fork
wrapper, as it was the bind lock that needed prebinding before use.
|
|
with ld.so locking whenever building NOPIC
pointless use of __ELF__ noted by brad@
ok miod@
|
|
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.
|
|
indirectly prodded by krw@
|
|
allocated by the kernel's execve bits.
ok matthew@
|
|
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@
|
|
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.
|
|
of shm_open. with some additions and fixes from zhuk.
|
|
|
|
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.
|
|
and spinning in kernel. partially back out, but in a way that makes going
forward again easy.
seen by ajacoutot
|
|
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)
|
|
struct sem --> struct __sem (doesn't belong in public namespace)
Zap pointless _KERNEL tests
ok deraadt@
|
|
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
|
|
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@.
|
|
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@.
|
|
rthreads major library bump from last night. okay kettenis@
|
|
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.
|
|
Add pthread_mutex_timedlock(), requested by dcoppa@
|
|
Improve consistency of error naming
|
|
don't try to merge values, round the sizes separately, and don't try to
unmap application-supplied stacks.
Copy from uthread the caching of default-sized stacks.
Have pthread_attr_init() and pthread_create() get the default attributes
from staticly allocated pthread_attr_t.
Cache the pagesize in _rthread_init() and provide a macro for rounding to it
based on suggestions from kettenis@ and tedu@, ok kettenis@
|
|
pthread_mutexattr_{get,set}kind_np()
tweaked diff from brad
|
|
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.
Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().
Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.
|
|
new file rthread_mutexattr.c. Add basic implementations of
pthread_mutexattr_{set,get}{protocol,prioceiling}
Requested by aja
|
|
using previously allocated SIGTHR to interrupt in-process syscalls
and fixing the spelling of "cancelled" along the way.
Modeled on FreeBSD's libthr
|
|
Requested by many to ease substitution of librthread for libpthread
|
|
|
|
errno. The ASM bits for _cerror are sketchy or missing for some archs
but that can be corrected in-tree.
|
|
race condition and prep for later support of pthread_condattr_setclock()
"get it in" deraadt@, tedu@, cheers by others
|
|
and struct timespec * argument. sigtimedwait is just a one line
wrapper after this.
"get it in" deraadt@, tedu@, cheers by others
|
|
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
|
|
ok kurt@
|
|
64bit archs to accommodate the growing number of ports that put large
buffers on the stack. Supported by many with no objections.
|
|
finally reading the lint warnings (sigh)
ok tedu@
|
|
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@
|
|
- 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@
|
|
Minor tweaks to compile with the above, primarily in fixing
the conflicts between semaphore.h and rthread.h
"i like the additional warnings" tedu@
|
|
not use a separate reaper thread. ok tedu@ marc@
|
|
size (and guard zone size) to be set using pthread_attr. Guard
zones are specified in bytes, but implemented in terms of a
page size.
OK Otto@
|
|
_rthread_debug(3, "foo = %s", foo);
where output is to stderr and will only be printed if the current
debug level is >= 3. Messages with a debug level of 0 are always
printed. The level can be set from the environment (not enabled yet)
or with gdb by modifying variable _rthread_debug_level.
"Fine with me" -Otto
|
|
With this, java seems to be operational. Also make threads_ready
non-static, which is needed for an upcoming diff. ok tedu@
|
|
and fix a bug in thread creation error path. ok tedu@
|