aboutsummaryrefslogtreecommitdiff
path: root/htl
AgeCommit message (Collapse)AuthorFilesLines
2024-03-23htl: Implement some support for TLS_DTV_AT_TPSergey Bugaev1-0/+2
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-ID: <20240323173301.151066-19-bugaevc@gmail.com>
2024-02-25htl/tests: Reformat Makefile.Carlos O'Donell1-4/+19
Reflow and sort Makefile. No code generation changes in non-test binary artifacts. No regressions on x86_64 and i686. Tested with build-many-glibcs.py for x86_64-gnu.
2024-02-25htl: Reformat Makefile.Carlos O'Donell1-141/+183
Reflow and sort Makefile. Code generation changes present due to link order changes. No regressions on x86_64 and i686.
2024-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert47-47/+47
2023-09-04__call_tls_dtors: Use call_function_static_weakSamuel Thibault1-4/+1
2023-09-03htl: thread_local destructors supportSamuel Thibault1-0/+6
2023-08-24htl: move pthread_attr_setdetachstate into libcGuy-Fleury Iteriteka4-7/+4
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-11-gfleury@disroot.org>
2023-08-24htl: move pthread_attr_getdetachstate into libcGuy-Fleury Iteriteka4-7/+3
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-10-gfleury@disroot.org>
2023-08-24htl: move pthread_attr_setschedpolicy into libcGuy-Fleury Iteriteka4-7/+3
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-9-gfleury@disroot.org>
2023-08-24htl: move pthread_attr_getschedpolicy into libcGuy-Fleury Iteriteka4-6/+2
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-8-gfleury@disroot.org>
2023-08-24htl: move pthread_attr_setinheritsched into libcGuy-Fleury Iteriteka4-7/+4
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-7-gfleury@disroot.org>
2023-08-24htl: move pthread_attr_getinheritsched into libcGuy-Fleury Iteriteka4-6/+3
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-6-gfleury@disroot.org>
2023-08-24htl: move pthread_attr_getschedparam into libcGuy-Fleury Iteriteka4-7/+3
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-5-gfleury@disroot.org>
2023-08-24htl: move pthread_setschedparam into libcGuy-Fleury Iteriteka4-9/+3
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-4-gfleury@disroot.org>
2023-08-24htl: move pthread_getschedparam into libcGuy-Fleury Iteriteka4-8/+4
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-3-gfleury@disroot.org>
2023-08-24htl: move pthread_equal into libcGuy-Fleury Iteriteka4-8/+2
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230716084414.107245-2-gfleury@disroot.org>
2023-08-08htl: Initialize ___pthread_self earlySamuel Thibault2-17/+1
When using jemalloc, malloc() needs to use TSD, while libpthread initialization needs malloc(). Having ___pthread_self set early to some static storage allows TSD to work early, thus allowing jemalloc and libpthread to initialize together. This incidentaly simplifies __pthread_enable/disable_asynccancel and __pthread_self, now that ___pthread_self is always initialized.
2023-06-02Fix all the remaining misspellings -- BZ 25337Paul Pluzhnikov3-3/+3
2023-05-01hurd 64bit: Fix pthread_t/thread_t type to longSamuel Thibault1-0/+2
So that they can be trivially cast to pointer type, like with nptl.
2023-04-05htl: move pthread_self info libc.Guy-Fleury Iteriteka5-12/+14
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230318095826.1125734-4-gfleury@disroot.org>
2023-04-05htl: move ___pthread_self into libc.Guy-Fleury Iteriteka2-1/+2
sysdeps/mach/hurd/htl/pt-pthread_self.c: New file. htl/Makefile: .. Add it to libc routine. sysdeps/mach/hurd/htl/pt-sysdep.c(__pthread_self): Remove it. sysdeps/mach/hurd/htl/pt-sysdep.h(__pthread_self): Add hidden propertie. htl/Versions(__pthread_self) Version it as private symbol. Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230318095826.1125734-3-gfleury@disroot.org>
2023-04-05htl: move __pthtread_total into libcGuy-Fleury Iteriteka5-7/+26
htl/pt-nthreads.c: new file. htl/Makefile: Add it to routine. htl/Versions: version it as private libc symbol. htl/pt-create.c: remove his definition here. htl/pt-internal.h: add propertie to it declaration. Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org> Message-Id: <20230318095826.1125734-2-gfleury@disroot.org>
2023-02-12Fix typos in commentsSamuel Thibault1-1/+1
2023-02-12mach, hurd: Cast through uintptr_tSergey Bugaev1-2/+3
When casting between a pointer and an integer of a different size, GCC emits a warning (which is escalated to a build failure by -Werror). Indeed, if what you start with is a pointer, which you then cast to a shorter integer and then back again, you're going to cut off some bits of the pointer. But if you start with an integer (such as mach_port_t), then cast it to a longer pointer (void *), and then back to a shorter integer, you are fine. To keep GCC happy, cast through an intermediary uintptr_t, which is always the same size as a pointer. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20230212111044.610942-4-bugaevc@gmail.com>
2023-01-06Update copyright dates with scripts/update-copyrightsJoseph Myers46-46/+46
2023-01-02htl: Check error returned by __getrlimitSamuel Thibault1-2/+2
2022-09-23Use C11 atomics instead of atomic_decrement_and_testWilco Dijkstra2-2/+2
Replace atomic_decrement_and_test with atomic_fetch_add_relaxed. These are simple counters which do not protect any shared data from concurrent accesses. Also remove the unused file cond-perf.c. Passes regress on AArch64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-09-23Use C11 atomics instead of atomic_increment(_val)Wilco Dijkstra1-1/+1
Replace atomic_increment and atomic_increment_val with atomic_fetch_add_relaxed. One case in sem_post.c uses release semantics (see comment above it). The others are simple counters and do not protect any shared data from concurrent accesses. Passes regress on AArch64. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-09-09Use C11 atomics instead of atomic_decrement(_val)Wilco Dijkstra1-1/+1
Replace atomic_decrement and atomic_decrement_val with atomic_fetch_add_relaxed. Reviewed-by: DJ Delorie <dj@redhat.com>
2022-08-02htl: Let pthread_self and cancellability called earlySamuel Thibault2-1/+15
When applications redirect some functions they might get called before libpthread is fully initialized. They may still expected pthread_self and cancellable functions to work, so cope with such calls in that situation.
2022-02-14htl: Destroy thread-specific data before releasing joinsSamuel Thibault1-3/+3
Applications may want to assume that after pthread_join() returns, all thread-specific data has been released.
2022-01-22htl: Fix cleaning the reply portSamuel Thibault6-25/+27
If any RPC fails, the reply port will already be deallocated. __pthread_thread_terminate thus has to defer taking its name until the very last __thread_terminate_release which doesn't reply a message. But then we have to read from the pthread structure. This introduces __pthread_dealloc_finish() which does the recording of the thread termination, so the slot can be reused really only just before the __thread_terminate_release call. Only the real thread can set it, so let's decouple this from the pthread_state by just removing the PTHREAD_TERMINATED state and add a terminated field.
2022-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert46-46/+46
I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
2021-09-26htl: Fix sigset of main threadSamuel Thibault1-2/+5
d482ebfa6785 ('htl: Keep thread signals blocked during its initialization') fixed not letting signals get delivered too early during thread creation, but it also affected the main thread, thus making it block signals by default. We need to just let the main thread sigset as it is.
2021-09-16htl: Move thread table to ld.soSergey Bugaev4-52/+31
The next commit is going to introduce a new implementation of THREAD_GSCOPE_WAIT which needs to access the list of threads. Since it must be usable from the dynamic laoder, we have to move the symbols for the list of threads into the loader. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-Id: <20210915171110.226187-2-bugaevc@gmail.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2021-09-03Remove "Contributed by" linesSiddhesh Poyarekar1-1/+0
We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2021-07-13htl: Let libc call __pthread_mutex_{,try,un}lockSamuel Thibault1-0/+1
Now that NPTL was moved to libc, libc makes internal __pthread calls, so htl has to expose them internally.
2021-06-24Consolidate pthread_atforkAdhemerval Zanella1-3/+1
The pthread_atfork is similar between Linux and Hurd, only the compat version bits differs. The generic version is place at sysdeps/pthread with a common name. It also fixes an issue with Hurd license, where the static-only object did not use LGPL + exception. Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for i686-gnu.
2021-06-03dlfcn: Cleanups after -ldl is no longer requiredFlorian Weimer1-1/+0
This commit removes the ELF constructor and internal variables from dlfcn/dlfcn.c. The file now serves the same purpose as nptl/libpthread-compat.c, so it is renamed to dlfcn/libdl-compat.c. The use of libdl-shared-only-routines ensures that libdl.a is empty. This commit adjusts the test suite not to use $(libdl). The libdl.so symbolic link is no longer installed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-05-18htl: Add __libpthread_freeresSamuel Thibault2-1/+25
2021-03-29fork.h: replace with register-atfork.hSamuel Thibault1-1/+0
UNREGISTER_ATFORK is now defined for all ports in register-atfork.h, so most previous includes of fork.h actually only need register-atfork.h now, and cxa_finalize.c does not need an ifdef UNREGISTER_ATFORK any more. The nptl-specific fork generation counters can then go to pthreadP.h, and fork.h be removed. Checked on x86_64-linux-gnu and i686-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2021-03-12posix: Consolidate register-atforkAdhemerval Zanella2-158/+1
Both htl and nptl uses a different data structure to implement atfork handlers. The nptl one was refactored by 27761a1042d to use a dynarray which simplifies the code. This patch moves the nptl one to be the generic implementation and replace Hurd linked one. Different than previous NPTL, Hurd also uses a global lock, so performance should be similar. Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for i686-gnu.
2021-02-08pthread: Refactor semaphore codeAdhemerval Zanella2-21/+1
The internal semaphore list code is moved to a specific file, sem_routine.c, and the internal usage is simplified to only two functions (one to insert a new semaphore and one to remove it from the internal list). There is no need to expose the internal locking, neither how the semaphore mapping is implemented. No functional or semantic change is expected, tested on x86_64-linux-gnu.
2021-02-08linux: Require /dev/shm as the shared memory file systemFlorian Weimer2-3/+0
Previously, glibc would pick an arbitrary tmpfs file system from /proc/mounts if /dev/shm was not available. This could lead to an unsuitable file system being picked for the backing storage for shm_open, sem_open, and related functions. This patch introduces a new function, __shm_get_name, which builds the file name under the appropriate (now hard-coded) directory. It is called from the various shm_* and sem_* function. Unlike the SHM_GET_NAME macro it replaces, the callers handle the return values and errno updates. shm-directory.c is moved directly into the posix subdirectory because it can be implemented directly using POSIX functionality. It resides in libc because it is needed by both librt and nptl/htl. In the sem_open implementation, tmpfname is initialized directly from a string constant. This happens to remove one alloca call. Checked on x86_64-linux-gnu.
2021-01-02Update copyright dates with scripts/update-copyrightsPaul Eggert46-46/+46
I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
2020-12-16{nptl,htl}/semaphoreP.h: clean upSamuel Thibault1-2/+2
This removes "Contributed by", and uses a C99 flexible array instead of char name[0];
2020-12-16htl: Get sem_open/sem_close/sem_unlink support [BZ #25524]Samuel Thibault2-2/+51
This just moves the existing nptl implementation to reuse as it is in htl.
2020-12-16htl: Add pshared semaphore supportSamuel Thibault2-1/+34
The implementation is extremely similar to the nptl implementation, but with slight differences in the futex interface. This fixes some of BZ 25521.
2020-12-03htl: Add hidden def for __pthread_create/detachSamuel Thibault2-0/+2
to avoid a PLT.
2020-12-03htl: Add missing symbolsSamuel Thibault1-0/+2
hurd/hurdsig.c needs to detect whether __pthread_detach and __pthread_create are available, so they need to be exposed.