Commit Graph

7642 Commits

Author SHA1 Message Date
Mike Makonnen
fadd82e367 Catchup with _thread_suspend() changes. 2003-06-30 12:35:31 +00:00
David Xu
5af40bb68a Because there are only _SIG_MAXSIG elements in thread siginfo array,
use [signal number - 1] as subscript to access the array.
2003-06-30 06:16:50 +00:00
David Xu
a913c5dd9d Remove surplus unlocking code I accidentally checked in. This won't be
triggered until LDT entry is exhausted.
2003-06-30 05:49:06 +00:00
Mike Makonnen
dbc6f4c07d Sweep through pthread locking and use the new locking primitives for
libthr.
2003-06-29 23:51:04 +00:00
Mike Makonnen
2234d5bea2 Locking primitives and operations in libthr should use struct umtx,
not spinlock_t. Spinlock_t and the associated functions and macros may
require blocking signals in order for async-safe libc functions to behave
appropriately in libthr. This is undesriable for libthr internal locking.
So, this is the first step in completely separating libthr from libc's
locking primitives.

Three new macros should be used for internal libthr locking from now on:
THR_LOCK, THR_TRYLOCK, THR_UNLOCK.
2003-06-29 23:49:41 +00:00
Mike Makonnen
c36507007f In a critical section, separate the aquisition of the thread lock
and the disabling of signals. What we are really interested in is
keeping track of recursive disabling of signals. We should not
be recursively acquiring thread locks. Any such situations should
be reorganized to not require a recursive lock.

Separating the two out also allows us to block signals independent of
acquiring thread locks. This will be needed in libthr in the near future when
we put the pieces together to protect libc functions that use pthread mutexes
and low level locks.
2003-06-29 21:21:52 +00:00
Gordon Tetlow
09f49aab84 Add a libc function execvP that takes the search path as an arguement.
Change execvp to be a wrapper around execvP. This is necessary for some
of the /rescue pieces. It may also be more generally applicable as well.

Submitted by:	Tim Kientzle <kientzle@acm.org>
Approved by:	Silence on arch@
2003-06-29 17:33:34 +00:00
John Polstra
7c916264aa Make _thread_suspend work with both the old broken sigtimedwait
implementation and the new improved one.  We now precompute the
signal set passed to sigtimedwait, using an inverted set when
necessary for compatibility with older kernels.
2003-06-29 15:55:44 +00:00
David Schultz
ec045e41d9 Teach fmtcheck(3) about the flags a, A, F, G, t, and z. 2003-06-29 01:11:31 +00:00
Mike Makonnen
7e2160688c The move to _retire() a thread in the GC instead of in the thread's
exit function has invalidated the need for _spin[un]lock_pthread().
The _spin[un]lock() functions can now dereference curthread without
the danger that the ldtentry containing the pointer to the thread
has been cleared out from under them.
2003-06-29 00:12:40 +00:00
Ruslan Ermilov
f5913c9736 mdoc(7) fix: Use the normal AT&T macro (.At) rather than its
internal string in the macro context.
2003-06-28 22:12:30 +00:00
David Xu
a772047bc6 o Use a daemon thread to monitor signal events in kernel, if pending
signals were changed in kernel, it will retrieve the pending set and
  try to find a thread to dispatch the signal. The dispatching process
  can be rolled back if the signal is no longer in kernel.

o Create two functions _thr_signal_init() and _thr_signal_deinit(),
  all signal action settings are retrieved from kernel when threading
  mode is turned on, after a fork(), child process will reset them to
  user settings by calling _thr_signal_deinit(). when threading mode
  is not turned on, all signal operations are direct past to kernel.

o When a thread generated a synchoronous signals and its context returned
  from completed list, UTS will retrieve the signal from its mailbox and try
  to deliver the signal to thread.

o Context signal mask is now only used when delivering signals, thread's
  current signal mask is always the one in pthread structure.

o Remove have_signals field in pthread structure, replace it with
  psf_valid in pthread_signal_frame. when psf_valid is true, in context
  switch time, thread will backout itself from some mutex/condition
  internal queues, then begin to process signals. when a thread is not
  at blocked state and running, check_pending indicates there are signals
  for the thread, after preempted and then resumed time, UTS will try to
  deliver signals to the thread.

o At signal delivering time, not only pending signals in thread will be
  scanned, process's pending signals will be scanned too.

o Change sigwait code a bit, remove field sigwait in pthread_wait_data,
  replace it with oldsigmask in pthread structure, when a thread calls
  sigwait(), its current signal mask is backuped to oldsigmask, and waitset
  is copied to its signal mask and when the thread gets a signal in the
  waitset range, its current signal mask is restored from oldsigmask,
  these are done in atomic fashion.

o Two additional POSIX APIs are implemented, sigwaitinfo() and sigtimedwait().

o Signal code locking is better than previous, there is fewer race conditions.

o Temporary disable most of code in _kse_single_thread as it is not safe
  after fork().
2003-06-28 09:55:02 +00:00
David Xu
d15cbd7dc0 Use mmap retuned value.
Reviewed by: deischen
2003-06-28 09:48:05 +00:00
David Xu
8d5f23a1f9 Temporary disable rwlock based code, replace it with low level KSE locking
code until rtld-elf and libkse can cooperate better, those code can be
restored.

Reviewed by: deischen
2003-06-28 09:47:22 +00:00
David Xu
52d9c77df4 Write new thread pointer back only when success.
Reviewed by: deischen
2003-06-28 09:41:59 +00:00
David Xu
a56b526b51 After thread was interrupted by signal, it should relock mutex.
Reviewed by: deischen
2003-06-28 09:40:57 +00:00
David Xu
a07576d63c if thread is exiting, just returns. kse_thr_interrupt interface
was changed, it needs signal parameter, pass -1 to it, it indicates to
interrupt syscall.

Reviewed by: deischen
2003-06-28 09:39:35 +00:00
David Schultz
b6b7fb3782 Update to reflect changes in vfscanf.c,v 1.32. Remove bogus
documentation for %a, and document it correctly instead.
s/one of aefg/one of a, e, f, or g/

Reviewed by:	standards@
2003-06-28 09:03:25 +00:00
David Schultz
370077c7a6 Revamp scanf's floating-point-parsing algorithm to support
[+|-]Inf, [+|-]NaN, nan(...), and hexidecimal FP constants.
While here, add %a and %A, which are aliases for %e, and
add support for long doubles.

Reviewed by:	standards@
2003-06-28 09:03:05 +00:00
Marcel Moolenaar
6128a735ea Create compatibility links for libc_r on ia64 to prevent build-time
breakages. Note that runtime compatibility is not guaranteed. Future
changes to setjmp/longjmp in libc will break threaded applications
linked against libc_r.so.5 on ia64. We pull our "tier 2" card once
more...

Reviewed by: ru
2003-06-27 18:07:47 +00:00
Yaroslav Tykhiy
b712059588 Correct a misspelled name of time_hi_and_version. 2003-06-27 13:41:29 +00:00
Marcel Moolenaar
c8cd8ab017 o disconnect libc_r from the build on ia64. The library is now
obsolete. The intend is to add glue to either libthr or
   libpthread to create the necessary compat links.
o  Hook libpthread to the build on ia64. This is slightly out of
   order, because the kernel still doesn't have all the support,
   but that's not a problem in this case.
2003-06-27 07:41:51 +00:00
Marcel Moolenaar
fd62f5ca46 Implement _ia64_save_context() and _ia64_restore_context(). Both
functions are derived from the swapctx() and restorectx() (resp)
from sys/ia64/ia64/context.s. The code is expected to be 99%
correct, but has not yet been tested.

Note that with these functions operating on mcontext_t, we also
created the foundation upon which we can implement getcontext(2)
and setcontext(2) replacements. It's not guaranteed that the use
of these syscalls and _ia64_{save|restore}_context() on the same
uicontext_t is actually going to work. Replacing the syscalls is
now trivially achieved.

This commit completes the ia64 port of libpthread itself (modulo
testing and bugfixes).
2003-06-27 06:15:13 +00:00
John W. De Boskey
788940b418 fix NIS+ YP compat mode
PR:		bin/52792
Submitted by:	TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>
2003-06-27 03:37:44 +00:00
Stefan Eßer
3a8c99f73f Fix URL of zlib home page: It's hosted at gzip.org now. 2003-06-26 20:05:47 +00:00
Alexey Zelkin
683fe11379 . style(9)
. fix/add comments (to cover changes done thru last 20 months)
. extend monetary testcase to cover int_* values
2003-06-26 10:46:16 +00:00
Marcel Moolenaar
b51f305ec1 Implement _ia64_enter_uts(). The purpose of this function is to switch
the register stack and memory stack and call the function given to it.

While here, provide empty, non-working, stubs for the context functions
(_ia64_save_context() and _ia64_restore_context()) so that anyone can at
least compile libkse from CVS sources. Real implementations will follow
soon.
2003-06-26 05:40:15 +00:00
Marcel Moolenaar
6351f43f14 Implement _thr_enter_uts() and _thr_switch() as inline functions to
minimize the amount and complexity of assembly code that needs to be
written. This way the core functionality is spread over 3 elementary
functions that don't have to do anything that can more easily and
more safely be done in C. As such, assembly code will only have to
know about the definition of mcontext_t.
The runtime cost of not having these functions being inlined is less
important than the cleanliness and maintainability of the code at
this stage of the implementation.
2003-06-26 03:55:58 +00:00
Peter Wemm
764ca408a6 Re-enable libstand on all platforms including amd64. 2003-06-26 03:48:23 +00:00
Peter Wemm
ebc5ba0efa Add amd64 build glue 2003-06-26 03:48:01 +00:00
Alexey Zelkin
fca2738d67 Reduce code duplication by separating _PathLocle detection code into
internal helper function.
2003-06-25 22:42:33 +00:00
Alexey Zelkin
93c847344b Move _PathLocale declaration to more logical place (setlocale.c) 2003-06-25 22:34:13 +00:00
Alexey Zelkin
d8d4841398 Catch up with _PATH_LOCALE move from rune.h to paths.h 2003-06-25 22:31:42 +00:00
David E. O'Brien
ea5a1812ba mdoc police 2003-06-25 21:31:43 +00:00
David E. O'Brien
4c861aeb86 Be more specific in BUGS.
Submitted by:	ru

Add history.
2003-06-25 19:18:44 +00:00
David E. O'Brien
0ab6a0c787 Push the alloca #error warning farther down to play nicer with some out of
tree local translator.

Requested by:	 jmallett
2003-06-25 19:06:40 +00:00
Andrey A. Chernov
ba10c47105 Don't statically initialize buf to _PATH_DEV, _PATH_DEV always copied to
it in any case.
2003-06-24 22:20:06 +00:00
Yaroslav Tykhiy
9530d06766 Unify cross-references between sigpending(2), sigprocmask(2),
and sigsuspend(2), all three of which operate or depend on the
process signal mask.

Add a missing xref to sigsetops(3), without which the above three
syscalls would be useless.
2003-06-24 15:41:19 +00:00
Yaroslav Tykhiy
f8193a054c Supplement the cross-references section with those to sigpending(2)
and sigprocmask(2).  These two syscalls are likely to be accompanied
by a few sigsetops(3) in a typical piece of code.
2003-06-24 15:27:31 +00:00
Marcel Moolenaar
ec5f6d191d Implement signalcontext(). Needed by libpthread (aka libkse). 2003-06-24 05:06:42 +00:00
Marcel Moolenaar
5858b0cea8 Explicitly widen int types before casting to pointer types. On 64-bit
platforms the compiler warns about incompatible integer/pointer casts
and on ia64 this generally is bad news. We know that what we're doing
here is valid/correct, so suppress the warning. No functional change.

Sleeps better: marcel
2003-06-24 00:37:26 +00:00
Marcel Moolenaar
82468d1f27 Untangle the inter-dependency of kse types and ksd types/functions
by moving the definition of struct ksd to pthread_md.h and removing
the inclusion of ksd.h from thr_private.h (which has the definition
of struct kse and kse_critical_t). This allows ksd.h to have inline
functions that use struct kse and kse_critical_t and generally
yields a cleaner implementation at the cost of not having all ksd
related types/definitions in one header.

Implement the ksd functionality on ia64 by using inline functions
and permanently remove ksd.c from the ia64 specific makefile.

This change does not clean up the i386 specific version of ksd.h.

NOTE: The ksd code on ia64 abuses the tp register in the same way
as it is abused in libthr in that it is incompatible with the
runtime specification. This will be address when support for TLS
hits the tree.
2003-06-23 23:15:06 +00:00
Marcel Moolenaar
46559d7101 Change the definition of _ksd_curkse, _ksd_curthread and
_ksd_readandclear_tmbx to be function-like. That way we
can define them as inline functions or create prototypes
for them.

This change allows the ksd interface on ia64 to be fully
inlined.
2003-06-23 09:49:16 +00:00
Marcel Moolenaar
ca4b6c293b Define THR_{G|S}ETCONTEXT to expand to {g|s}etcontext(2).
Define THR_ALIGN to align at 16-byte boundaries.
2003-06-23 04:52:09 +00:00
Marcel Moolenaar
97caaa6522 Implement atomic_swap_{int|long|ptr}. Define atomic_swap_ptr as a
macro that expands to atomic_swap_long() to avoid compiler warnings
caused by incompatible pointer passing.
2003-06-23 04:44:43 +00:00
Marcel Moolenaar
c2dac9a63d Remove _atomic_lock. It's not used. 2003-06-23 04:33:32 +00:00
Marcel Moolenaar
842728619a Move the machine specific files from sys/Makefile.inc and put them
in a machine specific makefile. While here, sort the sub-directories
in Makefile and remove _atomic_lock.S from all makefiles.
2003-06-23 04:28:31 +00:00
Warner Losh
f1fe8d5bac Add clarifications about the information that ntp_gettime returns.
TAI is a timescale, just like UTC.  The tai field returns the offset
between the two, and isn't really used for precision time keeping.
Explain in brief what a positive and a negative leap seconds are.  Add
some URLs to very useful web pages about time and time keeping for
more information on using this API.

Reviewed by: phk
2003-06-21 20:27:54 +00:00
David Schultz
d086ded323 Userland spinlocks bad. Sleep locks good.
Use the latter for gdtoa.

Requested by:	deischen (far too long ago)
2003-06-21 08:20:14 +00:00
Poul-Henning Kamp
97679e71b0 ttyname(3) must return absolute pathnames.
Noticed by:	kris
2003-06-21 08:16:12 +00:00