Commit Graph

7789 Commits

Author SHA1 Message Date
David Xu
1771242836 o Add code to GC freed KSEs and KSE groups
o Fix a bug in kse_free_unlocked(), kcb_dtor shouldn't be called because
  the KSE is cached and will be resued in _kse_alloc().

Reviewed by: deischen
2003-08-08 22:20:59 +00:00
Daniel Eischen
de1b32cd37 Since it builds and seems to work OK, add libpthread to the amd64 build. 2003-08-08 21:16:06 +00:00
Marcel Moolenaar
10b35e00c9 Remove stale DCE 1.1 pointers to the IBM site. The URLs aren't valid
anymore. This also fixes long line bugs caused by the lengthy URLs :-)
2003-08-08 19:18:43 +00:00
Marcel Moolenaar
38e35b968e Fix markup for uuid_equal() 2003-08-08 19:12:28 +00:00
Marcel Moolenaar
3031a4311e Fix two (2) bugs in one (1) statement:
o  fix the len argument of memcmp(3) to be the size of the node field
   of the uuid structure, not the size of the uuid structure itself.
   We're comparing the node fields...
o  uuid_compare(3) is specified to return -1, 0 or 1, depending on
   the outcome of the comparison. memcmp(3) returns the difference
   between the first differing bytes. Hence, we cannot ever return
   the return value of memcmp(3) as-is.

PR: standards/55370
Submitted by: Konstantin Oznobihin <bork@rsu.ru>
2003-08-08 19:03:37 +00:00
Jake Burkholder
b551cb80d4 Implement signalcontext. 2003-08-08 15:40:28 +00:00
Alexander Kabaev
dd83c5f0a2 Allow gcc driver to process -r option iself, do not use -Wl,-r to
bypass it. Doing otherwise did not allow compiler to detect and disable
conflicting options generated from specs.

Reported by:	jake
2003-08-08 03:41:13 +00:00
Tim J. Robbins
b85aa4e3f7 Implement mblen(s, n) as mbtowc(NULL, s, n) to avoid calling sgetrune()
and to simplify things. This is only valid until we start supporting
state-dependent encodings.
2003-08-07 09:34:51 +00:00
Tim J. Robbins
b69a98d6d3 Implement mbstowcs() as a wrapper around mbsrtowcs(), and wcstombs()
as a wrapper around wcsrtombs().
2003-08-07 08:04:01 +00:00
Marcel Moolenaar
778a4a9dd4 Grok async contexts. When a thread is interrupted and an upcall
happens, the context of the interrupted thread is exported to
userland. Unlike most contexts, it will be an async context and
we cannot easily use our existing functions to set such a
context.
To avoid a lot of complexity that may possibly interfere with
the common case, we simply let the kernel deal with it. However,
we don't use the EPC based syscall path to invoke setcontext(2).
No, we use the break-based syscall path. That way the trapframe
will be compatible with the context we're trying to restore and
we save the kernel a lot of trouble. The kind of trouble we did
not want to go though ourselves...

However, we also need to set the threads mailbox and there's no
syscall to help us out. To avoid creating a new syscall, we use
the context itself to pass the information to the kernel so that
the kernel can update the mailbox. This involves setting a flag
(_MC_FLAGS_KSE_SET_MBOX) and setting ifa (the address) and isr
(the value).
2003-08-07 08:03:05 +00:00
Tim J. Robbins
998e124837 Implement mbtowc() in terms of mbrtowc(), and wctomb() in terms of wcrtomb(). 2003-08-07 07:59:36 +00:00
Tim J. Robbins
dab4fca49b Implement btowc() in terms of mbrtowc() instead of sgetrune(), and
wctob() in terms of wcrtomb() instead of sputrune(). There should be
no functional differences, but there may be a small performance hit
because we make an extra function call.

The aim here is to have as few functions as possible calling
s{get,put}rune() to make it easier to remove them in the future.
2003-08-07 07:45:35 +00:00
Yaroslav Tykhiy
92a9c0bd86 Document that connect(2) can return EINTR, and that it
can return EALREADY for a socket in blocking mode as well.
2003-08-06 14:21:06 +00:00
Daniel Eischen
39521cdb3c Fix a typo. s/Line/Like/ 2003-08-06 06:12:54 +00:00
Marcel Moolenaar
d7c68311ee Avoid a level of indirection to get from the thread pointer to the
TCB. We know that the thread pointer points to &tcb->tcb_tp, so all
we have to do is subtract offsetof(struct tcb, tcb_tp) from the
thread pointer to get to the TCB. Any reasonably smart compiler will
translate accesses to fields in the TCB as negative offsets from TP.

In _tcb_set() make sure the fake TCB gets a pointer to the current
KCB, just like any other TCB. This fixes a NULL-pointer dereference
in _thr_ref_add() when it tried to get the current KSE.
2003-08-06 04:17:42 +00:00
Daniel Eischen
fc40494359 Don't call kse_set_curthread() when scheduling a new bound
thread.  It should only be called by the current kse and
never by a KSE on behalf of another.

Submitted by:	davidxu
2003-08-06 00:43:28 +00:00
Marcel Moolenaar
4a997ca96e Fix an off by one error in the number of arguments passed to
makecontext(). We only supply 3, not 4. This is mostly harmless,
except that on ia64 the garbage can include NaT bits, resulting
in NaT consumption faults.
2003-08-06 00:23:40 +00:00
Marcel Moolenaar
119fb38770 Define the static TLS as an array of long double. This will guarantee
that the TLS is 16-byte aligned, as well as guarantee that the thread
pointer is 16-byte aligned as it points to struct ia64_tp. Likewise,
struct tcb and struct ksd are also guaranteed to be 16-byte aligned
(if they weren't already).
2003-08-06 00:17:15 +00:00
Daniel Eischen
199d58cbfc Use auto LDT allocation for i386. 2003-08-05 23:09:22 +00:00
Daniel Eischen
59c3b99b8f Rethink the MD interfaces for libpthread to account for
archs that can (or are required to) have per-thread registers.

Tested on i386, amd64; marcel is testing on ia64 and will
have some follow-up commits.

Reviewed by:	davidxu
2003-08-05 22:46:00 +00:00
Marcel Moolenaar
9a3ea63e79 Define THR_GETCONTEXT and THR_SETCONTEXT in terms of the userland
context functions. We don't need to enter the kernel anymore. The
contexts are compatible (ie a context created by getcontext() can
be restored by _ia64_restore_context()).

While here, make the use of THR_ALIGNBYTES and THR_ALIGN a no-op.
They are going to be removed anyway.
2003-08-05 19:37:20 +00:00
Marcel Moolenaar
50be3a75cc o In _ia64_save_context() clear the return registers except for r8.
We write 1 for r8 in the context so that _ia64_restore_context()
   will return with a non-zero value. _ia64_save_context() always
   return 0.
o  In _ia64_restore_context(), don't restore the thread pointer. It
   is not normally part of the context. Also, restore the return
   registers. We get called for contexts created by getcontext(),
   which means we have to restore all the syscall return values.
2003-08-05 19:33:01 +00:00
John-Mark Gurney
95aab9cc49 add support for using kqueue to watch bpf sockets.
Submitted by:	Brian Buchanan of nCircle, Inc.
Tested on:	i386 and sparc64
2003-08-05 07:12:49 +00:00
Andrey A. Chernov
90862ca23d LANG->LC_ALL
Pointed by:     ru
2003-08-04 21:31:53 +00:00
Julian Elischer
5774db75bd Allow foot shooting as Linux emulation needs it.
Also change "Auto mode" to use a "special" value
instead of 0, and define and document it.
I had thought libpthread had already been switched to use auto mode but
it appears that patch hasn't been committed yet.

Discussed with:	 Davidxu
2003-08-04 19:11:56 +00:00
Andrey A. Chernov
11871d537b Fix problem differently, use
LANG=C tr 'a-z' 'A-Z'
for hypotetical case that script may generate non-ascii characters
2003-08-04 15:24:06 +00:00
Andrey A. Chernov
e9e76fa4dd Fix double-wrong tr usage: tr '[a-z]' '[A-Z]'
First of all, it should be written as: tr 'a-z' 'A-Z'
ranges not encolosed in [] according to POSIX, so [] just included
in the replacement.
Second, it should be written: tr '[:lower:]' '[:upper:]'
since a-z and A-Z may have different length in some locales.
2003-08-04 14:10:33 +00:00
Andrey A. Chernov
a9d25ab17f Restore including of "collate.h", for its own prototype (mis)match detection 2003-08-03 19:28:23 +00:00
Andrey A. Chernov
8841d0081c Remove commented out and never used code 2003-08-03 05:20:31 +00:00
Andrey A. Chernov
17f67afe28 Remove __collate_range_cmp() stabilization, it conflicts with ranges 2003-08-03 04:40:40 +00:00
David Xu
3664d35cd5 -15 is incorrect to be used to align stack to 16 bytes, use ~15 instead. 2003-08-02 22:39:10 +00:00
Marcel Moolenaar
8955f59879 Override the default stubs for getcontext(2) and swapcontext(2) so
that we can flush the register stack prior to entering the kernel.
This avoids having dirty registers and saves us from having to
manually write them to the backing store from within the kernel.
In that respect, flushing the RSE is both functionally required as
well as performance optimal.

On average we had 18 dirty registers when getcontext(2) was called
from libthr. Since libthr does not switch back to a context created
by getcontext(2), not having dealt with the dirty registers was
harmless.
2003-08-02 00:49:36 +00:00
Marcel Moolenaar
6e9a9b9f52 The END() must expand to the .endp directive with the same name as
on the corresponding .proc directive, or the .endp must not have a
name at all.
While here, remove an artificial dependency in Ovfork.S by performing
manual register renaming.
2003-08-01 22:17:12 +00:00
David Xu
e6145501e9 Use FSBase to map kse, GCC generates code which uses %fs to access TLS data.
Reminded by: marcel
2003-07-31 22:06:36 +00:00
Poul-Henning Kamp
8d2fd95bc8 Remove unnecssary <vm/swap_pager.h> includes.
These were probably not cleaned up back in whatever murky past these
files were split into separate files.
2003-07-31 21:44:31 +00:00
Poul-Henning Kamp
b8c609915e Remove various unused variables, prototypes and local variables. 2003-07-31 21:42:12 +00:00
Poul-Henning Kamp
5d6fec5b63 Disable and lobotomize the kvm image reading swapinfo code, the kernel
layout is about to change.

The sysctl based method still returns correct information.
2003-07-31 21:38:32 +00:00
Poul-Henning Kamp
5243b6799b Retire the SWIF_DUMP_TREE code, this is in the way for a rework of
the swap_pager layout.
2003-07-31 21:30:28 +00:00
Daniel Eischen
9c76f2b9d6 This file hasn't been used for some time; nuke it. 2003-07-31 21:29:04 +00:00
Daniel Eischen
51200f9b7c Take the same approach for i386 as that for ia64 and amd64. Use
the userland version of [gs]etcontext to switch between a thread
and the UTS scheduler (and back again).  This also fixes a bug
in i386 _thr_setcontext() which wasn't properly restoring the
context.

Reviewed by:	davidxu
2003-07-31 21:09:11 +00:00
Poul-Henning Kamp
a8818ec991 Unifdef -UDEBUG_SWAPINFO The kernel data structures are about to change. 2003-07-31 20:53:04 +00:00
David Xu
ee2d44af05 Set GSBASE for kse. Finally make libkse work on AMD64. 2003-07-31 09:03:36 +00:00
David Xu
3807b4840c Fix some typos, correctly jump into UTS. 2003-07-31 08:50:01 +00:00
David Xu
64e64426d7 sysctlbyname needs size_t type, not int. 2003-07-31 08:26:58 +00:00
David Schultz
e02cc8e419 Cross-reference arc4random(3). 2003-07-31 06:18:34 +00:00
David Schultz
05e1bf3461 The upper end of the range of arc4random(3) is 2**32-1, not 2**31-1. 2003-07-31 06:18:24 +00:00
David Xu
01724ec53d Update manual for i386_set_ldt to reflect newly added features.
Submitted by: julian
2003-07-31 02:13:48 +00:00
Daniel Eischen
24dc93d4c2 Don't forget to unlock the scheduler lock. Somehow this got removed
from one of my last commits.  This only affected priority ceiling
mutexes.

Pointy hat to:	deischen
2003-07-30 13:28:05 +00:00
Marcel Moolenaar
2cd199ce21 Only allow trapframe formats instead of sigframe formats like the
comment says and don't write the first 3 arguments to FRAME_TRAPARG_*
as they are specific to sigframes.
2003-07-30 06:36:20 +00:00
Hartmut Brandt
fddacb1184 Correct a cut'n'paste error in a comment. 2003-07-29 13:51:53 +00:00