summaryrefslogtreecommitdiff
path: root/libpthread/nptl/sysdeps/pthread
AgeCommit message (Collapse)Author
2024-02-28libc: Pass 64bit-only time structures to syscalls.Dmitry Chestnykh
With time64 enabled we need to pass structure which consists of two 64bit fields to clock_gettime64() and clock_nanosleep_time64() syscalls with proper conversion to regular timespec structure after syscall execution. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2024-02-22Introduce time64 support.Dmitry Chestnykh
This patch introduces *time64 syscalls support for uClibc-ng. Currently the redirection of syscalls to their *time64 analogs is fully supported for 32bit ARM (ARMv5, ARMv6, ARMv7). The main changes that take effect when time64 feature is enabled are: - sizeof(time_t) is 8. - There is a possibility os setting date beyond year 2038. - some syscalls are redirected: clock_adjtime -> clock_adjtime64 clock_getres -> clock_getres_time64 clock_gettime -> clock_gettime64 clock_nanosleep -> clock_nanosleep_time64 clock_settime -> clock_settime64 futex -> futex_time64 mq_timedreceive -> mq_timedreceive_time64 mq_timedsend -> mq_timedsend_time64 ppoll -> ppoll_time64 pselect6 -> pselect6_time64 recvmmsg -> recvmmsg_time64 rt_sigtimedwait -> rt_sigtimedwait_time64 sched_rr_get_interval -> sched_rr_get_interval_time64 semtimedop -> semtimedop_time64 timer_gettime -> timer_gettime64 timer_settime -> timer_settime64 timerfd_gettime -> timerfd_gettime64 timerfd_settime -> timerfd_settime64 utimensat -> utimensat_time64. - settimeofday uses clock_settime (like in glibc/musl). - gettimeofday uses clock_gettime (like in glibc/musl). - nanosleep uses clock_nanosleep (like in glibc/musl). - There are some fixes in data structures used by libc and kernel for correct data handling both with and without enabled time64 support. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
2023-10-28Fix -Warray-parameter warning for __sigsetjmpPavel Kozlov
Fix the [-Warray-parameter=] warning for __sigsetjmp generated by GCC 11 and later GCC versions: | | warning: argument 1 of type 'struct __jmp_buf_tag *' declared as a pointer [-Warray-parameter=] | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; | ... | note: previously declared as an array 'struct __jmp_buf_tag[1]' | extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) | Use the same fix as in glibc. The fix is to move the struct __jmp_buf_tag definition to a separate bits/ header so it can be included in pthread.h, to allow to use an array (as in setjmp.h) rather than a pointer in the declaration. Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
2020-10-02kvx: add support for kvx arch to uClibc-ngYann Sionneau
This commit adds support for Kalray VLIW family (kvx) Kalray kv3 core is embedded in Kalray Coolidge SoC. This core which is the third of the KV family has the following features: 32/64 bits execution mode 6-issue VLIW architecture 64 x 64bits general purpose registers SIMD instructions little-endian In order to build a usable toolchain, build scripts are provided at the following address: https://github.com/kalray/build-scripts. Kalray uses FOSS which is available at https://github.com/kalray This includes Linux kernel, uClibc-ng, gcc, binutils, etc. Signed-off-by: Clément Léger <cleger@kalray.eu> Signed-off-by: Guillaume Thouvenin <gthouvenin@kalray.eu> Signed-off-by: Laurent Thevenoux <lthevenoux@kalray.eu> Signed-off-by: Marc Poulhies <mpoulhies@kalray.eu> Signed-off-by: Marius Gligor <mgligor@kalray.eu> Signed-off-by: Yann Sionneau <ysionneau@kalray.eu>
2018-02-03add libc version compatibilityWaldemar Brodkorb
2018-01-15libpthread/nptl: bugfix malloc segfault in race conditions.Guo Ren
In libc/sysdeps/linux/common/bits/uClibc_pthread.h: extern void weak_function _pthread_cleanup_push_defer(...) This *weak_function* declaration will cause nptl/cleanup_defer_compat.c: strong_alias (...) !!!FAIL!!!, because it include pthreadP.h->pthread.h ->uClibc_pthread.h That means: Readelf -s libpthread/nptl/cleanup_defer_compat.o you will get: 18: 00000000 198 FUNC WEAK DEFAULT 1 _pthread_cleanup_push_def Readelf -s libc/misc/internals/__uClibc_main.o you will also get: 32: 00000038 58 FUNC WEAK DEFAULT 1 _pthread_cleanup_push_def Final: gcc malloc_pthread_test.c -lpthread The libc/stdlib/malloc-standard/malloc.c:839 (__MALLOC_LOCK-> _pthread_cleanup_push_def) will use the one in __uClibc_main.o !!!not in cleanup_defer_compat.o!!!, becasue two cleanup_defer_compat in libc.a with the same weak declarations and the __uClibc_main.o is close to front. ==== All of malloc/free will failed in muti-threads' race conditions probabilistic. As it happens, uClibc-0.9.33.2 is OK, Becasue: It's seperated in libpthread.a and libc.a, and the libc.a is the last lib for ld internal-cmd, and malloc will get right cleanup_defer_compat from libpthread.a. This BUG is from 2016-09-24 to now: >>> commit 29ff9055c80efe77a7130767a9fcb3ab8c67e8ce Author: Waldemar Brodkorb <wbx@uclibc-ng.org> Date: Sat Sep 24 02:55:31 2016 +0200 use a single libc and deduplicate threading code Similar to musl libc a single libc has many benefits and solves some open issues with uClibc-ng. - no pthread_mutex_* weak symbols exported anymore - applications no longer failing to link when either -lrt or -lpthread are missing for dynamic and static linking mode - smaller C library - slightly better runtime performance <<< Perharps we need carefully check all of the impact about that commit. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
2017-01-28remove PID cachingWaldemar Brodkorb
Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e and remove the PID caching. These simplifies the architecture specific assembly code. The run of the test suite found no regressions, it even solves some of the test failures for x86/x86_64/sparc. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com> Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
2016-11-29libpthread: Fix inclusion of unwind code.Ignacy Gawędzki
Since librt and libpthread are now integrated into libc, including unwind-resume and unwind-forcedunwind implementations of unwind code makes no sense. Only unwind-forcedunwind is now included with functions hidden to avoid them overriding the ones from libgcc_s. * libpthread/nptl/sysdeps/generic/unwind-resume.h: New. Define generic PERSONALITY_PROTO and PERSONALITY_ARGS and set HAVE_ARCH_UNWIND_RESUME to 0. * libpthread/nptl/sysdeps/pthread/unwind-resume.c: Move... * libpthread/nptl/sysdeps/generic/unwind-resume.c: ... here. Include generic implementation of _Unwind_Resume on the condition that !HAVE_ARCH_UNWIND_RESUME. Make functions hidden to prevent them from overriding libgcc_s's ones. * libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c: Likewise. * libpthread/nptl/sysdeps/arm/unwind-resume.h: New. Define ARM-specific PERSONALITY_PROTO and PERSONALITY_ARGS and set HAVE_ARCH_UNWIND_RESUME to 1. * libpthread/nptl/sysdeps/arm/arm-unwind-resume.c, * libpthread/nptl/sysdeps/arm/pt-arm-unwind-resume.c, * libpthread/nptl/sysdeps/arm/rt-arm-unwind-resume.c: New. ARM-specific implementations of _Unwind_Resume resp. for libc, libpthread and librt. * libpthread/nptl/sysdeps/Makefile.commonarch: Remove both arm-unwind-resume and rt-arm-unwind-resume from libpthread_arch_CSRC. * libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c, * libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c: Remove. Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
2016-11-10nptl: add pthread_getname_np/pthread_setname_np from GNU libcWaldemar Brodkorb
These functions are used by firefox for example. Tested with running firefox on x86 system.
2016-10-13cleanup and fix static linking issuesWaldemar Brodkorb
There was a deadlock hanging in a sycall to futex, which should be solved now. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-09-26use a single libc and deduplicate threading codeWaldemar Brodkorb
Similar to musl libc a single libc has many benefits and solves some open issues with uClibc-ng. - no pthread_mutex_* weak symbols exported anymore - applications no longer failing to link when either -lrt or -lpthread are missing for dynamic and static linking mode - smaller C library - slightly better runtime performance
2016-09-26always assume tgkill is presentWaldemar Brodkorb
We do not support 2.4 Linux kernels anyway, and almost all newer 2.6 kernels should have tgkill syscall. Cleanup the raise situation, pt-raise.c is unused, sync raise.c with latest GNU libc. Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-07-17cleanup PTR_MANGLE/PTR_DEMANGLE supportWaldemar Brodkorb
As this is only implemented for a few architecture and not well tested, just remove it. Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
2016-05-28sigaction: fix for THREADS_NATIVEBaruch Siach
Commit 9c4fce55a (nptl: remove sigaction, sigprocmask, and sigfillset from libpthread) removed pt-sigaction.c from the build to fix static build. However, since the libc sigaction is weak when HAS_THREADS is enabled, static build is not be affected. Tested for xtensa, x86, MIPS32 targets. Fixes nptl/tst-signal7. Moreover, commit 9193a76bb from the 0.9.33 branch has the right version. Ref.: http://patchwork.ozlabs.org/patch/286084/ Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
2015-08-22quieten compile warningsWaldemar Brodkorb
Sync with glibc, quietens gcc warnings.
2015-06-10buildsys: pregen depends on xlocaleBernhard Reutner-Fischer
pt-initfini eventually depends on xlocale Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-13unistd.h: put getppid under XOPEN2K8Bernhard Reutner-Fischer
Add __LEAF to all __THROW, introduce non-leaf __THROWNL Adjust affected spots accordingly. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2014-09-16buildsys: fix IS_IN_lib*Bernhard Reutner-Fischer
define NOT_IN_libc / IS_IN_libxxx appropriately to fix pthread_once Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-11-18drop support for pre ISO-C compilersMike Frysinger
This drops __signed, __volatile, and __const. Only the latter was used in the code base, and for uClibc, not consistently. Much of the code used plain "const" which meant "__const" was useless. Really, the point of this is to stay in sync with what glibc did. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-18Replace FSF snail mail address with URLsMike Frysinger
This matches a similar change made to glibc. No functional changes here. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-15nptl: remove sigaction, sigprocmask, and sigfillset from libpthreadAustin Foxley
Having them defined in both places was causing errors with static linking Signed-off-by: Austin Foxley <austinf@cetoncorp.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15unwind-{resume,forcedunwind}.c: add missing prototypesPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15fix a bunch of build warningsPeter S. Mazinger
Added attribute_noreturn even if it has return at the end of function Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-26nptl: fix compiler warning due to missing prototypeCarmelo Amoroso
libpthread/nptl/sysdeps/pthread/pt-longjmp.c: In function 'longjmp': libpthread/nptl/sysdeps/pthread/pt-longjmp.c:27:3: warning: implicit declaration of function '__libc_longjmp' [-Wimplicit-function-declaration] libpthread/nptl/sysdeps/pthread/pt-longjmp.c:28:1: warning: 'noreturn' function does return [enabled by default] Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-03-26nptl: fix compiler warning due to unused-but-set-variableCarmelo Amoroso
gcc 4.6.x raises useful warnings due to unused-but-set-variable, This patch fixes the following one by using properly preprocessor guard libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c: In function '__pthread_cond_timedwait': libpthread/nptl/sysdeps/pthread/pthread_cond_timedwait.c:103:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2012-01-29nptl_db: handle SUSv4-OBBernhard Reutner-Fischer
pthread_getconcurrency / pthread_setconcurrency is OBSOLETE in SUSv4 so disable pthread debug support too Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-01-28buildsys: fixup sigaction handlingBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-14buildsys: pt-initfini.s depends on uClibc_config.hBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-06-13nptl/pthread: Correct path for machine specific pt-initfini.cKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-06-13ctor/dtor nptl: Fix init and fini function compilationKhem Raj
We need to define the rules for .S files so it gets the include paths some architectures like mips include headers Some architectures e.g. SH have their own version of pt-initfini.c so look for that first before resorting to generic version of pt-initfini.c Signed-off-by: Khem Raj <raj.khem@gmail.com>
2011-05-31NPTL: Fix CTOR_DTORBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-05-11commentary typo fixBernhard Reutner-Fischer
use cancellation (with two 'l') uniformly. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-03-03use common sigthread.hPeter S. Mazinger
NPTL build did not use the correct bits/sigthread.h, use a common version avoiding this. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
2011-01-04nptl: get rid of preprocessor warning when __ASSUME_TGKILL is not definedCarmelo Amoroso
A sample of the warning reported while building for ARM that has not __ASSUME_TGKILL defined. libpthread/nptl/sysdeps/unix/sysv/linux/raise.c: In function 'raise': libpthread/nptl/sysdeps/unix/sysv/linux/raise.c:33:5: warning: "__ASSUME_TGKILL" is not defined Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-12-18nptl: If DOPIC is set then we missed a rule to generate .os variants for ↵Khem Raj
pt-*.c files Signed-off-by: Khem Raj <raj.khem@gmail.com>
2010-07-14nptl: remove superfluous =1 from definesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-07-06nptl: fix buildsysBernhard Reutner-Fischer
Now automatically picks the correct (arch and subarch specific) impls in favour of generic impls. make O=/tmp/objs PREFIX=/my/sysroot -j works now as expected (both out-of-tree as well as parallel-safe). Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-07-06nptl: fix subdirs handlingBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-06-24use uniform form of C99 keywordsBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-06-11silence some warnings about missing prototypesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-05-09powerpc: Add TLS and NPTL supportKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-04-25nptl: Harmonize objects and headers makefile clean targetsCarmelo Amoroso
Update all the nptl clean targets (both objects and headers) to use the new syntax using CLEAN_<full_path> and HEADER_<full_path>. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-04-22nptl: fix warnings of shadowing __selfTimo Teräs
Stdio locking macroes do: void *__self = THREAD_SELF; But THREAD_SELF uses __self also internally which causes shadowing warnings. Just rename the outer variable for now. Might be an idea to convert the macroes to static inline functions. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-16nptl: mark forwarded functions protectedTimo Teras
The libc stubs should never override the libpthread provided functions inside libpthread, otherwise the struct pthread_functions that is used by the forwarder stubs goes bad. Signed-off-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-16libc: remove libc weak __pthreads_* wrappersTimo Teras
It is not possible to override for libpthread to override the weak libc definitions. This has never worked in uclibc, and does no longer work in glibc either (unless you use LD_DYNAMIC_WEAK). The proper thing to do is have weak prototypes in libc, and definitions in libpthread only. This way libc runs even if those functions are not defined, but just needs to protect against the NULL values (done by implementing __uclibc_maybe_call). This fix the problems if libc is linked before libpthread or if libpthread is pulled by a dependency library. Signed-off-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-16Revert "nptl: mark symbols with libc forwarder hidden"Timo Teras
This reverts most of commit 1610762362e651f86ca284ac59a1d7ec88034e4e. Marking the symbols hidden is wrong, because libc accesses the pthreads internal symbols for internal locking. Signed-off-by: Timo Teras <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-15PTR_DEMANGLE: add documentationBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-04-14nptl: turn pointer demangling offTimo Teräs
Currently the stub calls would demangle the pointer that is never mangled. Alternatively, we could sync nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c with new glibc version that properly mangles the pointers, but that would need more validation to make sure that all struct pthread_function readers do demangling. uclibc currently does not do pointer mangling everywhere so it's more consistent to just disable it here too. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-14nptl: mark symbols with libc forwarder hiddenTimo Teräs
Add attribute_hidden to all symbols having libc forwarder. This prevents recursive self calls which would happen if libc is before libpthread in linking order: the forwarder functions would call itself via the function table, since the libpthread symbols would get overwritten with libc ones. This has not been a problem in glibc since there these symbols are marked hidden with linker version-script. Since we don't use one, we need to mark these explicitly. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2010-04-12use user-provided host binariesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>