Commit graph

325 commits

Author SHA1 Message Date
Dag-Erling Smørgrav d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
David E. O'Brien 07a7a2eba8 The GCC developers have made good on their threats against #pragma for 3.1.
Use __weak_reference in place of the #pragma.

Submitted by:	eischen
2002-04-15 23:11:38 +00:00
David E. O'Brien cb81cd7952 Sync SCM ID comments with libc. 2002-04-15 20:22:28 +00:00
Jeroen Ruigrok van der Werven 92d2baa6a2 Return correct number of total bits set in all fd_set's.
Change case of POLLNVAL as an error.
Remove POLLHUP and POLLERR from one case, their place is most likely
amongst read events.

PR:		33723
Submitted by:	Alexander Litvin <archer@whichever.org>
Reviewed by:	deischen [Provided a small change to the PR patch as well]
MFC after:	4 weeks
2002-04-09 05:41:00 +00:00
Mark Murray 4cd0119367 Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
Daniel Eischen 3003bdb598 Add the ability to recognize old references to keys, and return NULL
when old keys are referenced (after pthread_key_delete()) via
pthread_getspecific().
2002-03-19 22:58:56 +00:00
Brian S. Dean b18ae9245d Fix the return code from pthread_rwlock_try[rw|rd]lock() functions;
these should return EBUSY when the calling thread would block.

MFC after: 2 weeks
2002-03-15 18:27:58 +00:00
Daniel Eischen ca4b2c1a79 Properly clear the status of a join operation if the joining thread is
canceled or the joinee is detached.
2002-03-06 19:28:41 +00:00
Daniel Eischen 9e9c4443f6 Don't rely on <sys/signal.h> to include <sys/ucontext.h> 2002-02-17 17:21:27 +00:00
Maxim Konovalov 0878d2e5e9 Correct a typo pthread_attr_setscope() function fails unconditionally
due to.

PR:		misc/30699
Reviewed by:	jasone, ru
Approved by:	jasone, ru
MFC after:	1 week
2002-02-14 15:20:36 +00:00
Daniel Eischen 69c287d288 This has been sitting in my local tree long enough. Remove the use
of an alternate signal stack for handling signals.  Let the kernel
send signals on the stack of the current thread and teach the threads
signal handler how to deliver signals to the current thread if it
needs to.  Also, always store a threads context as a jmp_buf.  Eventually
this will change to be a ucontext_t or mcontext_t.

Other small nits.  Use struct pthread * instead of pthread_t in internal
library routines.  The threads code wants struct pthread *, and pthread_t
doesn't necessarily have to be the same.

Reviewed by:	jasone
2002-02-09 19:58:41 +00:00
Daniel Eischen 2d170746c7 Use the real function address (instead of function address + 8) for the
return address when modifying a jmp_buf to create a new thread context.
Also set t12 with the return address.

This should fix libc_r on alpha.

With much detective work by: Bernd Walter <ticso@cicely.de>
2001-12-22 06:11:06 +00:00
Daniel Eischen 7512c816c0 Fix the retrieval of USRSTACK via sysctl so that it works for 64-bit
archs.  This should fix libc_r on alpha.

Submitted by:	Bernd Walter <ticso@cicely9.cicely.de>
2001-12-18 02:02:59 +00:00
Daniel Eischen 320bfcf3f1 When cancelling a thread while in a join operation, do not detach
the target thread of the join operation.  This allows the cancelled
thread to detach the target thread in its cancellation handler.
This bug was found by Butenhof's cancel_subcontract test.

Reviewed by:	jasone
2001-12-16 13:26:44 +00:00
Daniel Eischen 35686a943a Pull the target thread of a join operation from the correct place
when cancelling a thread.
2001-12-15 15:52:24 +00:00
Daniel Eischen ccc7b69205 Fix pthread_join so that it works if the target thread exits while
the joining thread is in a signal handler.

Reported by:	Loren James Rittle <rittle@labs.mot.com>
MFC after:	1 week
2001-11-17 14:28:39 +00:00
Murray Stokely 5e77dc7342 Describe handling of NULLs passed to pthread_setcancelstate().
PR:		docs/31745
Submitted by:	Andrew <andrew@ugh.net.au>
2001-11-05 08:21:32 +00:00
Dima Dorfman 5e52f30031 Mark up NULL in .Dv.
PR:		31747
Submitted by:	<andrew@ugh.net.au>
2001-11-04 23:13:03 +00:00
Peter Wemm eb9053b12f Make libc_r check the kern.usrstack sysctl instead of using internal
kernel #defines to figure out where the stack is located.  This stops
libc_r from exploding when the kernel is compiled with a different
KVM size.  IMHO this is all kinda bogus, it would be better to just
check %esp and work from that.
2001-10-26 21:19:22 +00:00
Ruslan Ermilov 98f9b06876 Style: sort __sys_foo() prototypes, tabs -> spaces, etc. 2001-10-26 18:45:02 +00:00
Ruslan Ermilov 53cff25eeb Removed:
- uthread_signal.c; libc_r does not wrap signal() since 1998/04/29.

- uthread_attr_setprio.c; it was never connected to the build, and
  pthread_attr_setprio() does not exist in POSIX.

- uthread_sigblock.c and uthread_sigsetmask.c; these were no-ops
  bloating libc_r's space.

pthread_private.h:

- Removed prototypes of non-syscalls: send().

- Removed prototypes of unused syscalls: sigpending(), sigsuspend(),
  and select().

- Fixed prototype of fork().

- MFS: Fixed prototypes of <sys/socket.h> syscalls.

Reviewed by:	deischen
Approved by:	deischen, jasone
2001-10-26 17:46:36 +00:00
Peter Wemm 9d91d74d2b Change #include "DEFS.h" to <machine/asm.h>. 2001-10-25 01:30:54 +00:00
Bruce Evans 6eabd84580 Compensate for "Compensate for header dethreading" by backing it out. 2001-10-10 17:48:44 +00:00
Daniel Eischen 7ae9a22df2 Limit maximum poll interval to 60 seconds. This prevents an overflow
from occurring when converting from a timeval/timespec to a timeout in
milliseconds.

Submitted by:	dwmalone
2001-10-07 02:34:43 +00:00
Ruslan Ermilov 32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov d6002fef6f Use ``.Rv -std'' wherever possible.
Submitted by:	yar
2001-08-31 09:57:38 +00:00
Kris Kennaway 6dac8ac9e5 Mark some functions as __printflike() and/or taking const char * arguments
instead of char *.

MFC after:	2 weeks
2001-08-20 12:53:36 +00:00
Jason Evans 204e56e381 Fix logic errors in pthread_cond_wait() and pthread_cond_timedwait() that
could cause deadlock after interruption due to a signal.

Reviewed by:	deischen
2001-08-19 20:05:42 +00:00
Jason Evans 8588aeec8c Fix a bug in canceling joining threads.
Do not detach canceled threads.

Reported by:		Arno Klaassen <arno@heho.snv.jussieu.fr>
Collaboration with:	deischen
2001-08-16 06:31:32 +00:00
Ruslan Ermilov 04da392069 mdoc(7) police: s/OpenBSD/.Ox/ where appropriate. 2001-08-13 16:43:02 +00:00
Ruslan Ermilov c5e7e03a14 Spell "FreeBSD" with "F" and "BSD" in uppercase. 2001-08-13 16:33:00 +00:00
Ruslan Ermilov 8af1452cf8 Removed duplicate VCS ID tags, as per style(9). 2001-08-13 14:06:34 +00:00
Warner Losh e54b5dd9ff Make the name parameter const char *. 2001-08-11 05:16:00 +00:00
Yaroslav Tykhiy b1250632c5 Use the ``.Rv -std'' mdoc(7) macro in appropriate cases.
Reviewed by:	ru
2001-08-09 13:32:13 +00:00
Jason Evans aa33517e94 Implement pthread_attr_[gs]etguardsize(). Non-default-size stacks used to
be malloc()ed, but they are now allocated using mmap(), just as the
default-size stacks are.  A separate cache of stacks is kept for
non-default-size stacks.

Collaboration with:	deischen
2001-07-20 04:23:11 +00:00
Dima Dorfman 7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Dima Dorfman 70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Ruslan Ermilov 5521ff5a4d mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2). 2001-07-06 16:46:48 +00:00
Daniel Eischen a9513dc678 Clear the in thread scheduler flag after jumping to the start of
a signal handler from the scheduler.

MFC after:	1 week
2001-06-29 17:09:07 +00:00
Jason Evans 651974ee92 Fix a race condition in pthread_join(). All of the following must occur
atomically:

1) Search _thread_list for the thread to join.
2) Search _dead_list for the thread to join.
3) Set the running thread as the joiner.

While we're at it, fix a race in the case where multiple threads try to
join on the same thread.  POSIX says that the behavior of multiple joiners
is undefined, but the fix is cheap as a result of the other fix.
2001-06-27 11:41:15 +00:00
Gregory Neil Shapiro c1c5db8149 Typo fix: requires -> reacquires
Submitted by:	Murray S. Kucherawy <msk@sendmail.com>
MFC after:	3 days
2001-06-27 06:01:17 +00:00
Dima Dorfman d33f4d20c9 Add a missing word.
Obtained from:	OpenBSD
2001-06-05 00:25:18 +00:00
Dima Dorfman 5940a2ebe0 Add a missing word. 2001-06-05 00:11:08 +00:00
Jason Evans c024882f08 Add a test for PR 24345. 2001-05-20 23:12:13 +00:00
Jason Evans b39e7e33f1 Update the verify script. 2001-05-20 23:11:54 +00:00
Jason Evans 745b431dc6 Don't define _REENTRANT, since the Makefile does so. 2001-05-20 23:11:09 +00:00
Jason Evans dd2d9a766b Fix a typo. 2001-05-20 23:10:30 +00:00
Jason Evans 6699b0c6fe Instead of using a join queue for each thread, use a single pointer to
keep track of a joiner.  POSIX only supports a single joiner, so this
simplification is acceptable.

At the same time, make sure to mark a joined thread as detached so that
its resources can be freed.

Reviewed by:	deischen
PR:		24345
2001-05-20 23:08:33 +00:00
Ruslan Ermilov 108b08b24e Fixed typo in the description.
PR:		docs/27411
Submitted by:	David Wimsey <dwimsey@rtci.com>
2001-05-18 06:56:03 +00:00