Commit Graph

483 Commits

Author SHA1 Message Date
Stefan Farfeleder
ad7c49168f - Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.
- Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST.

OK'ed by:	deischen
2005-08-19 21:31:42 +00:00
Ken Smith
a84020c2b9 Bump the shared library version number of all libraries that have not
been bumped since RELENG_5.

Reviewed by:	ru
Approved by:	re (not needed for commit check but in principle...)
2005-07-22 17:19:05 +00:00
John Baldwin
2bd979f7a3 Mark _thread_exit() and __sys_exit() as __dead2 to quiet some warnings. 2005-05-31 19:57:23 +00:00
John Baldwin
94e7919893 Style tweak. 2005-05-31 19:56:52 +00:00
Xin LI
8dcb56dc78 Provide more POSIX-complaint ttyname_r(3) interface[1], which is slightly
different from what has been offered in libc_r (the one spotted in the
original PR which is found in libthr has already been removed by David's
commit, which is rev. 1.44 of lib/libthr/thread/thr_private.h):
	- Use POSIX standard prototype for ttyname_r, which is,
		int ttyname_r(int, char *, size_t);
	  Instead of:
	  	char *ttyname_r(int, char *, size_t);
	  This is to conform IEEE Std 1003.1, 2004 Edition [1].
	- Since we need to use standard errno for return code, include
	  errno.h in ttyname.c
	- Update ttyname(3) implementation according to reflect the API
	  change.
	- Document new ttyname_r(3) behavior
	- Since we already make use of a thread local storage for
	  ttyname(3), remove the BUGS section.
	- Remove conflicting ttyname_r related declarations found in libc_r.

Hopefully this change should not have changed the API/ABI, as the ttyname_r
symbol was never introduced before the last unistd.h change which happens a
couple of days before.

[1] http://www.opengroup.org/onlinepubs/009695399/functions/ttyname.html

Requested by:	Tom McLaughlin <tmclaugh sdf lonestar org>
Through PR:	threads/76938
Patched by:	Craig Rodrigues <rodrigc crodrigues org> (with minor changes)
Prompted by:	mezz@
2005-05-13 16:27:30 +00:00
Joe Marcus Clarke
d525de835f Increase the default stacksizes:
32-bit		64-bit
main thread	2 MB		4 MB
other threads	1 MB		2 MB

Adapted from:	libpthread
Approved by:	deischen
2005-02-28 17:15:31 +00:00
Jeffrey Hsu
2353e77b0f More fixes to the copyright notice.
Submitted by:	Ken Smith <kensmith@cse.Buffalo.EDU>
2005-01-08 17:16:43 +00:00
Jeffrey Hsu
c26a1d9f0e Fix copyright notice. 2005-01-08 01:59:36 +00:00
Ruslan Ermilov
ab7a294721 NODOCCOMPRESS -> NO_DOCCOMPRESS
NOINFO -> NO_INFO
NOINFOCOMPRESS -> NO_INFOCOMPRESS
NOLINT -> NO_LINT
NOPIC -> NO_PIC
NOPROFILE -> NO_PROFILE
2004-12-21 09:33:47 +00:00
Greg Lehey
00c948e4ce Add pthread_atfork().
PR:  		bin/68841
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
2004-12-10 03:36:45 +00:00
David Schultz
6004362e66 Don't include sys/user.h merely for its side-effect of recursively
including other headers.
2004-11-27 06:51:39 +00:00
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
Stefan Farfeleder
4eae39bfdf Avoid using void pointers in additive expressions.
PR:		56653
2004-08-14 17:46:10 +00:00
Colin Percival
1c81bd2c60 style cleanup: Remove duplicate $FreeBSD$ tags.
These files had tags after teh copyright notice,
inside the comment block (incorrect, removed),
and outside the comment block (correct).

Approved by:	rwatson (mentor)
2004-02-10 20:45:28 +00:00
Daniel Eischen
baadb27d98 Correct the link for the profiling library. 2004-01-31 17:00:04 +00:00
Daniel Eischen
bd224d495e Change libkse back to libpthread and make it the default
thread library for i386, amd64, and ia64.  For alpha
and sparc64 the library is not changed and remains libkse,
and links are installed so that libpthread -> libc_r.

The gcc -pthread option will be changed in a separate
commit so that it links to -lpthread instead of -lc_r.

Approved by:	re@
2004-01-30 12:13:17 +00:00
Daniel Eischen
39edba076e Initialize the (i386) frame pointer when setting up a thread
context.

Submitted by:	Marc Olzheim <marcolz@stack.nl>
Tested by:	Marc Olzheim <marcolz@stack.nl>
2004-01-22 19:15:08 +00:00
Ruslan Ermilov
ec7452f103 Have a single set of POSIX threads man pages. The LIBRARY section
of each manpage lists libraries that have corresponding interfaces
implemented.

Prodded by:	threads
Reviewed by:	deischen
2004-01-14 21:44:26 +00:00
Ruslan Ermilov
1f0bfc3ee5 The libc_r/man/sigwait.3 manpage has been repocopied to libc/sys/sigwait.2.
Reviewed by:	deischen
Repocopy by:	markm
2004-01-14 21:22:10 +00:00
Ruslan Ermilov
fccedf067d - libc/sys/sem.c was repocopied to libc/gen/sem.c.
- sem_*(3) manpages were repocopied from libc_r.

Reviewed by:	deischen
Repocopy by:	markm
2004-01-14 20:54:16 +00:00
Daniel Eischen
7d7a08f174 MFlibpthread: Add a simple work-around for deadlocking on recursive
readlocks on a rwlock while there are writers waiting.
2004-01-08 15:39:12 +00:00
Daniel Eischen
eae42a5949 Reenable signals for threads after joining.
Submitted by:	Marc Olzheim <marcolz@stack.nl>
2003-12-31 13:41:54 +00:00
Ruslan Ermilov
e09cec395d Pull revision 1.13 from libpthread/man/pthread_mutex_init.3:
- Remove error code that can't be returned (and original description
  was not proper English)

PR:		docs/57434
2003-12-30 15:44:16 +00:00
Daniel Eischen
6512f49fe6 Return to the caller if write() returns 0.
PR:	59291
2003-12-17 16:44:03 +00:00
Peter Wemm
29f2f145e4 For the amd64 we need to do some extra stack alignment fixups. Otherwise
we can end up with some threads with a non-16-byte-aligned stack.  This
causes some interesting side effects, including general protection
faults leading to a SIGBUS when doing floating point or varargs.  This
should be just a verbose NOP for the other platforms.

Approved by:  re (scottl)
2003-12-03 06:54:40 +00:00
Daniel Eischen
fcd58c1978 If __sys_write() returns 0, allow that to exit the loop in libc_r's
wrapped version of write().

Submitted by:	dan@langille.org
2003-09-29 13:41:26 +00:00
Ruslan Ermilov
959d6c24f6 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Mark Peek
6fcd700395 Add wrapper for kqueue() to keep track of the allocated fd and allow it to
be closed. This fixes a file descriptor leak when closing a kqueue() fd.

Reviewed by:	deischen
MFC after:	1 week
2003-07-25 17:02:33 +00:00
Daniel Eischen
209afb2603 Remove -D_THREAD_SAFE.
Submitted by:   Craig Rodrigues <rodrigc@crodrigues.org>
2003-07-13 05:35:30 +00:00
Ruslan Ermilov
a5d7d2028e Make libc/${MACHINE_ARCH} include directory not required by Alpha.
Submitted by:	bde
Tested by:	beast
2003-07-02 13:27:54 +00:00
Alexander Kabaev
3867e1fd68 libc/${MACHINE_ARCH} include directory is required by Alpha,
add it to CFLAGS.
2003-07-02 01:52:06 +00:00
Ruslan Ermilov
0b3cbc5c38 Axe AINC.
Submitted by:	bde
2003-07-01 15:07:01 +00:00
Alexander Leidinger
f970961773 Sanity check fd before using it as an array index.
Noticed by:	ted@NLnetLabs.nl (Ted Lindgreen)
Approved by:	ru
2003-06-09 16:45:37 +00:00
Philippe Charnier
ab165955de The .Fn function 2003-06-08 10:13:50 +00:00
Marcel Moolenaar
fee5c3f1f8 Make this compile without warnings on 64-bit architectures:
Don't cast thread_self() to int. Cast to uintptr_t. Pull in the
predefined printf format from <inttypes.h>
2003-06-04 20:38:54 +00:00
Marcel Moolenaar
f10382ac87 Make this compile without warnings on 64-bit architectures:
In recurse(), cast the pointer difference to int to match the format.
The difference is expected to fit in an int.
2003-06-04 20:36:08 +00:00
Mike Makonnen
f833c84a8f If the library is not able to create a thread because resources
don't allow it at the moment, the correct thing to do is try again.
Otherwise, libthr would fail this test because it doesn't allow
an unlimited number of concurrent threads per application.
2003-06-04 08:16:32 +00:00
Peter Wemm
19816dec92 Update for amd64 after repocopy from i386/ 2003-06-02 22:30:59 +00:00
Peter Wemm
3aefe09423 Port libc_r to amd64, and turn it back on for amd64. It passes all of
the same src/lib/libc_r/test/* tests that the other platforms pass.
2003-06-02 22:22:52 +00:00
Robert Watson
778f8875c7 Revert accidental change: don't change the thread library for testing to
libthr.  Oops, sorry about that.

Submitted by:	"Simon L. Nielsen" <simon@nitro.dk>
2003-06-02 00:21:41 +00:00
Robert Watson
0bbe770d6f Include string.h for memset(). 2003-06-01 23:03:49 +00:00
Ruslan Ermilov
61fa6d584f Fixed another bug in the threaded close() call; clear the
stale stdio descriptors flags.

PR:		bin/51535
Submitted by:	Enache Adrian <enache@rdslink.ro>
Reviewed by:	deischen
Approved by:	re (scottl)
2003-05-31 05:23:20 +00:00
Ruslan Ermilov
d635dc4671 If an application closes one of its stdio descriptors (0..2),
an excessive close() on one of these descriptors would cause
a memory for this descriptor to be allocated in the internal
descriptor table.  When this descriptor gets used again, e.g.
through the call to open() or socket(), the descriptor would
be erroneously left in the blocking mode, and the whole
application would get stuck on a blocking operation, e.g.,
in accept(2).

Prevent this bug from happening by disallowing close() against
non-active descriptors (return -1 and set errno to EBADF in
this case).

Reviewed by:	deischen
Approved by:	re (scottl)
2003-05-31 05:20:44 +00:00
Ruslan Ermilov
734ac3b543 mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-24 19:53:08 +00:00
John Polstra
8c0d4b5f92 Add stub implementations of pthread_[gs]etconcurrency to libc_r and
libthr.  No changes were made to libpthread by request of deischen,
who will soon commit a real implementation for that library.

PR:		standards/50848
Submitted by:	Sergey A. Osokin <osa@freebsd.org.ru>
MFC after:	1 week
2003-04-20 01:53:13 +00:00
Jeff Roberson
cc3521d660 - Define a _spinunlock() function so that threading implementations may do
more complicated things than just setting the lock to 0.
 - Implement stubs for this function in libc and the two threading libraries
   that are currently in the tree.
2003-03-26 04:02:24 +00:00
Philippe Charnier
9d09157a0f The .Fn function. Use .Xr where appropriate. 2003-03-24 16:05:24 +00:00
Marcel Moolenaar
cafd6dbd76 Fix threaded applications on ia64 that are linked dynamicly. We did
not save (restore) the global pointer (GP) in the jmpbuf in setjmp
(longjmp) because it's not needed in general. GP is considered a
scratch register at callsites and hence is always restored after a
call (when it's possible that the call resolves to a symbol in a
different loadmodule; otherwise GP does not have to be saved and
restored at all), including calls to setjmp/longjmp. There's just
one problem with this now that we use setjmp/longjmp for context
switching: A new context must have GP defined properly for the
thread's entry point. This means that we need to put GP in the
jmpbuf and consequently that we have to restore is in longjmp.
This automaticly requires us to save it as well.

When setjmp/longjmp isn't used for context switching, this can be
reverted again.
2003-03-05 04:39:24 +00:00
Marcel Moolenaar
d4f7f050a8 Don't cast an int to a pointer type without (possibly) widening the
integral type to the size of a pointer type when it's known that the
cast is valid. On ia64 such casts are generally bad news and has led
us (=peter :-) to make such casts fatal. By casting to intptr_t
before casting to a pointer type, this now compiles cleanly in LP64
architectures. Note that the final cast has been changed to void*
(instead of siginfo_t*) to make it explicit that we're not trying to
pass a siginfo_t pointer but rather trying to pass an int when the
prototype says it should be a pointer.
2003-03-05 04:28:08 +00:00