joerg
74a7f3e6f2
Do not mark pthread_cond_timedwait explicitly as inlineable, since it
...
calls pthread__self, which is static.
2012-06-15 19:20:44 +00:00
joerg
8050d45d71
Simplify check for TLS definition to not hide code. Drop it in another
...
place as it is redundant.
2012-05-04 12:26:33 +00:00
enami
3cdda33922
Store allocated lwpctl state in the thread actually forked,
...
which is the only thread lives in the child process.
The problem originally reported here:
https://bugs.ruby-lang.org/issues/6341
2012-04-26 00:21:44 +00:00
christos
5662c2716e
trailing whitespace police.
2012-04-04 17:47:03 +00:00
joerg
b757af438b
Disable new -Wstring-plus-int warning where needed for now.
...
Adjust various places that add GCC-only options to check for the active
compiler first.
2012-04-04 10:59:44 +00:00
agc
76f4f39125
Add a pthread cancel stub for sigwait, following Onno van der Linden's
...
analysis in PR 45131. Kindly tested by Hisashi T Fujinaka (using csup
as the test case) with a successful outcome.
OK martin@
2012-04-04 06:29:16 +00:00
drochner
e917deee9c
don't reuse a dynamically allocated stack if a fixed one is requested
2012-03-22 20:01:18 +00:00
matt
fa835e8c8b
These directories default to WARNS?=5
2012-03-21 05:37:42 +00:00
joerg
e865ac2891
Move the pthread_once alias where it belongs.
2012-03-13 01:05:55 +00:00
joerg
77bfe129a9
Move pthread_once implementation into a separate file, it doesn't depend
...
on the mutex implementation in any way.
2012-03-12 21:35:10 +00:00
joerg
d3660af7b6
Keep track of the size of the guard area, in case we want to make it
...
modifiable later. Only reuse the stack if it was allocated by libpthread
and if the expected thread size matches the current stack size.
2012-03-12 20:16:52 +00:00
joerg
1d34190ecc
Further refine stack allocation. If the stack was provided by the user,
...
don't bother with setting up a guard page. Otherwise, round up the size
to page size. Point stack inside the guarded area, without the guard
page. Fix size when mprotect failed.
2012-03-12 16:37:15 +00:00
joerg
fa060fc8c7
Fix error handling
2012-03-10 18:01:10 +00:00
joerg
af435e468b
Use correct size.
2012-03-10 18:01:09 +00:00
drochner
677d666c8d
-fix initial stacksize rounding
...
-minor indentation fix
2012-03-09 12:06:44 +00:00
joerg
4acff4c01b
Implement sem_timedwait.
2012-03-08 21:59:24 +00:00
joerg
344a231144
Actually use the stack thread attributes when creating a new thread.
2012-03-08 16:40:45 +00:00
joerg
bfcb2008c8
Fix the stack base pointer for the initial thread on !HPPA.
...
AT_STACKBASE is pointing to the start of the stack, which is the
upper limit on platforms where the stack grows down.
2012-03-08 16:33:45 +00:00
joerg
d1de8de689
Remove libpthread's semaphore implementation and always use the kernel
...
one. The implementation doesn't provide an async-safe sem_post and can't
without a lot of work on the pthread primitives.
Remove bogus time out requirement in test case, it should have been
a "known failure" if anything.
2012-03-07 23:31:44 +00:00
joerg
d2be1428c2
Avoid getcontext() as it triggers clobbering warnings. Use inline
...
assembler to get the fields directly. Saves a system call as side
effect.
2012-03-02 23:19:47 +00:00
joerg
12529f382e
Fix indentation.
2012-03-02 18:11:53 +00:00
joerg
a56440951d
Separate pthread_t from thread stack. Drop additional alignment
...
restrictions on the thread stack. Remove remaining parts of stackid.
2012-03-02 18:06:05 +00:00
joerg
eab3272778
ld.elf_so is reentrant.
2012-02-03 21:11:17 +00:00
joerg
71d0bcc69f
Introduce __HAVE_NO___THREAD for sun2 and vax to disable the TLS usage.
...
Require __HAVE_TLS_VARIANT_I or __HAVE_TLS_VARIANT_II as well as
__lwp_getprivate_fast / __lwp_gettcb_fast to exist for libpthread.
Define VAX as going to use TLS variant I, if it is ever implemented.
2012-01-17 20:34:57 +00:00
wiz
6533efb150
Do not xref to itself.
2011-12-05 10:27:40 +00:00
jym
f3effc5ec2
Improvements in secmodel(9). Document secmodel_register(9), _deregister(9)
...
and _eval(9).
Add secmodel_extensions(9), and indicate the new sysctl(7) to let
ordinary users control the CPU affinity (user_set_cpu_affinity).
2011-12-04 21:08:37 +00:00
wiz
4a47c09250
Fix typo.
2011-11-10 16:44:47 +00:00
yamt
9c5d9163d1
document pthread_curcpu_np
2011-11-10 14:01:11 +00:00
christos
9924597a17
Include limits.h to get PTHREAD_KEYS_MAX, and move its definition there.
2011-10-06 16:03:48 +00:00
christos
0f48379f18
put back pthread__dbg variable; this is set to no zero by td_open() when
...
debugging to avoid multiple td_open() mess.
2011-10-02 18:18:56 +00:00
joerg
67f518f496
Use __dead
2011-09-16 16:05:58 +00:00
christos
5353040f23
document non-literal format strings
2011-08-16 10:35:03 +00:00
lukem
eca6fe7e73
fix spello in comment
2011-08-05 03:55:31 +00:00
joerg
5c2887509e
Don't kill the read(2) stub, just the magic around it.
2011-04-22 14:18:34 +00:00
joerg
77abb554dc
Disable Fortification for pthread and rump stubs.
2011-04-21 13:38:14 +00:00
martin
a128c5080b
Backout previous, it causes lots of test failures (tests/fs/nfs for
...
example).
2011-04-21 08:17:00 +00:00
christos
e6eca274ad
Fix SSP builds (Vladimir Kirillov)
2011-04-12 19:49:48 +00:00
joerg
928f301be9
Rework TLS initialisation:
...
- Update TCB for the initial thread in pthread__initthread, not
pthread__init to get it valid as soon as possible.
- Don't overwrite the pt_tls field in pthread__initthread.
- Don't deallocate pt_tls in pthread__scrubthread. This worked more by
chance than by design.
- Handle freeing the TLS area in pthread_create after removing the
thread instance from the dead queue.
2011-03-30 00:03:26 +00:00
matt
def13dad30
Add __HAVE___LWP_GETTCB_FAST support (for mips and powerpc).
2011-03-17 00:43:48 +00:00
joerg
01eef02a1b
If TLS support is present, use it for pthread__self(). The
...
initialisation order is correct in this case as _lwp_setprivate has been
called already by ld.elf_so for dynamic programs or _libc_init for
statically linked ones.
2011-03-16 12:39:44 +00:00
matt
71fdb89287
Use __lwp_gettcb_fast if present.
2011-03-12 07:46:29 +00:00
joerg
aad599979d
Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports
...
_rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to
setup the thread private area of all new threads. ld.elf_so is
responsible for setting up the private area for the initial thread.
Similar functions are called from _libc_init for static binaries, using
dl_iterate_phdr to access the ELF Program Header.
Add test cases to exercise the different TLS storage models. Test cases
are compiled and installed on all platforms, but are skipped on
platforms not marked for TLS support.
This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
It is inspired by the TLS support in FreeBSD by Doug Rabson and the
clean ups of the DragonFly port of the original FreeBSD modifications.
2011-03-09 23:10:05 +00:00
joerg
b7b592d544
Back out using the thread register (if present) for now.
...
libgcc_s's __register_frame_info gets called from libc's CSU code before
the libc constructors are run. __register_frame_info in turn calls
pthread_mutex_lock. libpthread is not initialised at this point and
therefore pthread__self() traps when deferencing the thread register.
This worked before because the garbage from pthread__self() is
effectively ignored.
2011-02-25 14:32:38 +00:00
joerg
1631a78097
Allow storing and receiving the LWP private pointer via ucontext_t
...
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.
Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.
This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
2011-02-24 04:28:41 +00:00
christos
4ffe9a1805
make the code more re-usable
2011-01-26 18:48:57 +00:00
christos
74a83d351e
Moving the ssp check inside the source code does not work properly because
...
the compiler loses information about the size of the object. So instead of
the hacky #define mess we did before, add a way to inject our function between
the user call and the system call.
2011-01-26 18:11:35 +00:00
christos
13fe5bd280
Fix SSP build.
...
XXX: This is gross.
2011-01-25 19:13:26 +00:00
christos
c5d359be42
make pthread__sp unsigned long.
2011-01-25 19:12:04 +00:00
skrll
f1d73a2c94
Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
...
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).
Mark libpthread as DF_1_NOOPEN and use it to test the functionality.
Somewhat taken from FreeBSD.
Fixes PR 42029.
OK from christos and joerg.
2010-12-24 12:41:42 +00:00
christos
736ce759b3
use pthread__stacksize since size has not been initialized yet.
2010-12-22 22:41:45 +00:00
christos
5cea6e6df8
only mprotect base if we moved it.
2010-12-22 22:19:46 +00:00
christos
66f16a1fa6
I've had this patch in my tree for a while and since it only improves
...
the situation, I decided to commit it. There is an inherent problem
with ASLR and the way the pthread library is using the thread stack.
Our pthread library chooses that stack for each thread strategically
so that it can locate the location of the pthread struct for each
thread by masking the stack pointer and looking just below the red
zone it creates. Unfortunately with ASLR you get many random values
for the initial stack, and there are situations where the masked
stack base ends up below the base of the stack. (this happens on
x86 when the stack base happens to be 0x???02000 for example and
your mask is stackmask is 0xffe00000). To fix this, we detect the
pathological cases (this happens only in the main thread), allocate
more stack, and mprotect it appropriately. Then we stash the main
base and the main struct, so that when we look for the pthread
struct in pthread__id, we can special case the main thread.
Another way to work around the problem is unlimiting stacksize,
but the proper way is to use TLS to find the thread structure and
not to play games with the thread stacks.
2010-12-18 15:54:27 +00:00
tron
103af04b49
Don't use internal libc function __findenv().
2010-11-14 22:25:23 +00:00
skrll
162991256a
Spell immediately correctly.
2010-11-02 20:49:47 +00:00
christos
5861d73fd7
move namespace protection before inclusion.
2010-08-06 15:21:50 +00:00
christos
e8deba048f
Add a weak alias for pthread_attr_get_np. Noted my Matthias Drochner.
2010-08-06 14:23:06 +00:00
wiz
6abd2b9ccc
Fix typo.
2010-08-06 06:29:38 +00:00
christos
ea1f852ab8
document pthread_getattr_np
2010-08-06 05:35:42 +00:00
christos
f6cf46930e
make kevent(2) a cancelation point, and document properly all the cancelation
...
points we currently support.
2010-08-06 05:25:46 +00:00
christos
32d8a48951
Add pthread_getattr_np()
2010-08-06 05:25:02 +00:00
wiz
4d7c45167f
Sort sections.
2010-07-09 20:58:38 +00:00
wiz
bb4a6891d0
Fix typo.
2010-07-09 20:56:01 +00:00
jruoho
b46f888960
Add a compatibility note. Also some minor improvements.
2010-07-09 18:16:31 +00:00
jruoho
be670be457
Update ERRORS, tidy SEE ALSO.
2010-07-09 18:07:20 +00:00
jruoho
267d79598f
Rearrange, reword, clarify. Remove duplicate paragraphs and recurring
...
sentences. Update the ERRORS to reflect reality in NetBSD.
2010-07-09 18:01:53 +00:00
jruoho
bc665d2683
Re-add EINVAL for pthread_condattr_destroy(3) (misread the pthread__error()).
2010-07-09 17:54:08 +00:00
jruoho
e328c0292c
Note also alignment via mmap(2), as done in NetBSD.
2010-07-09 17:15:59 +00:00
jruoho
c42287d313
As per (now closed) PR lib/43581, add a note about unsupported modifications
...
to the red zone size.
2010-07-09 17:03:04 +00:00
jruoho
dd981aaaa6
Remove error conditions. Add CAVEATS to note the questionable value of the
...
functions in NetBSD, which does not support additional condition attributes.
Note that these do not conform to SUSv4, where two additional attributes are
mandated.
2010-07-09 16:54:30 +00:00
jruoho
4ec5f0283b
Use .Ss for non-standard subtitle.
2010-07-09 12:00:38 +00:00
jruoho
10bc8c491b
Rewrite this for clarity. Also remove AUTHORS; someone was proud enough to
...
put himself as the author, even though the page was directly cut-and-pasted
from the Open Group's specification.
2010-07-09 11:03:26 +00:00
jruoho
70d17355ab
Add missing prototypes. Noted by wiz@ -- thanks.
2010-07-09 10:55:57 +00:00
wiz
83d2a68694
Mark up NULL.
2010-07-09 10:55:11 +00:00
wiz
f42b354e7d
Mark up NULL, remove double space.
2010-07-09 10:49:48 +00:00
wiz
2fb2239c33
Add missing word.
2010-07-09 10:45:36 +00:00
jruoho
379ef6d482
Fix the return values; pthread_resume_np() may fail with ESRCH. In addition,
...
some improvements to markup and wording.
2010-07-09 09:18:45 +00:00
jruoho
6f7f6ed0ba
Add the last compatibility note for the NetBSD extensions.
2010-07-09 09:10:34 +00:00
jruoho
9c4ae7f5c2
Update conformance to the 2001 revision.
2010-07-09 08:51:28 +00:00
wiz
b4d7d4fbfb
Sort errors.
2010-07-09 08:32:39 +00:00
wiz
c351e7655b
Remove empty line.
2010-07-09 08:31:35 +00:00
jruoho
6aa4892177
Rationalize by moving
...
pthread_key_delete(3) to pthread_key_create(3); and
pthread_setspecific(3) to pthread_getspecific(3)
2010-07-09 08:22:04 +00:00
jruoho
3cc3be4df9
Rationalize by moving
...
pthread_attr_setname_np(3) to pthread_attr_getname_np(3); and
pthread_setname_np(3) to pthread_getname_np(3).
2010-07-09 07:31:01 +00:00
jruoho
950e52c1c6
Ups. pthread_barrierattr_destroy(3) may fail with EINVAL.
2010-07-08 23:27:50 +00:00
jruoho
16fcf35f93
Cleanup errors; no error returns are defined in NetBSD. (The error codes
...
should be audited, and tested, for all pthread functions. Also the used
separation between "shall fail" and "may fail" should probably be removed.)
2010-07-08 23:23:37 +00:00
jruoho
8fe295c535
.Xr instaed of .Fn for pthread_mutex_init(3), update the error codes,
...
cleanup STANDARDS, etc.
2010-07-08 22:46:34 +00:00
jruoho
ec0cdba3c9
Group also pthread_attr_getschedparam(3) and pthread_attr_getschedpolicy(3),
...
as these two pages fit well together.
2010-07-08 22:19:26 +00:00
jruoho
290a8eeeb6
Add some remarks and clarifications, simplify RETURN VALUES, grammar, etc.
2010-07-08 21:48:07 +00:00
wiz
0ce392a24d
Add comma in enumeration, remove Xr to itself from SEE ALSO.
2010-07-08 21:35:09 +00:00
wiz
5a5247a953
Add comma in enumeration, sort errors.
2010-07-08 21:34:22 +00:00
wiz
75c6ae8ffe
Sort errors.
2010-07-08 21:34:06 +00:00
wiz
2376f0c4a6
Add comma in enumeration, sort errors.
2010-07-08 21:33:38 +00:00
jruoho
acb018ea1d
Split long lines, .Dv NULL, note pthread_barrierattr_init(3).
2010-07-08 20:59:43 +00:00
jruoho
0fcec3f1b2
Add missing word.
2010-07-08 20:09:29 +00:00
jruoho
baea5f9773
Continue the discussion with few remarks and rearrange slightly.
2010-07-08 20:07:23 +00:00
rmind
d199be9733
Merge/group man pages:
...
- pthread_barrier_{init,destroy,wait} into pthread_barrier(3).
- pthread_cond_* into pthread_cond(3).
- pthread_mutex_* into pthread_mutex(3).
- pthread_rwlock_* into pthread_rwlock(3).
- pthread_spin_* into pthread_spin(3).
Cross-link amongst groups.
OK jruoho@
2010-07-08 19:20:16 +00:00
wiz
feae669037
Add missing word.
2010-07-08 18:30:00 +00:00
wiz
92345efbda
Whitespace nit.
2010-07-08 18:24:34 +00:00
wiz
228b1868fd
Sort sections.
2010-07-08 18:15:27 +00:00
rmind
0dcf29f92e
pthread_create: simplify error path slightly.
2010-07-08 15:13:35 +00:00
jruoho
9d6f993b89
Rewrite and include a short summary.
2010-07-08 06:47:49 +00:00
jruoho
1540fc21ba
Finally, split pthread_attr_getschedpolicy() and pthread_attr_setschedpolicy()
...
to their own page.
2010-07-07 16:22:30 +00:00
jruoho
6218b6cbdb
Xref pthread_attr_getschedparam(3) and sched(3). Use a list for clarity.
2010-07-07 16:07:10 +00:00
jruoho
edddb28a67
Split pthread_attr_getschedparam() and pthread_attr_setschedparam() to a
...
separate page.
2010-07-07 16:04:19 +00:00
jruoho
cf6053f7b6
Split pthread_attr_getinheritsched() and pthread_attr_setinheritsched() to a
...
separate page, and actually document these.
2010-07-07 15:30:32 +00:00
jruoho
904af291c8
Move pthread_attr_getguardsize() and pthread_attr_setguardsize() to a
...
separate page, and actually document these.
2010-07-07 13:04:20 +00:00
jruoho
40267ee9ae
Fix some minor errors/typos and clarify.
2010-07-07 12:49:15 +00:00
jruoho
2bf45345db
Move the thread stack attribute functions to a separate page. In addition,
...
document pthread_attr_getstack() and pthread_attr_setstack(). Try to also
document these a little better (in particular, note some items in the long
list of caveats and questions related to application-controlled thread stack).
2010-07-07 11:04:52 +00:00
njoly
0eab175c82
Add missing list end.
2010-07-07 10:22:33 +00:00
wiz
c4ed068736
Sort sections.
2010-07-07 09:54:07 +00:00
jruoho
dbb0e63cfb
Split pthread_attr_getdetachstate(3) and pthread_attr_setdetachstate(3) to a
...
separate page. Once ready, the main page, pthread_attr(3), will contain a
summary of the various thread attribute functions.
2010-07-07 08:57:36 +00:00
jruoho
7f32058c79
Remove pthread_attr_getscope() and pthread_attr_setscope().
2010-07-07 08:41:11 +00:00
jruoho
69ff1aa9c5
Move pthread_attr_{g,s}etscope() to a separate page and try to document
...
these better. Should fix PR lib/41831 from Wolfgang Stukenbrock.
XXX: Please proofread.
2010-07-07 08:22:53 +00:00
njoly
aab619738e
Add missing list end.
2010-07-06 23:15:47 +00:00
jruoho
6a595a491d
Same here; fix LIBRARY, add COMPATIBILITY/ERRORS, etc.
2010-07-06 22:24:56 +00:00
jruoho
ae0626ba0d
Fix LIBRARY. Add ERRORS and COMPATIBILITY. And some small improvements.
2010-07-06 21:54:12 +00:00
jruoho
935deb263f
Document pthread_attr_get_np(). Fixes PR lib/39289 from ahoka@.
2010-07-06 21:36:34 +00:00
dholland
4035b6ee7d
Improve wording describing the behavior of the attributes argument, and
...
add reference to pthread_attr(3), as requested in PR 42871. The text
added is different from but based on a suggestion by Matthew Mondor.
2010-06-07 04:36:34 +00:00
jruoho
ebe1a1a443
Use a list with the mutex type. Note, from the standard, that recursive
...
mutexes should be avoided when condition variables are used.
2010-05-20 05:19:29 +00:00
jruoho
f395ce5a84
Use similar markup than in pthread_mutex_init(3) etc. with the initializer
...
macro. Improve wording slightly.
2010-05-20 04:47:38 +00:00
jruoho
128d933f6d
.Fa -> .Fn.
2010-05-20 04:41:11 +00:00
jruoho
6e31029d91
Note the initializer macros.
2010-05-20 04:40:23 +00:00
jruoho
9bfaa34d66
Build links for rest of the pthread_attr(3) functions.
...
Hopefully I got all of them right in the setlist...
2010-05-19 20:04:42 +00:00
jruoho
cd2244d3a2
Xref timespec(3).
2010-05-18 06:31:17 +00:00
jruoho
9127e9f198
.Dv.
2010-05-16 12:36:32 +00:00
jruoho
e55b912b81
Add the Butenhof's book to SEE ALSO. (It was decent enough when I read it
...
years ago, but if there are better ones, please feel free to add those.)
2010-05-16 12:23:32 +00:00
jruoho
8292b0e60f
Enumerate the functions in a table instead of a big SEE ALSO.
...
Also some stylistic changes.
2010-05-16 12:20:00 +00:00
explorer
fc70b598c4
fix the pthread pt_lid in the fork callback function that runs in the child instead of a function that may be going away. KNFify
2010-03-25 01:15:00 +00:00
explorer
3f82e012db
Correctly set pt_lid in the child, after a fork
2010-03-24 07:27:22 +00:00
drochner
1982972a07
catch up with the __RENAME of nanosleep(2) a while ago, otherwise we
...
get the compatibility function which assumes a different struct timespec
2010-03-23 20:35:44 +00:00
joerg
f70c7c0422
Use .In instead of .Ar Pa
2010-03-22 21:56:05 +00:00
rmind
63a834705c
pthread_attr(3): sync with reality i.e. uncomment descriptions about
...
various functions we support. Fix license style.
2009-10-05 23:37:01 +00:00
rmind
26ce5a50b4
pthread(3): mention that we use 1:1 threading model; remove descriptions
...
of no longer used environment variables.
2009-10-05 23:35:42 +00:00
rmind
81bc3e51a5
Add check to avoid multiple inclusions and redefinitions.
...
KNF while here.
2009-10-05 23:33:48 +00:00
christos
85ddadbfdc
Don't just look only at the first element in the deadqueue to find lwp's
...
to reuse, because if we lose the race with the kernel we are never going
to reuse any elements. Look in the whole list instead.
XXX: should be pulled up to 5.x
2009-10-03 23:49:50 +00:00
enami
cc63c84008
Make nanosleep cancelable again.
2009-08-12 23:51:23 +00:00
rumble
b222d9680b
"unblocks the mutex" -> "unlocks the mutex"
2009-07-02 19:43:06 +00:00
joerg
cdb510a7bb
Restore use of _lwp_makecontext, the AMD64 bug has been fixed.
2009-07-02 09:59:00 +00:00
joerg
35173b1fce
Partially revert 1.110: Use makecontext again until the problems with
...
_lwp_makecontext are solved.
2009-06-25 13:38:43 +00:00
njoly
49931fb2d8
Restore PTHREAD__ASM_RASOPS for alpha (from _context_u.S), that was
...
lost in previous cleanup.
ok by ad@.
2009-05-18 13:03:35 +00:00
ad
61cac435e4
- Convert from makecontext() -> _lwp_makecontext().
...
- Rely on _lwp_makecontext() to set up the thread identity register.
This is not currently done (a bug), nor does libpthread use the
threadreg yet. I'm doing this so it the code can be used by the
person working on TLS to verify that their threadreg code is working.
2009-05-17 14:49:00 +00:00
ad
a61915e94f
Remove unused code that's confusing when using cscope/opengrok.
2009-05-16 22:20:40 +00:00
wiz
8b5179c21c
Add CAVEATS section:
...
Due to limitations in the current pthread implementation, makecontext(3)
and sigaltstack(2) should not be used in programs which link against
libpthread (whether threads are used or not).
Wording from drochner@ and ad@
Bump date for man pages.
Add note in libpthread/README so it's not forgotten to update the man
pages when the problem is fixed.
2009-04-16 18:37:29 +00:00
wiz
7d9f3abb75
Avoid duplicate .Pp.
2009-04-11 16:51:39 +00:00
wiz
c32974546d
Remove trailing whitespace.
2009-04-11 16:51:28 +00:00
joerg
d3c6cf0458
.\" are comments, not ./"
2009-04-11 15:35:15 +00:00
drochner
f1c955a1b2
Fix the comparision function used by the red-black tree global thread list
...
implementation:
-don't return a difference, this can overflow
-don't try to substract typed pointers which don't belong to the
same object, this gives undefined results
This fixes instabilities of programs which use more than a handful
of threads, eg spuriously failing pthread_join().
2009-04-01 10:13:24 +00:00
ad
7de9da978b
Revert the _lwp_ctl which is causing problem. I did test this locally,
...
I guess not well enough.
2009-03-30 21:32:51 +00:00
ad
5c670ea686
- Make the threadreg code use _lwp_setprivate() instead of MD hooks.
...
XXX This must not be enabled by default because the LWP private mechanism
is reserved for TLS. It is provided only as a test/demo.
XXX Since ucontext_t does not contain the thread private variable, for a
short time after threads are created their thread specific data is unset.
If a signal arrives during that time we are screwed.
- No longer need pthread__osrev.
- Rearrange _lwp_ctl() calls slightly.
2009-03-29 09:30:05 +00:00
ad
a46df1f1f2
pthread_barrier: Fix numerous stupid bugs. Surprising that nobody
...
complained yet.
2009-01-29 21:19:35 +00:00
wiz
0aec71a9f5
Fix typo.
2009-01-24 13:00:03 +00:00
rmind
909e7f4259
- Make thread-affinity and processor-set interfaces mutually exlusive.
...
- pset_assign: when CPU is assigned, migrate out all LWPs from it.
2009-01-20 01:57:35 +00:00
lukem
a06595c27b
fix -Wsign-compare issues
2009-01-18 12:14:16 +00:00
christos
6343ca254d
fix __sigtimedwait50
2009-01-13 01:50:04 +00:00
christos
461a86f9bd
merge christos-time_t
2009-01-11 02:45:45 +00:00
wiz
42fdda0454
Bump date for previous.
2008-12-31 14:19:51 +00:00
christos
4a65af23ac
mention that these may fail with EPERM. From Anon Ymous
2008-12-31 13:57:54 +00:00
christos
62f7265ebd
revert previous. It was meant for the branch
2008-12-29 15:08:03 +00:00
christos
6c20e81ce2
adjust for time_t 64
2008-12-28 21:33:35 +00:00
ad
ebaaa8cf7a
Some things to do on major bump.
2008-12-28 11:01:58 +00:00
ad
18e73e1ebe
Replace semid_t with intptr_t. No function change. This is a libc/kernel
...
private interface and so the name change should not affect any third
party code.
2008-11-14 15:49:20 +00:00
uwe
55247fa322
Fix typo in comment.
2008-10-27 00:52:07 +00:00
uwe
47cd7b4502
Pull down revision 1.3.6.1 by skrll@ (adapted to include reg::r_gbr).
...
struct mcontext != struct reg on sh3.
Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT to deal with this.
2008-10-27 00:47:22 +00:00
mrg
fb8d95d826
check for ${PTHREAD_MACHINE_ARCH} before ${MACHINE_ARCH} or ${MACHINE_CPU}
2008-10-26 00:00:27 +00:00
yamt
639a0868fd
remove ; after __weak_alias()
2008-10-25 14:14:11 +00:00
snj
682ea0e2b3
s/explicitely/explicitly/
2008-10-19 21:27:46 +00:00
rmind
43819fe5ab
Do not recommend to mix affinity(3) with pset(3).
2008-10-18 03:37:41 +00:00
ad
6f7d0483cf
pthread_attr_getschedparam: allow without preceding setparam on the
...
attr structure.
2008-10-10 09:13:20 +00:00
ad
8572b64ab0
Clarifications for PTHREAD_DIAGASSERT.
2008-10-08 10:11:11 +00:00
ad
beaa63b638
Disable diagnostic assertions by default and just return error codes like
...
other systems. Allows poorly written applications to appear working. If you
are developing pthread apps please turn it on manually by setting the
environment variable.
2008-10-08 10:03:28 +00:00
ad
fdc51b51d9
Adjust the compat stuff slightly so that the changes are mostly self
...
contained (Makefile, pthread_compat.c).
2008-10-08 08:27:07 +00:00
ad
844fcfc979
make PTHREAD__COMPAT=1
...
Builds a libpthread that can be dropped into a NetBSD 2/3/4 chroot.
This makes threading work in the chroot when using a NetBSD 5 kernel, no
other modifications required.
2008-09-29 08:48:15 +00:00
rmind
0f80b1578d
Arguments were swapped for cpuset_set(), cpuset_clr(), cpuset_isset()
...
functions, but man pages were not updated (hi Christos!).
2008-09-12 13:39:04 +00:00
skrll
0b99767bfe
Remove unnecessary include.
2008-08-11 21:45:24 +00:00
matt
2b0c4dcffd
Change pthread_mutex_t to use the amount of space as and be congruent to
...
the version used in the SA version of pthreads. This preserves binary
compatibility between both versions of the library.
2008-08-02 19:46:30 +00:00
matt
c0038aadef
Change some type to eliminate some lint warnings.
2008-08-02 16:02:26 +00:00
pooka
6ebb8696c9
add pthread_cond_has_waiters_np()
2008-07-18 16:17:11 +00:00
gmcgarry
5aa0bc7608
Selector registers are 16-bit and binutils 2.18 insists that only 16-bit
...
accesses are permitted on them. Therefore, change movl to movw. No change to
machine code generated.
2008-07-07 13:01:16 +00:00
ad
b4c1afd422
Shut lint up.
2008-06-28 16:50:43 +00:00
ad
27e50f7c64
Avoid spurious assertion failure.
2008-06-28 10:37:20 +00:00
ad
0e006eeb6f
Minor correction to previous.
2008-06-28 10:36:12 +00:00
ad
cbd43ffa55
Now that we have all the scheduling gunk, make these do something useful:
...
pthread_attr_get_np
pthread_attr_setschedparam
pthread_attr_getschedparam
pthread_attr_setschedpolicy
pthread_attr_getschedpolicy
2008-06-28 10:29:37 +00:00
ad
403a399142
pthread_attr_setstacksize: EINVAL if the requested size is less than
...
sysconf(_SC_THREAD_STACK_MIN).
2008-06-25 11:07:07 +00:00
ad
39a9e71121
pthread_join: explicitly test for cancellation.
2008-06-25 11:06:34 +00:00
ad
6d153667e5
pthread_kill, pthread_sigmask: return errno, not the return from the system
...
call. Found by VSTHlite.
2008-06-24 13:45:07 +00:00
ad
10ba267505
Split cond_signal/cond_broadcast into inline and non-inline parts, like
...
the kernel.
2008-06-23 11:01:19 +00:00
ad
d9a30823e2
Move call to pthread__self() later.
2008-06-23 11:00:53 +00:00
ad
3e1711d6de
pthread__threadreg_get: mark it const.
2008-06-23 10:39:38 +00:00
ad
edbc7575cc
pthread_curcpu_np: remove hack for pthread_dummy_lwpctl.
2008-06-23 10:38:39 +00:00
ad
49b506e72f
PR lib/38948: libpthread, java: thread awakening itself
2008-06-21 11:27:41 +00:00
rmind
e6acd90e07
- Add affinity(3) manual page, which describes thread affinity,
...
pthread_setaffinity_np(3) and pthread_getaffinity_np(3) functions,
provides simple code example.
- Add cpuset(3) manual page, which describes API of CPU-sets.
Thanks <wiz> for many improvements!
2008-06-16 14:25:49 +00:00
ad
271002f500
Back out previous because it breaks the build.
2008-06-05 23:38:51 +00:00
ad
b4ad7b01a5
glibc compatibile PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, requested by
...
rafal@.
2008-06-05 21:40:17 +00:00
uwe
c39ae7f5d7
Recycle unused _REG_EXPEVT slot in mcontext for _REG_GBR.
...
As the size of mcontext is not changed, we avoid the hassle of
versioning all the calls that use it.
_REG_EXPEVT was never used by any code in the tree. Reporting EXPEVT
makes sense only for signals and in that case we pass it to userland
in ksi_trap already which is official MI way to get this (MD) information.
Old binaries running on new kernels will now have their GBR set from
new mcontext, but that's ok too, as GBR was not properly supported by
old kernels (not saved in trapframe), so old binaries couldn't have
possibly used it anyway.
2008-06-01 23:07:20 +00:00
wiz
afa117e7f9
Sort sections. Use more markup.
2008-05-26 08:45:55 +00:00
wiz
5904699302
Sort ERRORS.
2008-05-26 08:43:57 +00:00
wiz
6a46b478a7
Remove trailing whitespace.
2008-05-26 08:43:41 +00:00
wiz
e1070e84ea
Remove duplicate (pasto?) RETURN VALUES section.
2008-05-26 08:43:08 +00:00
wiz
5ae93b7856
Remove trailing whitespace.
2008-05-26 08:41:42 +00:00
ad
c4612ba227
More blurb about the mutex and limitations.
2008-05-26 02:25:05 +00:00
ad
3ad4fb5234
Note that when calling pthread_cond_broadcast/signal, the same mutex as
...
passed to wait/timedwait must be held.
2008-05-26 02:16:48 +00:00
ad
bd2852ae8c
Add a comment describing some limitiations of this implementation.
2008-05-26 02:06:21 +00:00
ad
9d566f8240
Note that apps with real-time threads shouldn't use spinlocks because of
...
the danger of deadlock, and note that in general spinlocks suck and mutexes
should be used instead!
2008-05-26 00:31:08 +00:00
ad
6458d64f4c
- Eliminate one test+branch.
...
- Fix a comment.
- Fix a lock leak.
2008-05-26 00:16:35 +00:00
ad
dec5fb2e52
pthread_cond_timedwait: don't leak EINTR or EALREADY to the caller.
2008-05-25 23:51:31 +00:00
ad
49ec182c8c
Fix error in previous.
2008-05-25 17:11:13 +00:00
ad
2bcb8bf1c4
PR lib/38741 priority inversion in libpthread breaks apps that use
...
SCHED_FIFO threads
- Change condvar sync so that we never take the condvar's spinlock without
first holding the caller-provided mutex. Previously, the spinlock was only
taken without the mutex in an error path, but it was enough to trigger the
problem described in the PR.
- Even with this change, applications calling pthread_cond_signal/broadcast
without holding the interlocking mutex are still subject to the problem
described in the PR. POSIX discourages this saying that it leads to
undefined scheduling behaviour, which seems good enough for the time being.
- Elsewhere, use a hash of mutexes instead of per-object spinlocks to
synchronize entry/exit from sleep queues.
- Simplify how sleep queues are maintained.
2008-05-25 17:05:28 +00:00
ad
d5afa113a1
Add some general comments about the mutex implementation.
2008-05-25 12:29:59 +00:00
wiz
04845dabb5
Assign to TNF. Make 2-clause instead of 3.
...
Ok: co-copyright owner hubertf@.
2008-05-09 08:31:13 +00:00
martin
637bc2e71d
Move TNF licenses to 2 clause form
2008-05-04 19:43:05 +00:00
martin
cd22f25e6f
Move TNF licenses to 2 clause form
2008-05-02 18:11:04 +00:00
martin
11a6dbe728
Convert TNF licenses to new 2 clause variant
2008-04-30 13:10:46 +00:00
martin
ce099b4099
Remove clause 3 and 4 from TNF licenses
2008-04-28 20:22:51 +00:00
ad
ecdd2c2965
Cheat and add inlines for _atomic_cas_ptr() to work around gcc emitting
...
unneeded PIC stuff in mutex_lock() and mutex_unlock(), when a thread
register is used.
2008-03-22 17:59:12 +00:00
ad
783e2f6db5
Back out previous. It seems to expose another bug in libpthread/libc,
...
potentially errno being used before threading is up and running.
2008-03-22 14:19:27 +00:00
ad
159f554369
Move pthread__errno() into pthread_specific.c so it gets the "no stack
...
frame" treatment.
2008-03-21 21:35:43 +00:00
rmind
2ac12931eb
Add sched(3) manual page, and appropriate links.
...
Thanks <wiz> for review and fixes!
2008-03-10 14:47:06 +00:00
ad
61f666ba09
_pthread_rwlock_held_np: if write locked, only return true if held by
...
the current thread.
2008-03-08 13:46:59 +00:00
ad
eceac52f08
Complain if _lwp_ctl() fails.
2008-03-08 13:23:13 +00:00
ad
8b2c109b14
Add a cast to make lint happy.
2008-03-08 13:22:22 +00:00
ad
55faac1242
pthread_key_create: instead of using a simple 1/0 value to record a key
...
as allocated, use an array of pointers and save __builtin_return_address(0)
so keys can be identified when doing post-mortem debugging.
2008-03-07 22:27:07 +00:00
ad
8548e33886
pthread__mutex_lock_slow:
...
- don't stop spinning if there are already waiters on the mutex, there is
no point.
- cosmetic change.
2008-03-07 22:23:57 +00:00
ad
6869216239
Fix pthread_mutex_trylock() for recursive mutexes. PR lib/38087.
...
Based on a patch provided by rafal@.
2008-02-23 15:15:57 +00:00
ad
377f098ab0
Adjust mutex/rwlock definitions to match reality now that there is only
...
one implementation of each. PR lib/38030.
2008-02-14 21:40:51 +00:00
ad
a67e1e3475
- Remove libpthread's atomic ops.
...
- Remove the old spinlock-based mutex and rwlock implementations.
- Use the atomic ops from libc.
2008-02-10 18:50:54 +00:00
ad
9c43df3853
We've got the priority/class stuff now.
2008-02-10 14:52:05 +00:00
yamt
603e4b9abd
update for _sched_{get,set}param changes. from rmind@.
2008-02-09 17:01:51 +00:00
christos
a0e4739ced
PR/37932: Yakovetsky Vladimir: build distribution with USE_FORT fails
...
Avoid read redefinition
2008-02-02 17:09:29 +00:00
ad
d8251138f4
pthread_rwlock_wrheld_np: return true only if locked by the calling thread.
2008-01-31 11:50:40 +00:00
mlelstv
58dedb340c
use the correct symbols
2008-01-31 10:07:09 +00:00
rmind
b5e9addd22
sched_setparam: fix the case when incorrect (according to the class)
...
in-kernel priority is used. Reported by <drochner>.
Minor fixes for scheduling calls to conform the POSIX:
- If pid is equal to zero, use the calling process;
- In case of permission problem, return EPERM instead of EACESS;
- sched_setscheduler() should return previously used policy;
- pthread_* calls should return the error code or zero;
Should fix the namespace problems (and builds of some packages):
- Move cpuset_t defintion from pset.h to sched.h;
- Remove the #include of pset.h in pthread.h;
2008-01-26 17:55:29 +00:00
rafal
2e86943de9
Make this compile after Andrew's fix (remove now-unused variables)
2008-01-25 02:12:10 +00:00
ad
bba572530b
pthread_mutex_lock_slow: remove "deliberate deadlock" code that's not
...
needed with 1:1. PR lib/37524.
2008-01-25 01:09:18 +00:00
christos
19884cbfe6
s/set/test/
2008-01-19 16:05:34 +00:00
christos
f2df27b721
only include <sys/pset.h> if _NETBSD_SOURCE
2008-01-19 16:03:48 +00:00
rmind
5c71a4d49f
Implementation of processor-sets, affinity and POSIX real-time extensions.
...
Add schedctl(8) - a program to control scheduling of processes and threads.
Notes:
- This is supported only by SCHED_M2;
- Migration of LWP mechanism will be revisited;
Proposed on: <tech-kern>. Reviewed by: <ad>.
2008-01-15 03:37:10 +00:00
christos
c6409540ef
add missing static decls.
2008-01-08 20:56:08 +00:00
christos
6c924f05f9
cast -1 to unsigned int.
2008-01-08 20:55:58 +00:00
christos
72f5cf0283
no semis after weak alias.
2008-01-08 20:55:25 +00:00
yamt
48a1e4cf46
pthread_curcpu_np: map LWPCTL_CPU_NONE to 0 so that this works in the case
...
of _lwp_ctl failure.
2008-01-07 11:51:43 +00:00
ad
b43749fde1
machine/lock.h, not sys/lock.h
2008-01-05 01:37:35 +00:00
ad
622bbc505a
- Use pthread__cancelled() in more places.
...
- pthread_join(): assert that pthread_cond_wait() returns zero.
2007-12-24 16:04:20 +00:00
ad
989565f81d
- Fix pthread_rwlock_trywrlock() which was broken.
...
- Add new functions: pthread_mutex_held_np, mutex_owner_np, rwlock_held_np,
rwlock_wrheld_np, rwlock_rdheld_np. These match the kernel's locking
primitives and can be used when porting kernel code to userspace.
- Always create LWPs detached. Do join/exit sync mostly in userland. When
looped on a dual core box this seems ~30% quicker than using lwp_wait().
Reduce number of lock acquire/release ops during thread exit.
2007-12-24 14:46:28 +00:00
ad
8f05f9cc26
Update.
2007-12-24 14:30:09 +00:00
yamt
45cbede9e5
document following functions.
...
pthread_attr_getname_np
pthread_attr_setname_np
pthread_getname_np
pthread_setname_np
2007-12-14 21:51:21 +00:00
ad
5a5d5865cd
Remove test of pthread__osrev that is no longer needed.
2007-12-11 03:21:30 +00:00
ad
37132d5d2f
Back out previous now that libc/libpthread are initialized first.
2007-12-07 20:36:52 +00:00
ad
a9718d7115
pthread__mutex_lock_slow: avoid entering the waiters list if a race to
...
acquire the mutex is lost. Removing the current thread from the waiters
list requires at least one syscall.
2007-12-07 01:38:38 +00:00
yamt
f078e05288
pthread__mutex_wakeup: ignore ESRCH from _lwp_unpark.
...
once we clear pt_sleeponq, the target thread can proceed further
and even do pthread_exit.
2007-12-04 16:56:11 +00:00
yamt
fc51c23a2d
remove unnecessary assignments.
2007-12-04 16:08:28 +00:00
wiz
a6e62b1ef7
Use more markup. New sentence, new line.
2007-12-01 19:03:26 +00:00