Commit Graph

639 Commits

Author SHA1 Message Date
Sergey Kandaurov
70c4c58519 Fix typo in ".PATH" 2012-04-18 07:02:53 +00:00
Warner Losh
4c3cf69727 Merge from tbemd:
Convert from using MACHINE_ARCH to MACHINE_CPUARCH.  Hoist path statement
up into the top Makefile rather than repeating it on every arch Makefile.
2010-06-13 01:27:29 +00:00
Ruslan Ermilov
96aad9c013 Though these libraries are disconnected from the build and don't
currently build, they should be kept.  [1]

Unbreak their makefiles by removing the support for the long gone
DEFAULT_THREAD_LIB knob.  (Allows the tools/make_libdeps.sh script
to succeed.)

According to:	davidxu and deischen [1]
MFC after:	3 days
2010-02-15 14:14:13 +00:00
Ken Smith
3ca3047aee Bump the version of all non-symbol-versioned shared libraries in
preparation for 8.0-RELEASE.  Add the previous version of those
libraries to ObsoleteFiles.inc and bump __FreeBSD_Version.

Reviewed by:    kib
Approved by:    re (rwatson)
2009-07-19 17:25:24 +00:00
Jung-uk Kim
455cc6ec70 Honor WITHOUT_INSTALLLIB in some places. 2009-02-13 16:51:36 +00:00
Doug Rabson
cd7d66a21f Call the fcntl compatiblity wrapper from the thread library fcntl wrappers
so that they get the benefit of the (limited) forward ABI compatibility.

MFC after: 1 week
2008-05-30 14:47:42 +00:00
Christian Brueffer
662cac9f23 Fix some "in in" typos in comments.
PR:		121490
Submitted by:	Anatoly Borodin <anatoly.borodin@gmail.com>
Approved by:	rwatson (mentor), jkoshy
MFC after:	3 days
2008-03-26 07:32:08 +00:00
Dag-Erling Smørgrav
04539c7099 Add missing #include
Spotted by:	tinderbox
Submitted by:	Pietro Cerutti <gahr@gahr.ch>
Pointy hat to:	des
2008-02-06 23:25:29 +00:00
Dag-Erling Smørgrav
0957bb7d29 Add pthread_mutex_isowned_np() here as well; libthr and libkse are supposed
to have identical functionality.

MFC after:	2 weeks
2008-02-06 20:44:29 +00:00
Dag-Erling Smørgrav
7035cef466 Previous commit had a typo that resulted in symbol versioning being
(silently) disabled for libkse...

Pointy hat to:	des
2008-02-06 20:33:59 +00:00
Dag-Erling Smørgrav
d197ee06fc Give libkse the same treatment as libthr re. symbol versioning.
MFC after:	2 weeks
2008-02-06 20:30:48 +00:00
Daniel Eischen
3462c3c752 When reinitializing a lockuser, don't assume that the lock is in
use.  If it is in use, use the watched request, otherwise use the
lockuser's own request.  Only allocate a lockuser request if both
requests are null.

PR:	119920
Tested by (6.x):	Landon Fuller <landonf -at- bikemonkey -dot- org>
2008-01-31 19:38:26 +00:00
Daniel Eischen
3d6d3ed091 Remove hacks to allow libkse to export its symbols in the LIBTHREAD_1_0
version namespace which was needed before the library version was
bumped.
2007-12-16 23:29:57 +00:00
Daniel Eischen
396a73603d Set the tcb (thread control block) in the child process after a fork.
This protects against a race with an upcall in the parent during the
fork which can clobber the parent's tcb before the vm space is copied
in the child.  The child then gets a corrupted tcb that is either null
or that points to another thread that doesn't exist in the child (after
a fork, only the fork()ing thread exists in the child).

Reported by:	Arno J. Klaassen (arno at heho / snv / jussieu / fr)
2007-12-06 06:04:01 +00:00
Robert Watson
22d661040e For un-prototyped static inline functions declared in pthread_md.h on
ia64, powerpc, and sparc64, use ANSI function headers and specifically
indicate the lack of arguments with 'void'.  Otherwise, warnings are
generated at WARNS=3, leading to a compile failure with -Werror.
2007-12-01 14:23:29 +00:00
Daniel Eischen
eb63e604ea WARNS=3'ify. 2007-11-30 17:20:29 +00:00
Daniel Eischen
0442ae6dc7 Initialize the current thread and signal locks so that sigaction()
will work after a fork().

WARNS=3'ify.
2007-11-30 17:16:14 +00:00
Brooks Davis
3c42c4abed To reduce the impact of possible removal of the syscalls required by
libkse in FreeBSD 8.0, do not build or install static versions of libkse
(i.e. libkse*.a) in the default case.  Static versions will be built and
installed if libthr is not built or if libkse is the default threading
library.

Discussed on:	freebsd-arch
MFC after:	3 days
2007-11-29 21:49:08 +00:00
Jason Evans
b6b7fd3e2a Fix pointer dereferencing problems in _pthread_mutex_init_calloc_cb() that
were obscured by pseudo-opaque pthreads API pointer casting.
2007-11-28 00:16:24 +00:00
Jason Evans
e1636e1f97 Add _pthread_mutex_init_calloc_cb() to libthr and libkse, so that malloc(3)
(part of libc) can use pthreads mutexes without causing infinite recursion
during initialization.
2007-11-27 03:16:44 +00:00
David Xu
eb326f14a2 Move the added code in revision 1.26 into function pthread_key_create,
it should be there.
2007-11-26 02:35:17 +00:00
John Birrell
0aad0f2282 These are the things that the tinderbox has problems with because it
doesn't use the default CFLAGS which contain -fno-strict-aliasing.

Until the code is cleaned up, just add -fno-strict-aliasing to the
CFLAGS of these for the tinderboxes' sake, allowing the rest of the
tree to have -Werror enabled again.
2007-11-20 02:07:30 +00:00
David Xu
4940ef4ad0 MFlibthr:
In _pthread_key_create() ensure that libkse is initialized.
2007-11-19 02:09:07 +00:00
Kris Kennaway
2017a7cdfe Add a new "non-portable" mutex type, PTHREAD_MUTEX_ADAPTIVE_NP. This
is also implemented in glibc and is used by a number of existing
applications (mysql, firefox, etc).

This mutex type is a default mutex with the additional property that
it spins briefly when attempting to acquire a contested lock, doing
trylock operations in userland before entering the kernel to block if
eventually unsuccessful.

The expectation is that applications requesting this mutex type know
that the mutex is likely to be only held for very brief periods, so it
is faster to spin in userland and probably succeed in acquiring the
mutex, than to enter the kernel and sleep, only to be woken up almost
immediately.  This can help significantly in certain cases when
pthread mutexes are heavily contended and held for brief durations
(such as mysql).

Spin up to 200 times before entering the kernel, which represents only
a few us on modern CPUs.  No performance degradation was observed with
this value and it is sufficient to avoid a large performance drop in
mysql performance in the heavily contended pthread mutex case.

The libkse implementation is a NOP.

Reviewed by:      jeff
MFC after:        3 days
2007-10-29 21:01:47 +00:00
David E. O'Brien
a928dfb7b4 For 7.0 make the shared lib "version" '3'.
Approved by:	re(kensmith)
2007-10-10 16:59:14 +00:00
David E. O'Brien
65c045e964 Repo copy libpthreads to libkse.
This introduces the WITHOUT_LIBKSE nob,
and changes WITHOUT_LIBPTHREADS to mean with neither threading libs.
Approved by:	re(kensmith)
2007-10-09 13:42:34 +00:00
Ruslan Ermilov
152f2a4a96 Always install libpthread.* symlinks if at least one of
the threading libraries is built.  This simplifies the
logic in makefiles that need to check if the pthreads
support is present.  It also fixes a bug where we would
build a threading library that we shouldn't have built:
for example, building with WITHOUT_LIBTHR and the default
value of DEFAULT_THREADING_LIB (libthr) would mistakenly
build the libthr library, but not install it.

Approved by:	re (kensmith)
2007-10-01 18:22:32 +00:00
Daniel Eischen
419ecd5dee Bump library versions in preparation for 7.0.
Ok'd by:	kan
2007-05-21 02:49:08 +00:00
Ruslan Ermilov
539e7a7770 Fix a logic bug I re-introduced in my patch I sent to Daniel
that would cause the selected shared threading library to be
overwritten with its 32-bit version on amd64.

PR:		amd64/112509
2007-05-18 12:25:48 +00:00
Daniel Eischen
683f4c0a40 Allow DEFAULT_THREAD_LIB to be set from /etc/src.conf.
Submitted by:	ru
2007-05-17 04:54:35 +00:00
Daniel Eischen
00fb440c1a Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.
Warning, after symbol versioning is enabled, going back is not easy
(use WITHOUT_SYMVER at your own risk).

Change the default thread library to libthr.

There most likely still needs to be a version bump for at least the
thread libraries.  If necessary, this will happen later.
2007-05-13 14:12:40 +00:00
Daniel Eischen
23daef56b3 Catch up with the renaming of the private version namespace. 2007-04-29 15:27:23 +00:00
Daniel Eischen
96c57267f5 Add a reference and lock the target thread when setting its name.
Submitted by:	davidxu (via libthr)
2007-04-23 03:36:14 +00:00
Brian Somers
d5d9eb5095 Oops, fix a typo in the last commit :-/ 2007-03-05 19:00:49 +00:00
Brian Somers
ee12856f1d In the NOTYET code path when a process forks, the remaining
child thread goes back to system scope rather than process
scope.  This allows an ensuing exec() to actually work.

This change was made a year ago here, but I "forgot" to
commit it :(

Approved by:	deischen
MFC after:	3 weeks
2007-03-05 17:47:27 +00:00
Warner Losh
fed32d7544 Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
Peter Edwards
977e36e94a Clean bound and non-bound pthread structures consistently before
they become candidates for reuse.  Without this fix, some of the
state from a thread structure's previous incarnation could interfere
with its new one. Specifically, a non-bound thread started as
"suspended" (see pthread_attr_setcreatesuspend_np()) might not get
scheduled at all when resumed, as the "active" flag would be set
spuriously.

Reviewed by: deischen@, davidxu@
MFC after: 1 week
2006-12-18 17:08:07 +00:00
David Xu
6f54e82927 If a thread was detached, return EINVAL instead, the error code
is also returned by pthread_detach() if a thread was already
detached, the error code was already documented:

>    [EINVAL]	The implementation has detected that the value speci-
>		fied by thread does not refer to a joinable thread.
2006-11-28 11:05:31 +00:00
Marcel Moolenaar
4d630a8f11 Stylize:
o  avoid using a global register variable.
o  redefine struct ia64_tp as a union. We don't have to get to the
   fields themselves. We just need it to be of the right size with
   the right alignment.
2006-09-01 21:25:22 +00:00
Marcel Moolenaar
4c91d168a7 The ucontext is 16-byte aligned, which means that struct tcb is
16-byte aligned. Consequently, struct tcb is a multiple of 16
bytes in size. We need to make sure there's no padding after
struct ppc32_tp. We do this by explicitly adding the necessary
padding in front of it.
2006-09-01 19:13:36 +00:00
Marcel Moolenaar
5df93cb787 Stylize. Introduce ppc_{get|set}_tp() and ppc_{get|set}_tcb() to
abstract the magic that happens when deriving one or the other.
2006-09-01 17:52:13 +00:00
Marcel Moolenaar
20b18e870b Implement TLS. 2006-09-01 06:17:16 +00:00
Ruslan Ermilov
2b46c64c9c Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
Maxim Konovalov
0295184c7e o Remove a cruft prevented libpthread sigaction(2) wrapper to
do its work for SIGINFO.  Always install libpthread signal handler
wrapper for SIGINFO even if user SIG_IGN's or SIG_DFL's it.

SIGINFO has a special meaning for libpthread: when LIBPTHREAD_DEBUG
enviroment variable defined it is used for dumping an information
about threads to /tmp/.

Reported by:	mi
Reviewed by:	deischen
MFC after:	2 weeks
2006-06-09 14:23:40 +00:00
David Xu
0eb14dbdd6 Export offsets of thread signal pending set and signal mask for debugger. 2006-05-17 04:59:59 +00:00
David Xu
7649f45c3e In order to let new binutils can compile it, replace movl with
movw for segment saving and restoring.

Submitted by: Diego 'Flameeyes' Petteno flameeyes at gentoo dot org
2006-05-07 08:19:04 +00:00
Xin LI
34562de4d5 Unexpand TAILQ_FIRST(foo) == NULL to TAILQ_EMPTY.
Ok'ed by:	davidxu
2006-04-13 03:09:34 +00:00
Ruslan Ermilov
84e709f1f1 Install shared libpthread library into /lib; needed by some
/sbin programs.
2006-04-12 19:42:20 +00:00
Dag-Erling Smørgrav
1e5e6f25c5 Bring libpthread up to WARNS level 2.
Reviewed by:	deischen
2006-03-29 05:38:19 +00:00
Dag-Erling Smørgrav
adb19548bd Fix prototype mismatch and use of un-namespaced pthread functions. 2006-03-28 21:50:12 +00:00