Commit Graph

7986 Commits

Author SHA1 Message Date
deischen
ebe266fc06 Add signalcontext() which will be needed by libpthread.
Reviewed by:	marcel
2003-08-09 05:37:54 +00:00
bms
13a068330e Add the POSIX 1003.1-2001 posix_madvise() interface.
PR:		standards/54634
Reviewed by:	das
Approved by:	jake (mentor)
2003-08-09 03:23:24 +00:00
davidxu
77cd7dfc57 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
deischen
01d3d12eec Since it builds and seems to work OK, add libpthread to the amd64 build. 2003-08-08 21:16:06 +00:00
marcel
5067837045 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
b0fa5a4225 Fix markup for uuid_equal() 2003-08-08 19:12:28 +00:00
marcel
560fea35ec 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
a2dee35271 Implement signalcontext. 2003-08-08 15:40:28 +00:00
kan
890ece8734 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
tjr
7465b9894e 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
tjr
d7ba8669ea Implement mbstowcs() as a wrapper around mbsrtowcs(), and wcstombs()
as a wrapper around wcsrtombs().
2003-08-07 08:04:01 +00:00
marcel
9ac1920afc 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
tjr
956ff22a2c Implement mbtowc() in terms of mbrtowc(), and wctomb() in terms of wcrtomb(). 2003-08-07 07:59:36 +00:00
tjr
54a8f3fd25 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
yar
7e590e34db 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
deischen
3387343b31 Fix a typo. s/Line/Like/ 2003-08-06 06:12:54 +00:00
marcel
ce7778f89c 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
deischen
d42e437717 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
9190fc68cf 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
380e3eb433 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
deischen
061db6acbc Use auto LDT allocation for i386. 2003-08-05 23:09:22 +00:00
deischen
9e066b5969 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
a3fb5af8f8 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
ad2c9af5cb 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
jmg
e65fb6de88 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
ache
1bc08db7d6 LANG->LC_ALL
Pointed by:     ru
2003-08-04 21:31:53 +00:00
julian
c99d9a5d4c 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
ache
b4a773679c 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
ache
f70366b05f 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
ache
fbf4a9bc2d Restore including of "collate.h", for its own prototype (mis)match detection 2003-08-03 19:28:23 +00:00
ache
8e50975e89 Remove commented out and never used code 2003-08-03 05:20:31 +00:00
ache
40d074c150 Remove __collate_range_cmp() stabilization, it conflicts with ranges 2003-08-03 04:40:40 +00:00
davidxu
78a977b4b9 -15 is incorrect to be used to align stack to 16 bytes, use ~15 instead. 2003-08-02 22:39:10 +00:00
marcel
c098be913b 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
19740237e8 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
davidxu
d72548cf0d 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
phk
e687e7417b 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
phk
04eddcd0a5 Remove various unused variables, prototypes and local variables. 2003-07-31 21:42:12 +00:00
phk
9b6918a0aa 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
phk
54e57086f7 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
deischen
f0b02849e6 This file hasn't been used for some time; nuke it. 2003-07-31 21:29:04 +00:00
deischen
0bee566a76 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
phk
72bfda7067 Unifdef -UDEBUG_SWAPINFO The kernel data structures are about to change. 2003-07-31 20:53:04 +00:00
davidxu
5c470f2295 Set GSBASE for kse. Finally make libkse work on AMD64. 2003-07-31 09:03:36 +00:00
davidxu
c2265eed30 Fix some typos, correctly jump into UTS. 2003-07-31 08:50:01 +00:00
davidxu
f34f8f8b3e sysctlbyname needs size_t type, not int. 2003-07-31 08:26:58 +00:00
das
a485104831 Cross-reference arc4random(3). 2003-07-31 06:18:34 +00:00
das
da4974ca32 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
davidxu
79bad0490f Update manual for i386_set_ldt to reflect newly added features.
Submitted by: julian
2003-07-31 02:13:48 +00:00
deischen
7cd3ef4cad 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
592c9143c5 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
harti
075f0460cd Correct a cut'n'paste error in a comment. 2003-07-29 13:51:53 +00:00
harti
6bdc55e269 Make a local static string const. 2003-07-29 13:51:27 +00:00
harti
cad96c2b96 Use the appropriate [s]size_t type where a buffer size is meant.
Add const specifiers to constant function arguments.
2003-07-29 13:35:03 +00:00
phk
6fb62c0d8e Minor constification. 2003-07-29 11:16:14 +00:00
ache
9a32633f0e Add support for gb18030 encoding
PR:             51729
Submitted by:   Kang Liu <liukang@bjpu.edu.cn>
2003-07-29 07:52:44 +00:00
simon
9f0ae03ce0 * Merge index(3) and rindex(3) to index(3) since the two functions are
almost identical.
* Merge strchr(3) and strrchr(3) to strchr(3) since the two functions
  are almost identical.
* Make the wording of index(3) and strchr(3) more similar.
* mdoc(7) cleanup.

Submitted by:	SUZUKI Koichi <metal@gc5.so-net.ne.jp>, keramida, myself
PR:		docs/32054
Reviewed by:	ru
Approved by:	ceri (mentor)
2003-07-28 22:50:42 +00:00
davidxu
cd0df1766a Simplify sigwait code a bit by using a waitset and removing oldsigmask.
Reviewed by: deischen
2003-07-27 06:46:34 +00:00
davidxu
87a262adf5 Set mc_len to sizeof(mcontext_t), otherwise it is an invalid context. 2003-07-26 12:58:28 +00:00
davidxu
801e095344 Fix typo. 2003-07-26 02:36:50 +00:00
marcel
5b786e1bdc Revert previous commit. We don't use setjmp()/longjmp() for context
switching anymore, so there's no need to save and restore GP. This
change breaks threaded applications linked against libc_r. Pull the
tier 2 card again: relink. This will link against libthr instead.
2003-07-25 22:36:48 +00:00
peter
7fa8de132d Fix for 64 bit platforms. sysctl's length args are pointers to
size_t, not int.  This could be fatal where size_t is long.

Reviewed by:	bp
2003-07-25 19:17:46 +00:00
mp
ee3dae5c96 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
mux
0f64305453 An u_int8_t can never be bigger than 255, so remove a useless check.
Spotted by:	GCC
2003-07-25 12:23:25 +00:00
harti
4ac693aa72 Make library WARNS=6 clean. The problems have been: alignment on sparc64
and one of the usual sizeof(in_addr_t) == sizeof(u_long) bugs.
2003-07-25 08:22:08 +00:00
rwatson
638692b978 Print group name in getfacl output when calculating an effective
permission set based on a more restrictive mask.

Submitted by:	Glen Gibb <grg@ridley.unimelb.edu.au>
2003-07-24 23:33:25 +00:00
markm
938802c60c Turn on the extended syntax, which TCP_wrappers has by default, as
distributed.
2003-07-24 19:58:56 +00:00
markm
66e6d105e6 Remove GCC-specific debugging option.
OK'ed by:	phk
2003-07-24 19:53:02 +00:00
markm
f7f77aaea8 Don't check for the existance of src/crypto/ for building items that
may contain crypto. The days of ITAR paranoia are over, and the simple
macro tests that remain are sufficient.
2003-07-24 18:30:25 +00:00
markm
c62efd08ea Make sure that a "make release" (more accurately the bit that makes
the crunched binary) get a non-cryptographic telnet. This is overkill
in that it covers stuff that is not normally used in a crunched binary.
2003-07-24 17:19:15 +00:00
marcel
f622e8230f Implement _get_curthread and _set_curthread. We use GCCs builtin
function this, which expands to PAL calls (rduniq and wruniq).
This needs adjustment when TLS is implemented.
2003-07-24 07:51:49 +00:00
markm
74ab377728 Ensure that for the cryptographic instances of *telnet*, the "crypto"
distribution is used. This only affects release-building.
2003-07-24 07:19:55 +00:00
peter
5bf8dc6697 Connect libncp/libsmb to the build. They compile, but have a couple of
silly bugs that probably wont quite make a segfault.  eg: passing a pointer
to an int to sysctl instead of a pointer to a size_t.
2003-07-24 02:05:48 +00:00
dds
fa22d4df23 Document an additional error return value. The connect(2) call can also
return EACCES on non-Unix domain sockets as demonstrated by the
following program:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int
main(int argc, char *argv[])
{
	struct sockaddr_in rem_addr;
	int sock;

	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
		perror("socket");
		exit(1);
	}

	bzero((char *)&rem_addr, sizeof(rem_addr));
	rem_addr.sin_family = AF_INET;
	rem_addr.sin_addr.s_addr = INADDR_NONE;
	rem_addr.sin_port = htons(10000);

	if (connect(sock, (struct sockaddr *)&rem_addr,
sizeof(rem_addr)) < 0) {
		perror("connect");
		exit(1);
	}
}

The call chain returning this value is probably:

kern/uipc_syscalls.c:connect
kern/uipc_socket.c:soconnect
netinet/tcp_usrreq.c:tcp_usr_connect
netinet/tcp_output.c:tcp_output
netinet/ip_output.c:ip_output

Reviewed by:	schweikh (mentor)
MFC after:	2 weeks
2003-07-23 22:00:08 +00:00
bde
e913f4a1ba Fixed some style bugs (misplacement and misformatting of some commented-out
code).
2003-07-23 09:24:44 +00:00
peter
e6e6002e37 Only provide one copy of the math functions. If we provide a MD function,
do not also provide a __generic_XXX version as well.  This is how we
used to runtime select the generic vs i387 versions on the i386 platform.

This saves a pile of #defines in the src/math_private.h file to undo the
__generic_XXX renames in some of the *.c files.
2003-07-23 04:53:47 +00:00
peter
c549cfd555 No longer need the internal __get_hw_float() function. 2003-07-23 04:25:04 +00:00
peter
e3535ebe8e Now that we do not need to do runtime detection for the broken default
fp emulator, stop doing the runtime selection of hardware or emulated
floating point operations on i386.  Note that I have not suppressed the
duplicate compiles yet.

While here, fix the alpha.  It has provided specific copysign/copysignf
functions since the beginning of time, but they have never been used.
2003-07-23 04:23:36 +00:00
deischen
e10f5fec26 Move idle kse wakeup to outside of regions where locks are held.
This eliminates ping-ponging of locks, where the idle KSE wakes
up only to find the lock it needs is being held.  This gives
little or no gain to M:N mode but greatly speeds up 1:1 mode.

Reviewed & Tested by:	davidxu
2003-07-23 02:11:07 +00:00
ru
5048add97a Make sure the crypto versions of libfetch and fetch(1) appear in
the "crypto" distribution.

Approved by:	des
2003-07-22 13:54:31 +00:00
peter
a58f3f6f4b Instantiate explicit callable versions of the machine/ieeefp.h inlines
for the use of non-GCC compilers and C++ code.
2003-07-22 06:46:17 +00:00
peter
e8952b93e7 Turn off the libc/quad functions since they are not needed for amd64
and just cause lots of warnings.
2003-07-22 06:34:57 +00:00
des
d9e4868988 Revert previous commit after fixing libpam. 2003-07-21 19:56:28 +00:00
markm
020ca0be81 Test correct macro for "without crypto" option(s). 2003-07-20 23:29:46 +00:00
deischen
5f48e9730a Add missing arguments to _amd64_restore_context() when called from
THR_SETCONTEXT().
2003-07-20 12:41:38 +00:00
mtm
32839d480a Now that we have the stubs for alpha and we can build it
on that platform, invert the test for the platforms on
which libthr is built. Amd64 and powerpc are the only
platforms excluded.

Compile tested on:	amd64, alpha
2003-07-20 01:34:40 +00:00
mtm
31f7642b21 This commit was generated by cvs2svn to compensate for changes in r117783,
which included commits to RCS files with non-trunk default branches.
2003-07-19 15:57:52 +00:00
mtm
73635d5ae5 The MD framework for libthr on alpha 2003-07-19 15:57:52 +00:00
davidxu
f62d0dfdd7 Override libc function raise(), in threading mode, raise() will
send signal to current thread.

Reviewed by: deischen
2003-07-19 05:25:49 +00:00
davidxu
dfa25929c1 Make raise and _raise as weak symbols, so they can be overriden by
thread library.

Reviewed by: deischen
2003-07-19 05:22:56 +00:00
deischen
c8c702d4fd Add some very beta amd64 bits. These will also need some tweaking. 2003-07-19 04:44:21 +00:00
deischen
518e05f023 Add amd64 versions of makecontext() and signalcontext() needed
for libkse (makecontext() is also needed for libthr).
These probably will need some tweaking.
2003-07-19 04:41:08 +00:00
wollman
e9f686e3e3 Rewrite to reflect slight change in semantics for C99, and note a bug
in the standard.  Defer to gettimeofday(2) for error indications.
2003-07-19 03:19:59 +00:00
wollman
6a5657452b C99 compliance: time() always sets its return value in both places
(if present), even on error.

Pointed out by: Wojtek Lerch, on the Austin Group mailing-list
2003-07-19 02:53:46 +00:00
wpaul
c71924bd4f Revert to using yp_order() to probe for master.paswd.by* maps and
don't probe the server at all for passwd.by* maps. This fixes
interoperability with the Services For UNIX NIS server (which is
really a front end to Captive^WActiveDirectory). This server
incorrectly returns success for all YPPROC_MASTER requests,
even for maps that don't exist, which makes it impossible to
(ab)use it to probe for the existence of the master.passwd.by*
maps.

This is a little kludgey, but basically restores the original
behavior of getpwent.c as it is in -stable, and works around both
the lack of YPPROC_ORDER on NIS+ servers as well as the broken
YPPROC_MASTER on Services For UNIX servers.
2003-07-18 23:51:15 +00:00
wollman
4b112861d1 Whitespace after keywords per style(9). 2003-07-18 16:04:32 +00:00
deischen
4f7904da4d Cleanup thread accounting. Don't reset a threads timeslice
when it blocks; it only gets reset when it yields.

Properly set a thread's default stack guardsize.

Reviewed by:	davidxu
2003-07-18 02:46:55 +00:00
deischen
a022b5b095 Add a preemption point when a mutex or condition variable is
handed-off/signaled to a higher priority thread.  Note that when
there are idle KSEs that could run the higher priority thread,
we still add the preemption point because it seems to take the
kernel a while to schedule an idle KSE.  The drawbacks are that
threads will be swapped more often between CPUs (KSEs) and
that there will be an extra userland context switch (the idle
KSE is still woken and will probably resume the preempted
thread).  We'll revisit this if and when idle CPU/KSE wakeup
times improve.

Inspired by:	Petri Helenius <pete@he.iki.fi>
Reviewed by:	davidxu
2003-07-18 02:46:30 +00:00
deischen
6efe63c483 Clean up KSE specific data (KSD) macros a bit.
Reviewed by:	davidxu
2003-07-18 02:45:56 +00:00
davidxu
d88de32f34 o Eliminate upcall for PTHREAD_SYSTEM_SCOPE thread, now it
is system bound thread and when it is blocked, no upcall is generated.

o Add ability to libkse to allow it run in pure 1:1 threading mode,
  defining SYSTEM_SCOPE_ONLY in Makefile can turn on this option.

o Eliminate code for installing dummy signal handler for sigwait call.

o Add hash table to find thread.

Reviewed by: deischen
2003-07-17 23:02:30 +00:00
markm
ccc6829966 Very big makeover in the way telnet, telnetd and libtelnet are built.
Previously, there were two copies of telnet; a non-crypto version
that lived in the usual places, and a crypto version that lived in
crypto/telnet/. The latter was built in a broken manner somewhat akin
to other "contribified" sources. This meant that there were 4 telnets
competing with each other at build time - KerberosIV, Kerberos5,
plain-old-secure and base. KerberosIV is no longer in the running, but
the other three took it in turns to jump all over each other during a
"make buildworld".

As the crypto issue has been clarified, and crypto _calls_ are not
a problem, crypto/telnet has been repo-copied to contrib/telnet,
and with this commit, all telnets are now "contribified". The contrib
path was chosen to not destroy history in the repository, and differs
from other contrib/ entries in that it may be worked on as "normal"
BSD code. There is no dangerous crypto in these sources, only a
very weak system less strong than enigma(1).

Kerberos5 telnet and Secure telnet are now selected by using the usual
macros in /etc/make.conf, and the build process is unsurprising and
less treacherous.
2003-07-16 20:59:15 +00:00
des
d866092825 Add a __DECONST() to unbreak the build. 2003-07-15 14:36:36 +00:00
ceri
dd3d160697 Back out revision 1.22.
Requested by:	bde
2003-07-15 12:23:12 +00:00
marcel
0de826595a Fix typo: Passing the first argument to exit() in out2 does not work.
Trust me.
2003-07-15 03:50:38 +00:00
marcel
d207926373 _start() needed to be written in assembly. See crt1.S. 2003-07-14 03:05:42 +00:00
marcel
609dd6673b Rewite _start(). We cannot use a C function due to the fact that we
don't call it according to the runtime specification and especially
WRT to gp this can cause trouble. The gcc 3.3.1 import broke the
ia64 runtime because the compiler saved gp prior to us being able
to set it properly. Restoring gp after the calls would then invalidate
gp and cause segmentation faults later on.
By rewriting _start() as an assembly function, we also avoided even
more gcc dependences, by trying to use gcc specific features to work
around the problem.
This version of _start() does not reference _DYNAMIC. We register the
cleanup function when it's a non-NULL pointer. The kernel will always
pass a NULL pointer and dynamic linkers may pass a non-NULL pointer.

The machine independent code to set __progname now unfortunately is
written in assembly. So be it.
2003-07-13 23:11:37 +00:00
ceri
81cef9d233 ioctl macros and defines are now present in ioccom.h, not ioctl.h.
Update the manpage to reflect this.

PR:		docs/54235
Submitted by:	Karen Thode <thode12@msn.com>
2003-07-13 21:02:48 +00:00
deischen
d0f9275fab Remove -D_THREAD_SAFE.
Submitted by:   Craig Rodrigues <rodrigc@crodrigues.org>
2003-07-13 05:35:30 +00:00
davidxu
b9406d0dcb Don't resume sigwait thread If signal is masked. 2003-07-09 22:30:55 +00:00
davidxu
6788f22790 POSIX says if a thread is in sigwait state, although a signal may not in
its waitset, but if the signal is not masked by the thread, the signal
can interrupt the thread and signal action can be invoked by the thread,
sigwait should return with errno set to EINTR.
Also save and restore thread internal state(timeout and interrupted)
around signal handler invoking.
2003-07-09 14:30:51 +00:00
davidxu
f179c44470 Restore signal mask correctly after fork(). 2003-07-09 01:39:24 +00:00
davidxu
02dc7045da Save and restore thread's error code around signal handling.
Reviewed by: deischen
2003-07-09 01:06:12 +00:00
mtm
0eeacfc2aa When _PTHREADSINVARIANTS is defined SIGABRT is not included
in the set of signals to block.
Also, make the PANIC macro call abort() instead of simply
exiting.
2003-07-08 09:58:23 +00:00
davidxu
d9376aced0 Correctly print signal mask, the bug was introduced by cut and paste
in last commit.
2003-07-07 12:12:33 +00:00
davidxu
44061c5bc7 Add a newline to debug message. 2003-07-07 04:32:17 +00:00
davidxu
ce5e2d17e8 Avoid accessing user provided parameters in critical region.
Reviewed by: deischen
2003-07-07 04:28:23 +00:00
gshapiro
ca7f48dde3 Remove MAINTAINER= lines from individual Makefiles in favor of the
MAINTAINER file (which already had entries for sendmail).
2003-07-07 03:54:04 +00:00
davidxu
b360279e39 Print thread's scope, also print signal mask for every thread and print
it in one line.
2003-07-07 03:08:11 +00:00
mtm
779f68a3ac Change all instances of THR_LOCK/UNLOCK, etc to UMTX_*.
It is a more acurate description of the locks they
operate on.
2003-07-06 10:18:48 +00:00
mtm
c03c8060fa There's no need for _umtxtrylock to be a separate function.
Roll it into the pre-existing macro that's used to call it.
2003-07-06 10:10:32 +00:00
ache
533cd8fe8c Add const to __setrunelocale prototype 2003-07-06 04:01:09 +00:00
ache
8ad7994cbf Reorganize wrapper around setrunelocale() to mark it as deprecated
in FreeBSD 6
2003-07-06 02:03:37 +00:00
tjr
4d01a003cf Add more useful cross-references to the SEE ALSO section. 2003-07-05 07:55:34 +00:00
tjr
9b68d2b831 Catch up with recent FP-related changes to scanf.3 and vfwscanf.c. 2003-07-05 07:47:55 +00:00
tjr
12fd8e2ec7 Fix two incorrect uses of sizeof: we need to divide the size of the buffer
by sizeof(wchar_t) to get the number of wide characters it contains.
Remove the !hardway micro-optimisation from the CT_INT case to avoid
having to fix it for wide characters.
2003-07-05 03:39:23 +00:00
tjr
46773d4708 Merge recent floating point conversion changes from vfscanf.c. 2003-07-05 02:35:06 +00:00
davidxu
0f7959ebf7 Correctly lock/unlock signal lock. I must be in bad state, need to sleep. 2003-07-04 08:51:37 +00:00
davidxu
d8b7d75543 Always check and restore sigaction previously set, also access user parameter
outside of lock.
2003-07-04 07:49:06 +00:00
ru
b89eb2150d With the latest mdoc(7), we can now fix the synopsis like this.
Desired by:	bde
2003-07-03 18:14:39 +00:00
davidxu
22ffae0dac If select() is only used for sleep, convert it to nanosleep,
it only need purely wait in user space.
2003-07-03 13:36:29 +00:00
mtm
3df92662f1 _pthread_mutex_trylock() is another internal libc function that must block
signals.
2003-07-03 13:28:53 +00:00
davidxu
930aed3431 Check if thread is in critical region, only testing check_pending
is not enough.
2003-07-03 10:12:21 +00:00
ru
d8019801b0 Style. 2003-07-02 20:52:39 +00:00
ru
40d6336a49 Take thr_support.c out of SRCS so that it does not end up in libraries.
Record the missing dependency of thr_libc.So on the libc_pic.a library.

OK'ed by:	kan
2003-07-02 20:51:30 +00:00
davidxu
62bfd1a6cc Set unlock_mutex to 1 after locked mutex.
Use THR_CONDQ_CLEAR not THR_COND_SET in cond_queue_deq, current
cond_queue_deq is not used.
2003-07-02 14:12:37 +00:00
ru
db3c5cfcd0 Make libc/${MACHINE_ARCH} include directory not required by Alpha.
Submitted by:	bde
Tested by:	beast
2003-07-02 13:27:54 +00:00
davidxu
049a0b3e74 Fix typo. 2003-07-02 13:23:03 +00:00
jkh
99ef48152d When size is 1 should just null terminate the string. The dummy variable
is made an array of two, to explicitly avoid stack corruption due to
null-terminating (which is doesn't actually happen due to stack alignment
padding).

Submitted by: Ed Moy <emoy@apple.com>
Obtained from: Apple Computer, Inc.
2003-07-02 07:08:44 +00:00
mtm
5ec3bd276a Begin making libthr async signal safe.
Create a private, single underscore, version of pthread_mutex_unlock for libc.
pthread_mutex_lock already has one. These versions are different from the
ones that applications will link against because they block all signals
from the time a call to lock the mutex is made until it is successfully
unlocked.
2003-07-02 02:05:23 +00:00
kan
242ca04ba8 libc/${MACHINE_ARCH} include directory is required by Alpha,
add it to CFLAGS.
2003-07-02 01:52:06 +00:00
iedowse
74a3e38111 Add a new mount flag MNT_BYFSID that can be used to unmount a file
system by specifying the file system ID instead of a path. Use this
by default in umount(8). This avoids the need to perform any vnode
operations to look up the mount point, so it makes it possible to
unmount a file system whose root vnode cannot be looked up (e.g.
due to a dead NFS server, or a file system that has become detached
from the hierarchy because an underlying file system was unmounted).
It also provides an unambiguous way to specify which file system is
to be unmunted.

Since the ability to unmount using a path name is retained only for
compatibility, that case now just uses a simple string comparison
of the supplied path against f_mntonname of each mounted file system.

Discussed on:	freebsd-arch
mdoc help from:	ru
2003-07-01 17:40:23 +00:00
mtm
829c6214e9 Do not attempt to reque a thread on a mutex queue. It may be that
a thread receives a spurious wakeup from sigtimedwait(), so make sure
that the call to the queueing code is called only once before entering
the loop (not in the loop). This should fix some fatal errors people
are seeing with messages stating the thread is already on the mutex queue.
These errors may still be triggered from signal handlers; however, since
that part of the code is not locked down yet.
2003-07-01 15:52:09 +00:00
ru
86955254f6 Unbreak "make checkdpadd". 2003-07-01 15:37:35 +00:00
maxim
7ef70a1fa5 o strmode(3) returns void not 0.
PR:		docs/53488
Submitted by:	Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
MFC after:	1 week
2003-07-01 15:28:05 +00:00
ru
87f851d40d Axe AINC.
Submitted by:	bde
2003-07-01 15:07:01 +00:00
bde
b553e9dddd Fixed some style bugs. 2003-07-01 12:30:03 +00:00
alfred
1b479657a2 Don't segfault if setproctitle(3) is called with NULL initially.
The old buffer was not being initialized and a later str*() op on
it would cause a crash if it wasn't initialized by a previous
call to setproctitle(3) with an actual string.

Noticed by: Ashley Penney <ashp@unloved.org>
2003-07-01 09:45:35 +00:00
iedowse
bfaf460dd7 Separate the description of the flags for mount(2) and unmount(2)
to clarify which system call accepts which arguments. Previously
the manual page gave the impression that calling unmount() with
flags of (MNT_FORCE | MNT_UPDATE | MNT_RDONLY) would downgrade a
read-write mount to read-only, which is clearly untrue; to do that,
these flags should be passed to mount() instead.
2003-06-30 22:22:12 +00:00
ru
a6c4dc6b5f bsd.lib.mk,v 1.143 no longer uses ld(1) directly to strip
symbols from intermediate object files, so these hacks to
get AMD64 compile are no longer needed.

Tested on:	sledge.FreeBSD.org
2003-06-30 19:08:49 +00:00
ru
9c233107cc MFi386: revision 1.19. 2003-06-30 12:53:39 +00:00
mtm
8e37f0f1ee Catchup with _thread_suspend() changes. 2003-06-30 12:35:31 +00:00
davidxu
17c4a603a9 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
davidxu
9dbd921f84 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
mtm
a4b83e0fa9 Sweep through pthread locking and use the new locking primitives for
libthr.
2003-06-29 23:51:04 +00:00
mtm
2987dd3b2e 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
mtm
c231048fc4 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
6bff75208c 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
jdp
6d48a1845f 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
das
566cff5138 Teach fmtcheck(3) about the flags a, A, F, G, t, and z. 2003-06-29 01:11:31 +00:00
mtm
fbdb34dbc0 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
ru
6371072878 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
davidxu
8980e28992 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
davidxu
8109f8e495 Use mmap retuned value.
Reviewed by: deischen
2003-06-28 09:48:05 +00:00
davidxu
7bcb8e0bde 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
davidxu
484836c685 Write new thread pointer back only when success.
Reviewed by: deischen
2003-06-28 09:41:59 +00:00
davidxu
80e22b2cb3 After thread was interrupted by signal, it should relock mutex.
Reviewed by: deischen
2003-06-28 09:40:57 +00:00
davidxu
c1e4bd3f7d 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
das
1bb8a79ee5 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
das
fd84bcaedd 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
241ed6e2c5 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
yar
1c86c84352 Correct a misspelled name of time_hi_and_version. 2003-06-27 13:41:29 +00:00
marcel
57df706ad1 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
90cdf1acc7 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
jwd
0a944473d1 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
se
d27362db92 Fix URL of zlib home page: It's hosted at gzip.org now. 2003-06-26 20:05:47 +00:00
phantom
44b1c653a5 . 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
25e7c20bc2 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
2fed9a08dc 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
e22167dff6 Re-enable libstand on all platforms including amd64. 2003-06-26 03:48:23 +00:00
peter
de43e441a6 Add amd64 build glue 2003-06-26 03:48:01 +00:00
phantom
5ee7a43fea Reduce code duplication by separating _PathLocle detection code into
internal helper function.
2003-06-25 22:42:33 +00:00
phantom
c04a5c6e67 Move _PathLocale declaration to more logical place (setlocale.c) 2003-06-25 22:34:13 +00:00
phantom
e8444fede1 Catch up with _PATH_LOCALE move from rune.h to paths.h 2003-06-25 22:31:42 +00:00
obrien
6bb58a9f03 mdoc police 2003-06-25 21:31:43 +00:00
obrien
6254b70e40 Be more specific in BUGS.
Submitted by:	ru

Add history.
2003-06-25 19:18:44 +00:00
obrien
15d972d080 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
ache
74d8d1622c 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
yar
988fc713e7 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
yar
34ce6c0697 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
10d29f7e9e Implement signalcontext(). Needed by libpthread (aka libkse). 2003-06-24 05:06:42 +00:00
marcel
33d8231964 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
2121314d8c 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
8989b15a29 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
f41ef32441 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
4c583060f1 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
5e844e7396 Remove _atomic_lock. It's not used. 2003-06-23 04:33:32 +00:00
marcel
550a92f17b 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
imp
afb49f1c29 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
das
cfbfc48926 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
phk
fc20e153cd ttyname(3) must return absolute pathnames.
Noticed by:	kris
2003-06-21 08:16:12 +00:00