History log of /dflybsd-src/lib/libthread_xu/thread/thr_init.c (Results 1 – 25 of 33)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.4.0, v6.4.0rc1, v6.5.0, v6.2.2, v6.2.1, v6.3.0, v6.0.1, v6.0.0, v6.0.0rc1, v6.1.0
# ab5dc9ac 08-Mar-2021 Sascha Wildner <saw@online.de>

libpthread: Implement pthread_getname_np() and pthread_setname_np().

Varieties of pthread_get_name_np() and pthread_set_name_np() that return
an integer (0 or error number).

These are only used for

libpthread: Implement pthread_getname_np() and pthread_setname_np().

Varieties of pthread_get_name_np() and pthread_set_name_np() that return
an integer (0 or error number).

These are only used for debugging but it looks like some ports want them.

I took some of the documentation from FreeBSD.

Reported-by: zrj

show more ...


# cf8046a9 08-Dec-2020 zrj <rimvydas.jasinskas@gmail.com>

pthreads: Reimplement pthread types using non polluting types.

Use __ implementation specific namespace and adjust libthread_xu.
* The pthread_addr_t type was specific only to libc_r, remove it.

pthreads: Reimplement pthread types using non polluting types.

Use __ implementation specific namespace and adjust libthread_xu.
* The pthread_addr_t type was specific only to libc_r, remove it.
* The pthread_startroutine_t typedef was never used since initial fork.
* The mutex member in struct pthread_once was for libc_r only, rename
it to __sparelibc_r void pointer to keep ABI compatibility.
* Mangle struct names using __type_s scheme to avoid collisions with
user defined types in 3rd-party software packages.
* Adjust partly publicly visible struct pthread_once members too.

show more ...


# 940be950 08-Dec-2020 zrj <rimvydas.jasinskas@gmail.com>

pthreads: Use pthread_t type in libthread_xu.

Separated from upcoming work to allow easier differentiation between
non-pointers, single and double pointers. Inclusion of thr_private.h
already pr

pthreads: Use pthread_t type in libthread_xu.

Separated from upcoming work to allow easier differentiation between
non-pointers, single and double pointers. Inclusion of thr_private.h
already provides all needed information to dereference these types.

No functional change

show more ...


Revision tags: v5.8.3, v5.8.2
# 4b29dd4b 17-Aug-2020 Michael Neumann <mneumann@ntecs.de>

pthread - Respect RLIMIT_STACK for main thread's stack size

Prior to this commit, the stack size of the main thread was fixed
at 4 MB which was too low for certain applications.

This commit fixes b

pthread - Respect RLIMIT_STACK for main thread's stack size

Prior to this commit, the stack size of the main thread was fixed
at 4 MB which was too low for certain applications.

This commit fixes bootstrapping the lang/crystal compiler (see [1]).

Reviewed-by: dillon

Fixes-issue: #3234

[1]: https://github.com/crystal-lang/crystal/pull/9178

show more ...


Revision tags: v5.8.1, v5.8.0, v5.9.0, v5.8.0rc1, v5.6.3
# eb396e51 14-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

world - Add support for lwp_getname() and pthread_get_name_np()

* Add support for the new system call lwp_getname()

* Add support for pthread_get_name_np(), rounding out that function
set and imp

world - Add support for lwp_getname() and pthread_get_name_np()

* Add support for the new system call lwp_getname()

* Add support for pthread_get_name_np(), rounding out that function
set and improving ports compatibility.

show more ...


# 721505de 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
te

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.

In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.

However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.

* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.

These are extremely fast routines.

- Reentrant / Recursable

- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.

- The last sigunblockall() will immediately dispatch any blocked
signals.

- The normal signal mask is not affected by these routines.

- Does not block signals caused by synchronous traps.

- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.

* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().

* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().

These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.

show more ...


# e7bf3f77 29-Oct-2019 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
__free), bypassing third party allocators.

* Fixes interactions

pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
__free), bypassing third party allocators.

* Fixes interactions between third party alocators and pthreads
which often cause deadlocks or other chicken-and-egg issues,
or require serious hacks to work around.

show more ...


Revision tags: v5.6.2, v5.6.1, v5.6.0, v5.6.0rc1, v5.7.0, v5.4.3, v5.4.2, v5.4.1, v5.4.0, v5.5.0, v5.4.0rc1, v5.2.2, v5.2.1, v5.2.0, v5.3.0, v5.2.0rc, v5.0.2
# e2caf0e7 08-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

libc and pthreads - Fix atfork issues with nmalloc, update dmalloc

* Implement atfork handling for nmalloc. As part of this, refactor
some of nmalloc.

* Remove ZERO_LENGTH_PTR from nmalloc. Ins

libc and pthreads - Fix atfork issues with nmalloc, update dmalloc

* Implement atfork handling for nmalloc. As part of this, refactor
some of nmalloc.

* Remove ZERO_LENGTH_PTR from nmalloc. Instead, force 0-byte
allocations to allocate 1 byte. The standard requires unique
pointers to be returned.

* For now go back to a single depot lock instead of a per-zone
lock. It is unclear whether multi-threaded performance will
suffer or not, but its the only way to implement atfork handling.

* Implement proper atfork interlocks for nmalloc via pthreads to avoid
corruption when heavily threaded programs call fork().

* Bring dmalloc up to date in various ways, including properly
implementing a minimum 16-byte alignment for allocations >= 16 bytes,
and atfork handling. Also use a global depot lock for the same
reason we use it in nmalloc, and implement a front-end magazine
shortcut for any allocations <= 2MB.

Reported-by: mneumann

show more ...


Revision tags: v5.0.1
# 98247283 02-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Fix rtld-elf and libthread_xu

* Fixes chrome, thunderbird, and multiple other issues with recent
libpthreads work.

Testing-by: mneumann, dillon


# fcaa7a3a 02-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
(sem and rtld) which must execute after all user atfork entities
pre-fork and bef

libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
(sem and rtld) which must execute after all user atfork entities
pre-fork and before all user atfork entities post-fork.

* Install an atfork handler for rtld-elf (also requires rtld-elf to
be updated). The handler will ensure that RTLD locks are in a sane
state prior to fork (by acquiring them), and will then release the
locks post-fork. This is the primary fix for lang/rust and cargo.

Also do not issue _thr_rtld_fini() when threading drops to 0.
Once threading has been set, rtld's pthread locks remain installed.

* Refactor thr_cond.c. Refactor condition variables to perform
according to the spec. Use a TAILQ to make pthread_cond_signal()
work exactly as described in the manual (that is, waking up only
one waiter at a time).

* Refactor thr_mutex.c. Primary instrument for debugging and
clean up. Also deal with improper EINTR handling.

* Refactor thr_fork.c. Implement the new atfork facility for
internal atfork handlers.

* Refactor thr_rwlock.c. Add debugging, cleanup.

* thr_sem.c now uses the internal atfork handler to ensure proper
ordering.

* thr_sig.c implements debugging features.

* Refactor thr_umtx.c... the low level mutex code. Store the id
for additonal verification and use an atomic lock to clear the
lock instead of an assignment. Properly ignore EINTR.

* Cleanup init_private() a bit.

* Add PTHREADS_DEBUGGING=TRUE and PTHREADS_DEBUGGING2=TRUE make
flags. The first writes out a garbage file in /tmp for all
locking operations as they occur. The second is used for
point debugging and writes out a file when signal 63 is sent
to the program.

* Add cpu_ccfence() in various places that might need it (a hack
for the moment, userland cannot currently #include
"machine/cpufunc.h").

* Should fix lang/rust and 'cargo'

show more ...


Revision tags: v5.0.0, v5.0.0rc2, v5.1.0, v5.0.0rc1, v4.8.1
# 725edadf 26-Jul-2017 Sascha Wildner <saw@online.de>

libc/libpthread: Add clock_getcpuclockid() and pthread_getcpuclockid().

* Adjust clock_gettime() and clock_getres() to accept values obtained
this way.

* Also set _POSIX_CPUTIME and _POSIX_THREAD

libc/libpthread: Add clock_getcpuclockid() and pthread_getcpuclockid().

* Adjust clock_gettime() and clock_getres() to accept values obtained
this way.

* Also set _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME, although we should
really support values obtained by these functions in clock_settime()
too.

Based on and taken from FreeBSD's code.

Reviewed-by: sephe

show more ...


# c0f25c26 15-Jul-2017 Imre Vadász <imre@vdsz.com>

pthread: Add pthread_getthreadid_np() function, bump __DragonFly_version.

Using pthread_getthreadid_np() can directly use the thread-ID value that is
already cached in the pthread_t struct.

Partly

pthread: Add pthread_getthreadid_np() function, bump __DragonFly_version.

Using pthread_getthreadid_np() can directly use the thread-ID value that is
already cached in the pthread_t struct.

Partly Taken-From: FreeBSD

show more ...


Revision tags: v4.8.0, v4.6.2, v4.9.0, v4.8.0rc
# b2920380 14-Jan-2017 Sepherosa Ziehau <sephe@dragonflybsd.org>

pthread: Implement pthread_{set,get}affinity_np


Revision tags: v4.6.1
# 467ee1bb 19-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Set default contention scope to system.

It is a bit unclear how scope was handled previously.
Make it explicit to see what falls down.


# 602cfc0b 19-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Move few attr private structs to thr_init.c

These symbols should only be available if _thread_init() gets linked in.
Helps with -static troubleshooting.


# 19451dc5 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: General pre-cleanup (style, typos etc)

No functional change.


Revision tags: v4.6.0, v4.6.0rc2, v4.6.0rc, v4.7.0, v4.4.3, v4.4.2, v4.4.1, v4.4.0, v4.5.0, v4.4.0rc, v4.2.4, v4.3.1, v4.2.3, v4.2.1, v4.2.0, v4.0.6, v4.3.0, v4.2.0rc, v4.0.5, v4.0.4, v4.0.3, v4.0.2, v4.0.1, v4.0.0, v4.0.0rc3, v4.0.0rc2, v4.0.0rc, v4.1.0, v3.8.2, v3.8.1, v3.6.3, v3.8.0, v3.8.0rc2, v3.9.0, v3.8.0rc
# 0dc5e56d 16-Apr-2014 Matthew Dillon <dillon@apollo.backplane.com>

libthread_xu - Clean up the red zone on library unload

* If the main program is not linked against -pthread but dynamically
loads a shared library that is via dlopen(), then dlclose()'s it,
libt

libthread_xu - Clean up the red zone on library unload

* If the main program is not linked against -pthread but dynamically
loads a shared library that is via dlopen(), then dlclose()'s it,
libthread_xu leaves red-zone and cached thread stacks dangling.

The second attempt to (indirectly) load libthread_xu then fails with a
red-zone panic.

* Add a destructor for libthread_xu to unmap the red-zone and to clean out
any cached thread stacks.

* Note that neither libthread_xu nor most other large libraries are designed
to be unloaded. That is, even if loading/unloading works, numerous libraries
will almost certainly leak memory. This change prevents the fatal error but
doesn't fix the general memory leakage problem.

IMHO Only libraries designed to be unloadable should be unloaded.

Reported-by: Vasily Postnicov <shamaz.mazum@gmail.com>

show more ...


Revision tags: v3.6.2, v3.6.1, v3.6.0, v3.7.1, v3.6.0rc, v3.4.3, v3.4.2, v3.4.1, v3.4.0, v3.4.0rc, v3.5.0
# a809fd39 18-Mar-2013 Markus Pfeiffer <markus.pfeiffer@morphism.de>

libc/libthread_xu - Fix segfault caused by libpthread used before initialised

If a binary has libpthread as dependency and is linked against libintl,
or any other library that uses pthread locking p

libc/libthread_xu - Fix segfault caused by libpthread used before initialised

If a binary has libpthread as dependency and is linked against libintl,
or any other library that uses pthread locking primitives from libc
without depending on libpthread itself it can happen that functions
from libpthread are called before libpthread's constructor has been
called. This leads to a segfault.

This fix adds a weak symbold to libc, namely _pthread_init_early,
which is called from a libc constructor function and therefore makes
sure that libpthread is initialised early enough.

Thanks to Simon Schubert, Angelos Oikonomopoulos, and Sascha Wildner
for the support in debugging this.

show more ...


Revision tags: v3.2.2, v3.2.1, v3.2.0, v3.3.0, v3.0.3, v3.0.2, v3.0.1, v3.1.0, v3.0.0
# 86d7f5d3 26-Nov-2011 John Marino <draco@marino.st>

Initial import of binutils 2.22 on the new vendor branch

Future versions of binutils will also reside on this branch rather
than continuing to create new binutils branches for each new version.


Revision tags: v2.12.0, v2.13.0
# 34c13333 27-May-2011 Sascha Wildner <saw@online.de>

libthread_xu: Fix a typo and add a missing STATIC_LIB_REQUIRE().

Reported-by: Goetz Isenmann <gisenmann@web.de>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2058>


Revision tags: v2.10.1, v2.11.0, v2.10.0, v2.9.1, v2.8.2, v2.8.1, v2.8.0, v2.9.0, v2.6.3, v2.7.3, v2.6.2, v2.7.2, v2.7.1, v2.6.1, v2.7.0, v2.6.0, v2.5.1, v2.4.1, v2.5.0, v2.4.0, v2.3.2, v2.3.1, v2.2.1
# 0cf41d5e 25-Apr-2009 Matthew Dillon <dillon@apollo.backplane.com>

Use MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.

We want to fail if the user program already faulted through the zone,
though in reality the red zone init occurs before main() is eve

Use MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.

We want to fail if the user program already faulted through the zone,
though in reality the red zone init occurs before main() is even run so
there is no practical difference.

show more ...


# 9b505694 25-Apr-2009 Matthew Dillon <dillon@apollo.backplane.com>

Use MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.

We want to fail if the user program already faulted through the zone,
though in reality the red zone init occurs before main() is eve

Use MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.

We want to fail if the user program already faulted through the zone,
though in reality the red zone init occurs before main() is even run so
there is no practical difference.

show more ...


# 2035b679 23-Apr-2009 Matthew Dillon <dillon@apollo.backplane.com>

Fix libthread_xu's use of MAP_STACK. Guards were not being setup properly.

MAP_STACK mappings do not immediately extend down to their base, so calling
mprotect() on the base is basically a NOP. In

Fix libthread_xu's use of MAP_STACK. Guards were not being setup properly.

MAP_STACK mappings do not immediately extend down to their base, so calling
mprotect() on the base is basically a NOP. Instead of calling mprotect() we
call mmap() with MAP_FIXED to force the guard.

Properly use MAP_FIXED when setting up the primary guard on the original
user stack. The address specified in the mmap() is only a hint when MAP_FIXED
is not used, and will not properly map the anonymous area. Also, new kernels
do not allow non-MAP_STACK mappings to override MAP_STACK mappings and the
user stack area is a MAP_STACK mapping, so use of MAP_FIXED is mandatory here.

show more ...


# e28f12ac 07-Apr-2009 Matthew Dillon <dillon@apollo.backplane.com>

Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly


# 2038fb68 06-Apr-2009 Sascha Wildner <saw@online.de>

Replace all casts of NULL to something with NULL.


12