summaryrefslogtreecommitdiffstats
path: root/lib/libthr
Commit message (Collapse)AuthorAgeFilesLines
* MFC r318254:jasone2017-05-141-1/+1
| | | | | | Fix __pthread_mutex_trylock() to call THR_CRITICAL_LEAVE() on failure rather than on success. This regression was introduced by r300043 (Add implementation of robust mutexes...).
* MFC r315526vangyzen2017-05-012-0/+19
| | | | | | | | | | | | | | | | | | | | | | Add clock_nanosleep() Add a clock_nanosleep() syscall, as specified by POSIX. Make nanosleep() a wrapper around it. Attach the clock_nanosleep test from NetBSD. Adjust it for the FreeBSD behavior of updating rmtp only when interrupted by a signal. I believe this to be POSIX-compliant, since POSIX mentions the rmtp parameter only in the paragraph about EINTR. This is also what Linux does. (NetBSD updates rmtp unconditionally.) Copy the whole nanosleep.2 man page from NetBSD because it is complete and closely resembles the POSIX description. Edit, polish, and reword it a bit, being sure to keep any relevant text from the FreeBSD page. Regenerate syscall files. Relnotes: yes Sponsored by: Dell EMC
* MFC r312934:pfg2017-03-141-5/+7
| | | | | | | | | | | | | | | Make use of clang nullability attributes in C headers. Replace uses of the GCC __nonnull__ attribute with the clang nullability qualifiers. These are starting to get use in clang's static analyzer. Replacement should be transparent for developers using clang. GCC ports from older FreeBSD versions may need updating if the compiler was built before r312860 (Jan-27-2017). Hinted by: Apple's Libc-1158.20.4, Bionic libc Relnotes: yes
* MFC r312008:ngie2017-02-121-0/+1
| | | | | | | | | | | | | Upgrade NetBSD tests to 01.11.2017_23.20 snapshot This contains some new testcases in /usr/tests/...: - .../lib/libc - .../lib/libthr - .../lib/msun - .../sys/kern Tested on: amd64, i386
* MFC r312452-r312512:ngie2017-02-102-12/+12
| | | | | | | | | | r312452-r312512: - Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones This simplifies pathing in make/displayed output - Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc
* MFC r309630:kib2016-12-131-2/+12
| | | | Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).
* MFC r305855, r306297, r306300, r306312-r306313marcel2016-12-111-3/+3
| | | | | | | | | | | | | | When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same object files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. Also: o Compile _Exit.c as C99_Exit.c, as it conflicts with _exit.s o Add entry to UPDATING o Document .pico extension
* MFC r304209:kib2016-08-291-0/+15
| | | | The fdatasync(2) call must be cancellation point.
* MFC r303795:kib2016-08-201-1/+8
| | | | Add __cxa_thread_atexit(3) API implementation.
* MFC r303393:kib2016-08-033-7/+0
| | | | | | Remove empty initializer for the once facility. Approved by: re (gjb)
* Revert r302194, there are issues with some applications after changingkib2016-06-251-4/+1
| | | | | | | | | the return value, in particular console-kit-daemon. Reported by: Ivan Klymenko <fidaj@ukr.net> Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb)
* For pthread_mutex_trylock() call on owned error-check or non-portablekib2016-06-251-2/+5
| | | | | | | | | | adaptive mutex, return EDEADLK as required by POSIX. The pthread_mutex_lock() is already compliant. Tested by: Guy Yur <guyyur@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Approved by: re (gjb)
* Fix markup.kib2016-06-041-1/+1
| | | | Sponsored by: The FreeBSD Foundation
* libthr: Use formatted PANIC()cem2016-06-013-24/+10
| | | | | | | | | No functional change, although _thread_printf() may be slightly less functional or render some values differently from libc snprintf(3). No ABI change. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6672
* libthr: _thread_vprintf: Enhance support for %p, %#xcem2016-06-011-1/+8
| | | | | | | | No functional change. No ABI change. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6672
* libthr: Add vprintf variant of _thread_printf, formatted PANIC()cem2016-06-013-11/+34
| | | | | | | | No ABI change. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D6672
* Stop inlining the struct ucond definition into struct pthread_cond.kib2016-05-292-15/+11
| | | | | | | | | | | | | | | | | This avoids unneccessary casts and make the calls to _thr_ucond_*() functions less questionable. The c_spare field was not included into struct pthread_cond, so the change modifies libthr ABI for shared condvars. But since an off-page does not legitimately contains any other data past the struct pthread_cond, the change keeps shared condvars from pre- and post- changed libthr compatible. Also note that the whole struct ucond was never copied in or out by kernel. For private condvars, the privately allocated memory was never exposed outside libthr. Sponsored by: The FreeBSD Foundation
* Remove non-history libkse references and fix PTHREAD_PROCESSES_PRIVATE typo.jilles2016-05-291-3/+1
|
* Document _umtx_op(2) interface for the implementation of robust mutexes.kib2016-05-191-2/+38
| | | | | | | | In libthr(3), list added knobs. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D6427
* Add implementation of robust mutexes, hopefully close enough to thekib2016-05-178-298/+618
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013. A robust mutex is guaranteed to be cleared by the system upon either thread or process owner termination while the mutex is held. The next mutex locker is then notified about inconsistent mutex state and can execute (or abandon) corrective actions. The patch mostly consists of small changes here and there, adding neccessary checks for the inconsistent and abandoned conditions into existing paths. Additionally, the thread exit handler was extended to iterate over the userspace-maintained list of owned robust mutexes, unlocking and marking as terminated each of them. The list of owned robust mutexes cannot be maintained atomically synchronous with the mutex lock state (it is possible in kernel, but is too expensive). Instead, for the duration of lock or unlock operation, the current mutex is remembered in a special slot that is also checked by the kernel at thread termination. Kernel must be aware about the per-thread location of the heads of robust mutex lists and the current active mutex slot. When a thread touches a robust mutex for the first time, a new umtx op syscall is issued which informs about location of lists heads. The umtx sleep queues for PP and PI mutexes are split between non-robust and robust. Somewhat unrelated changes in the patch: 1. Style. 2. The fix for proper tdfind() call use in umtxq_sleep_pi() for shared pi mutexes. 3. Removal of the userspace struct pthread_mutex m_owner field. 4. The sysctl kern.ipc.umtx_vnode_persistent is added, which controls the lifetime of the shared mutex associated with a vnode' page. Reviewed by: jilles (previous version, supposedly the objection was fixed) Discussed with: brooks, Martin Simmons <martin@lispworks.com> (some aspects) Tested by: pho Sponsored by: The FreeBSD Foundation
* libthr(3): Fix xref to _umtx_op(2) now that we have it.jilles2016-05-161-2/+2
|
* Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resumekib2016-05-052-4/+2
| | | | | | | | | | | | | | cycle. The flag currently is cleared by the resumed thread. If next suspend request comes before the thread was able to clean the flag, in which case suspender skip the thread. Instead, clear the THR_FLAGS_SUSPEND flag in resume_common(), we do not care how much code was executed in the resumed thread when the pthread_resume_*np(s) functions returned. PR: 209233 Reported by: Lawrence Esswood <le277@cam.ac.uk> MFC after: 1 week
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-043-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* MFHgjb2016-04-161-1/+1
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * Unmagic the thread pointer offset.br2016-04-141-1/+1
| |
| * If off-page lookup failed, there is no memory to performkib2016-04-121-1/+2
| | | | | | | | | | | | shared_mutex_init() upon. Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-04-121-1/+2
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-04-1152-116/+178
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Use __FBSDID() for .c files from lib/libthr/thread.kib2016-04-0852-112/+158
| | | | | | | | Sponsored by: The FreeBSD Foundation
| * Use ANSI C function definitions, fix spelling in a comment.kib2016-04-083-4/+5
| | | | | | | | Sponsored by: The FreeBSD Foundation
| * Assert that the lock objects put into the off-page, fit into the page.kib2016-04-085-0/+15
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-04-048-81/+161
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Remove unused variable. It was write-only before r297139.kib2016-04-042-2/+0
| | | | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
| * Apparently there are some popular programs around which assume that itkib2016-03-222-2/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is safe to call pthread_mutex_init() on the same shared mutex several times. POSIX claims that the behaviour in this case is undefined. Make this working by only allowing one caller to initialize the mutex. Other callers either see already completed initialization and do nothing, or busy-loop yielding while designated initializer finishes. Also make the API requirements loose by initializing mutexes on other pthread_mutex*() calls if they see uninitialized shared mutex. Only mutexes provide the hack for now, but it could be also implemented for other process shared primitives from libthr. Reported and tested by: "Oleg V. Nauman" <oleg@opentransfer.com> Sponsored by: The FreeBSD Foundation
| * Lock pshared_lock shared around fork, to ensure that the COW snapshotkib2016-03-214-2/+22
| | | | | | | | | | | | | | of the pshared hash in child is consistent and can be safely used. Reported and tested by: "Oleg V. Nauman" <oleg@opentransfer.com> Sponsored by: The FreeBSD Foundation
| * Provide more information on failing checks in mutex_assert_is_owned()kib2016-03-211-4/+16
| | | | | | | | | | | | | | and mutex_assert_not_owned(). snprintf() use in this context should be safe. Sponsored by: The FreeBSD Foundation
| * From libthr, remove special and strange code to set up session andkib2016-03-212-22/+2
| | | | | | | | | | | | | | | | | | | | | | | | control terminal, activated when running with pid 1. It is application duty to handle this, and unsuspecting init replacements which are linked with libthr would be broken by this. The pre-resolving of getpid() is restored, just in case. Reviewed by: jilles Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
| * Implement process-shared spinlocks.kib2016-03-211-48/+59
| | | | | | | | Sponsored by: The FreeBSD Foundation
| * Fix typo.kib2016-03-211-1/+1
| | | | | | | | MFC after: 3 days
* | MFHgjb2016-03-103-0/+63
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-093-0/+63
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | MFHgjb2016-03-0214-309/+820
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Add two comments explaining the fine points of the hashkib2016-03-011-0/+31
| | | | | | | | | | | | | | | | implementation. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D5490
| * errno(3) -> errno(2)trasz2016-02-291-2/+1
| | | | | | | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
| * Implement process-shared locks support for libthr.so.3, withoutkib2016-02-2813-307/+788
| | | | | | | | | | | | | | | | | | | | | | | | breaking the ABI. Special value is stored in the lock pointer to indicate shared lock, and offline page in the shared memory is allocated to store the actual lock. Reviewed by: vangyzen (previous version) Discussed with: deischen, emaste, jhb, rwatson, Martin Simmons <martin@lispworks.com> Tested by: pho Sponsored by: The FreeBSD Foundation
| * If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbolskib2016-02-084-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | do not participate in the global symbols namespace, but rtld locks are still replaced and functions are interposed. In particular, __pthread_map_stacks_exec is resolved to the libc version. If a library is loaded later, which requires adjustment of the stack protection mode, rtld calls into libc __pthread_map_stacks_exec due to the symbols scope. The libc version might recurse into binder and recursively acquire rtld bind lock, causing the hang. Make libc __pthread_map_stacks_exec() interposed, which synchronizes rtld locks and version of the stack exec hook when libthr loaded, regardless of the symbol scope control or symbol resolution order. The __pthread_map_stacks_exec() symbol is removed from the private version in libthr since libc symbol now operates correctly in presence of libthr. Reported and tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* | MFHgjb2016-02-094-4/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | Remove libc, librtld_db, libthr packages, and further increasegjb2016-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | the constraints on what needs to be installed in a specific to maintain consistency during upgrades. Create a new clibs package containing libraries that are needed as a bare minimum for consistency. With much help and input from: kib Sponsored by: The FreeBSD Foundation
* | First pass through library packaging.gjb2016-02-041-0/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | More 'tests' bug fixes.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
OpenPOWER on IntegriCloud