Commit Graph

19824 Commits

Author SHA1 Message Date
ryoon
2da2192d78 Remove trailing whiteapaces and tab 2020-02-05 14:56:04 +00:00
kamil
91719d9fbd Retire ifdef ERRORCHECK in pthread(3)
It is enabled unconditionally since 2003 and used only for rwlocks and
spinlocks.

LLVM sanitizers make assumptions that these checks are enabled always.
2020-02-05 11:05:10 +00:00
wiz
d210ba75a0 Remove trailing whitespace. 2020-02-05 08:14:36 +00:00
christos
8d83da913d Mention that we don't honor the other mode bits. 2020-02-04 18:36:16 +00:00
kamil
31ebab1943 Revert previous
'git grep' breaks now.
2020-02-01 18:14:16 +00:00
kamil
f93ad70739 Remove 'ifdef 0' hacks
It is no longer needed as the proper fix avoiding premature malloc()
landed the sources.
2020-02-01 15:39:56 +00:00
kamil
089c97bd22 Switch atform allocations from malloc()+free() to mmap()+munmap()
This avoid bootstrapping malloc too early when libc+libpthread are not
ready. It is called through pthread__init() -> _pthread_atfork().

This also helps LLVM Leak Sanitizer to pacify false positive reports.
2020-02-01 15:38:46 +00:00
kamil
260b3a1721 Refactor libpthread checks for invalid arguments
Switch from manual functions to pthread__error().
2020-01-31 17:52:14 +00:00
christos
bbb79fe856 In the same spirit as the previous pthread_mutex_init change for jemalloc,
make pthread_mutexattr_init do always a full initialization, so that the
attribute that will be used later when we become threaded is properly
initialized.
2020-01-31 02:37:46 +00:00
joerg
782b126d2c Provide frexpl on non-long-double systems as alias to frexp. 2020-01-30 20:31:50 +00:00
kamil
12ee584ac8 Use pthread_mutexattr_t and pthread_mutex_t magic fields
Validate _PT_MUTEX_MAGIC in pthread_mutex_t and _PT_MUTEXATTR_MAGIC
in pthread_mutexattr_t accordingly.
2020-01-29 21:11:24 +00:00
ad
fb0af629d1 - pthread_join(): remove temporary hack now kernel returns correct errno.
- kill(getpid(), SIGABRT)  ->  _lwp_kill(_lwp_self(), SIGABRT)
2020-01-29 17:11:57 +00:00
kamil
08c17fb31c Check thread->pt_magic with PT_MAGIC promptly 2020-01-29 16:34:09 +00:00
kamil
20668e1417 Chack thread->pt_magic with PT_MAGIC promptly
Rearrange some checks to avoid verifying pthread_t after using it.
2020-01-29 16:03:44 +00:00
kamil
ac02e87024 Revert previous
Two assignments are correct.
2020-01-29 15:31:14 +00:00
kamil
0b0b4cd405 Do not set stackbase2 twice for !__MACHINE_STACK_GROWS_UP 2020-01-29 15:15:00 +00:00
kamil
e06a99c91d Use pthread_condattr_t and pthread_cond_t magic fields
Validate _PT_CONDATTR_MAGIC and _PT_COND_MAGIC respectively.
2020-01-29 15:07:46 +00:00
kamil
7f6f4173b3 Use pthread_barrierattr_t and pthread_barrier_t magic fields
Set respectively _PT_BARRIER_DEAD for pthread_barrier_destroy() and
_PT_BARRIERATTR_DEAD for pthread_barrierattr_destroy().

Validate _PT_BARRIER_MAGIC in pthread_barrier_t and _PT_BARRIERATTR_MAGIC
in pthread_barrierattr_t accordingly.
2020-01-29 14:41:57 +00:00
kamil
b3401c13c3 Use the pta_magic field in pthread attribute
Set PT_ATTR_DEAD on pthread_attr_destroy().
Check pta_magic before using pthread_attr_t in a bunch of other functions.
2020-01-29 13:47:31 +00:00
kamil
d48cac510b Mark destroyed pthread_mutexattr_t as dead 2020-01-29 10:55:23 +00:00
ad
c6559e920a - A bit more alignment in __pthread_st especially for the rbtree node.
- Use COHERENCY_UNIT from sys/param.h.
2020-01-28 13:08:40 +00:00
ad
a15e545ef6 pthread_join(): add a temporary hack to make lib/libpthread/t_detach pass.
The correct fix is to do this in kernel (I have that change, but it's part
of the wider change to index LWPs in a tree).
2020-01-28 09:23:15 +00:00
ad
60f1ad4e64 Make x86 use the C versions of bcmp() and memcmp(). 2020-01-27 22:08:08 +00:00
ad
cd1754ab41 pthread_detach(), pthread_join(): go back to using _lwp_detach() and
_lwp_wait(), rather than doing it all in userspace.  There's less to go
wrong.  Doesn't seem to be a performance penalty.
2020-01-27 20:50:05 +00:00
ad
e354694931 Adjustment to previous: don't call _lwp_unpark_all() with nwaiters == 0. 2020-01-25 18:30:41 +00:00
ad
047ca71b68 pthread_exit(): it looks there there is at least one path through which
a thread can exit with waiters still hanging off it (cancellation when
waiting on a condvar) so deal with all/any crappy failure like that and
make sure there are never any waiters left before exiting.  Maybe of help
for:

PR: bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2
2020-01-25 18:01:28 +00:00
ad
769155beb0 pthread__mutex_unlock_slow(): ignore the DEFERRED bit. It's only purpose
is to get the thread to go through the slow path.  If there are waiters,
process them there and then.  Should not affect well behaved apps.  Maybe
of help for:

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad
2020-01-25 17:58:28 +00:00
ad
edf01486dd - Fix a race between the kernel and libpthread, where a new thread can start
life without its self->pt_lid being filled in.

- Fix an error path in _lwp_create().  If the new LID can't be copied out,
  then get rid of the new LWP (i.e. either succeed or fail, not both).

- Mark l_dopreempt and l_nopreempt volatile in struct lwp.
2020-01-25 15:41:52 +00:00
pgoyette
fccfbe317e Fix name of keyword so it will worwk correctly. :) 2020-01-23 16:34:12 +00:00
mgorny
ac78ffd6ff Fix using gcc's unwind.h 2020-01-22 16:07:40 +00:00
mgorny
26a48dd100 Install gcc's unwind.h instead of libexecinfo's
The prototypes in libexecinfo's unwind.h do not match those commonly
used (e.g. by gcc, clang, GNU libunwind, LLVM libunwind...), causing
C++ programs to fail to build on type mismatches (e.g. compiler-rt,
libc++abi).  Rather than providing our own header, reuse the one
included in gcc.
2020-01-22 15:10:31 +00:00
kamil
e4e4859de1 Adjust the error return value of pthread_sigmask for !libpthread usage
Instead of returning -1, return errno on error.

Catch up after the fix in libpthread by Andrew Doran in 2008
in lib/libpthread/pthread_misc.c r.1.9.

It's an open question whether this function shall be used without linked
in the POSIX thread library.

Detected by Bruno Haible (GNU) and documented in gnulib in commit
"pthread_sigmask: Avoid test failure on NetBSD 8.0. " r. 4d16a83b0c1fcb6c.
2020-01-14 18:18:59 +00:00
joerg
174eb28ace Fix atfork malloc handling to include all the locks in old jemalloc. 2020-01-13 19:14:37 +00:00
joerg
2de10fd665 Fix aarch64 definition in old jemalloc
There is no platform-specific reason for avoiding TLS. The tiny
allocations should be aligned the same as small allocations for ABI
reasons.
2020-01-13 19:14:02 +00:00
ad
510021886a Rip out some very ambitious optimisations around pthread_mutex that are
don't buy much.  This stuff is hard enough to get right in the kernel let
alone userspace, and I don't trust that it's right.
2020-01-13 18:22:56 +00:00
abhinav
2d114b3c14 PR lib/54510 - when user supplied completion function is there,
don't unescape the string to be completed.
2020-01-05 07:12:05 +00:00
tih
52de8937af Summary: Remove over-simplified extraneous test
The file name matching code in libedit tries to adjust to the presence
of explicit " or ' characters in the input line, but tries too hard.
Remove a conditional that goes overboard, and causes the completion
code to fail if a quoted string is seen before the filename to be
expanded, as in

	  grep 'foo' bar<TAB>

Before this change, the above would not expand any possible
completions, even if they existed, because it would choose to look for
files whose names started with " bar".
2020-01-05 00:03:27 +00:00
kamil
4677d24ff4 Document PT_LWPSTATUS and PT_LWPNEXT in ptrace(2)
Remove mentions of obsolete PT_LWPINFO.
2020-01-04 04:40:17 +00:00
msaitoh
417c7af79c s/conjuction/conjunction/ 2019-12-27 10:13:59 +00:00
msaitoh
ba5c90c4a4 s/sucess/success/ in comment. 2019-12-27 09:45:26 +00:00
msaitoh
a0403cde04 s/transfered/transferred/ 2019-12-27 09:41:48 +00:00
msaitoh
a5effc3ce9 s/inital/initial/ 2019-12-27 09:25:57 +00:00
msaitoh
40064e2457 s/lenght/length/ 2019-12-26 04:53:11 +00:00
joerg
8e5b2c30bd Since pthread_setspecific requires locks, ensure that they are acquired
before fork and dropped in both parent and child. At least Python
depends on TSD after fork, even though it is undefined behavior in
POSIX.
2019-12-25 00:44:45 +00:00
reed
030d4fb522 Simply Subsection headers
There was a formatting issue with mandoc showing the
literal "Ss" macros. I reported this bug to mandoc since groff
didn't have same formatting. It was recommended to simplify
the formatting due to the weird feature.
Note because of this for groff I didn't use the Ux macro but spelled
out UNIX literally for these subsection headers
(since the macro reset the subsection formatting which was why
the Ss macro was repeated before to reactivate it).
2019-12-23 17:51:57 +00:00
kamil
cd653c6e17 Explain in kevent(2) the semantics of EINTR
All changes contained in the changelist are applied before returning this
error.
2019-12-23 01:46:09 +00:00
kamil
e6ecafaf7d Document udata type switch in struct kevent in the kqueue(2) 2019-12-22 17:01:15 +00:00
leot
4bf7b66e0f tcgetsid() is defined in <termios.h>, not <sys/types.h> or <unistd.h>. 2019-12-19 16:12:21 +00:00
joerg
7ed25834ce Bump PTHREAD__UNPARK_MAX to 128 as bandaid for locking related hangs. 2019-12-18 15:11:57 +00:00
christos
8282cab4e4 move file/lib after xz 2019-12-18 02:46:21 +00:00