Commit Graph

8176 Commits

Author SHA1 Message Date
emax
b655606c42 Update Bluetooth code.
Reviewed by: M. Warner Losh <imp@bsdimp.com>; John Hay <jhay@freebsd.org>
Approved by: M. Warner Losh <imp@bsdimp.com> (mentor)
2003-10-12 22:04:24 +00:00
deischen
53599db414 Don't forget to initialize the fake tcb when the kcb is allocated. 2003-10-12 16:50:45 +00:00
ume
c9ac7566f1 - RIPEMD160 support
- pass size arg to ah->result (avoid assuming result buffer size)

Obtained from:	KAME
2003-10-12 09:41:42 +00:00
dds
4065e819ad Changed EINVAL constant reference from UIO_MAXIOV to IOV_MAX.
The former is a kernel-only visible constant, the latter the
POSIX-specified userland constant defined by including limits.h.
2003-10-11 20:47:44 +00:00
hmp
a49fc7ba02 Assorted mdoc(7) fixes:
- fix hard sentence breaks
	- sprinkle a few .Vt's where neccessary
	- remove incorrect use of `\-'
	- proper quoting using .Dq, instead of manual ``...''

Approved by:	des@ (mentor)
Reviewed by:	ru@
2003-10-09 23:06:06 +00:00
deischen
4d56950c49 Reverse the order of the first two arguments to _sparc64_enter_uts().
The first argument is the UTS function, the second argument is the
first argument to the UTS function.  Who's on first.
2003-10-09 20:52:17 +00:00
deischen
3746a5ee24 Convert a couple of hardcoded values to constants. Make thr_getcontext()
return 0 when called the first time, and return 1 when resumed by
thr_setcontext().
2003-10-09 14:48:09 +00:00
hmp
af5d93a608 Remove unneccessary include of sys/types.h in the SYNOPSIS
header.

Sys/param.h includes sys/types.h internally unless LOCORE is
defined.

Approved by:	des (mentor)
2003-10-09 09:45:20 +00:00
deischen
5c8f912f90 Add preliminary sparc64 support to libpthread. This does not
yet work, but hopefully someone familiar with the sparc64
port can pick up the reins.

Submitted by:	jake
With mods by:	deischen
2003-10-09 02:32:28 +00:00
davidxu
270b1cdd32 Fix some comments for last commit. 2003-10-08 00:30:38 +00:00
davidxu
ee8841d457 Complete cancellation support for M:N threads, check cancelling flag when
thread state is changed from RUNNING to WAIT state and do some cancellation
operations for every cancellable state.

Reviewed by: deischen
2003-10-08 00:20:50 +00:00
davidxu
9134d50921 Use thread lock instead of scheduler lock to eliminate lock contention
for all wrapped syscalls under SMP.

Reviewed by: deischen
2003-10-08 00:17:13 +00:00
phk
5f5cfc9be8 Add XXX'ed temporary bounce-buffering. 2003-10-07 07:12:22 +00:00
bms
7b987f7a47 Correct .Xr's in kiconv.3.
Submitted by:	osa
2003-10-05 13:39:28 +00:00
deischen
3970d19678 Fix a logic error; use beq to check for a register being NULL, not bne. 2003-10-02 20:51:30 +00:00
ru
7b267b13bd Correct the library name. 2003-10-02 19:19:07 +00:00
kensmith
e0676951c4 - Remove error code that can't be returned (and original description
was not proper English)

PR:             docs/57434
Approved:       blackend (mentor)
Reviewed by:    deischen
2003-10-02 18:30:15 +00:00
davidxu
ed0abb4e08 Only generate code for _LCK_ASSERT if _LCK_DEBUG is defined. 2003-10-02 03:24:26 +00:00
tjr
03a7afc8c9 Cite the published version of "Engineering a Sort Function" instead of
an email address.  Spell McIlroy correctly.
2003-09-30 07:05:46 +00:00
deischen
538f423c87 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
davidxu
d5d471e11b When concurrency level is reduced and a kse is exiting, make sure no other
threads are still referencing the kse by migrating them to initial kse.

Reviewed by: deischen
2003-09-29 06:25:04 +00:00
davidxu
7d57e54c87 Remove unused variable. 2003-09-28 13:47:29 +00:00
marcel
e8648b41a1 Relink libc_r.a, libc_r.so and libc_r_p.so from libthr to libkse.
On ia64, where there's no libc_r at all, libkse is now the default
thread library by virtue of these links.

The reasons for this change are:
1. libkse is slated to become the default thread library anyway,
2. active development and maintenance is only present for libkse,
3. GNOME and KDE, both in the process of being supported on ia64,
   work better with KSE; even on ia64.
2003-09-27 23:27:19 +00:00
phk
fe0e97f849 More style fixes to improve diffability with OpenBSD.
Pull 'A' evilness for realloc(3) from OpenBSD.
2003-09-27 18:58:26 +00:00
rwatson
6f94b8e6ae Disable #define DEBUG in libdisk by default: since libdisk is primarily
there to support sysinstall, and enabling DEBUG creates spurious
console output that can't be read anyway...  This slightly cleans up
the visual impression of the system install by not spamming the console
during the labeling of the disks.
2003-09-27 17:44:41 +00:00
phk
ebbf74a5d9 Style changes to improve diffability against OpenBSD version. 2003-09-27 17:29:03 +00:00
tjr
afe7565c55 Document KERN_PROC_PROC, update KERN_PROC_ALL description. 2003-09-27 08:22:23 +00:00
tjr
4d68b1381f Use the 3-component version of the KERN_PROC_PROC sysctl. 2003-09-27 08:14:37 +00:00
fjoe
a672193cd8 - Support for multibyte charsets in LIBICONV.
- CD9660_ICONV, NTFS_ICONV and MSDOSFS_ICONV kernel options
(with corresponding modules).
- kiconv(3) for loadable charset conversion tables support.

Submitted by:	Ryuichiro Imura <imura@ryu16.org>
2003-09-26 20:26:25 +00:00
davidxu
6e4004647c Add __volatile keyword. 2003-09-26 11:59:04 +00:00
marcel
ebc8c00a97 s/ia64/alpha/g 2003-09-26 06:53:54 +00:00
peter
f018c61d56 Fix fabs(). This commit brought to you by the letter 'l'.
(fstp stores a mem32 value, fstpl stores a mem64 value)

This fixes ghostscript for 'make release' on amd64.  Ghostscript for some
reason thinks it is a good idea to use -fno-builtin, which means it is
vulnerable to bugs in libc that are normally hidden by the builtin gcc
functions.  Oops.
2003-09-26 01:49:48 +00:00
davidxu
97f89f5eb1 pthread API should return error code in return value not in errno.
Reviewed by: deischen
2003-09-25 13:53:49 +00:00
davidxu
680ab8905d If syscall failed, restore old sigaction and return error to thread. 2003-09-25 06:23:40 +00:00
davidxu
325b5ebdea As comments in _mutex_lock_backout state, only current thread
can clear the pointer to mutex, not the thread doing mutex
handoff. Because _mutex_lock_backout does not hold scheduler
lock while testing THR_FLAGS_IN_SYNCQ and then reading mutex
pointer, it is possible mutex owner begin to unlock and
handoff the mutex to the current thread, and mutex pointer
will be cleared to NULL before current thread reading it, so
current thread will end up with deferencing a NULL pointer,
Fix the race by making mutex waiters to clear their mutex pointers.
While I am here, also save inherited priority in mutex for
PTHREAD_PRIO_INERIT mutex in mutex_trylock_common just like what
we did in mutex_lock_common.
2003-09-24 12:52:57 +00:00
marcus
1598bfd0f5 Grrr...add the Skinny alias code forgotten in the last commit. 2003-09-23 07:42:33 +00:00
marcus
429e15dea7 Add Cisco Skinny Station protocol support to libalias, natd, and ppp.
Skinny is the protocol used by Cisco IP phones to talk to Cisco Call
Managers.  With this code, one can use a Cisco IP phone behind a FreeBSD
NAT gateway.

Currently, having the Call Manager behind the NAT gateway is not supported.
More information on enabling Skinny support in libalias, natd, and ppp
can be found in those applications' manpages.

PR:		55843
Reviewed by:	ru
Approved by:	ru
MFC after:	30 days
2003-09-23 07:41:55 +00:00
davidxu
4fb7f47253 Free thread name memory if there is. 2003-09-23 04:02:23 +00:00
davidxu
dfbbf3ec80 Save and restore timeout field for signal frame just like what we did
for interrupted field.
Also in _thr_sig_handler, retrieve current signal mask from kernel not
from ucp, the later is pre-unioned mask, not current signal mask.
2003-09-22 14:40:36 +00:00
davidxu
a70d9fb2c2 Fix FPU state restoring bug by jumping to right position. 2003-09-22 14:34:02 +00:00
davidxu
bb5ac5c379 Print waitset correctly. 2003-09-22 00:40:23 +00:00
marcel
57ccbd6240 Make KSE_STACKSIZE machine dependent by moving it from thr_kern.c to
pthread_md.h. This commit only moves the definition; it does not
change it for any of the platforms. This more easily allows 64-bit
architectures (in particular) to pick a slightly larger stack size.
2003-09-19 23:28:13 +00:00
marcel
c61eebe4d0 _ia64_break_setcontext() now takes a mcontext_t. While here, define
THR_SETCONTEXT as PANIC(). The THR_SETCONTEXT macro is currently not
used, which means that the definition we had could be wrong, overly
pessimistic or unknowingly right. I don't like the odds...

The new _ia64_break_setcontext() and corresponding kernel fixes make
KSE mostly usable. There's still a case where we don't properly
restore a context and end up with a NaT consumption fault (typically
an indication for not handling NaT collection points correctly),
but at least now mutex_d works...
2003-09-19 23:00:28 +00:00
marcel
6f2a7c4c37 Stop using the setcontext() syscall to restore an async context.
Instead use the break instruction with an immediate specially
created for us.
2003-09-19 22:54:05 +00:00
des
c5c27920e0 Ignore ECHILD from waitpid(2) (our child may have been reaped by the
calling process's SIGCHLD handler)

PR:		bin/45669
2003-09-19 11:33:03 +00:00
davidxu
c2bda27825 pthread api should return error code in return value, not in errno. 2003-09-18 12:19:28 +00:00
davidxu
8a841ec2e7 Fix a typo. Also turn on PTHREAD_SCOPE_SYSTEM after fork(). 2003-09-16 02:03:39 +00:00
deischen
4d83fbebd8 Remove a comment that questioned why the size of the FPU
state for amd64 was twice as large as necessary.  Peter
recently fixed this, so the comment no longer applies.

Also, since the size of struct mcontext changed, adjust
the threads library version of get&set context to match.

FYI, any change layout/size change to any arch's struct
mcontext will likely need some minor changes in libpthread.
2003-09-16 00:00:53 +00:00
fenner
2eb9e797c4 From OpenBSD:
always widen the imputed netmask if it is narrower than the specified octets.
fixes a strange behaviour where inet_net_pton would always return 4 (bits)
for multicast addresses no matter how many octets were specified.

negotiated with Paul Vixie, original author of this function.

PR:		standards/53151
Submitted by:	Max Laier <max@love2party.net>
Optained from:	OpenBSD
2003-09-15 23:38:06 +00:00
ume
e4b69e5194 Our getaddrinfo() and getnameinfo() are thread-safe but
some limitation.

Reported by:	Marc G. Fournier <scrappy@hub.org>
2003-09-15 04:52:15 +00:00
davidxu
5b6e094e88 Fix bogus comment and assign sigmask in critical region, use
SIG_CANTMASK to remove unmaskable signal masks.
2003-09-15 00:08:48 +00:00
davidxu
f0d690ca3b Fix a bogus comment, sigmask must be maintained correctly,
it will be inherited in pthread_create.
2003-09-15 00:06:46 +00:00
davidxu
88517f2bfb 1. Allocating and freeing lock related resource in _thr_alloc and _thr_free
to avoid potential memory leak, also fix a bug in pthread_create, contention
   scope should be inherited when PTHREAD_INHERIT_SCHED is set, and also check
   right field for PTHREAD_INHERIT_SCHED, scheduling inherit flag is in sched_inherit.
2. Execute hooks registered by atexit() on thread stack but not on scheduler
   stack.
3. Simplify some code in _kse_single_thread by calling xxx_destroy functions.

Reviewed by: deischen
2003-09-14 22:52:16 +00:00
davidxu
6bb97514a6 When invoking an old style signal handler, use true traditional BSD style to
invoke signal handler.

Reviewed by: deischen
2003-09-14 22:42:39 +00:00
davidxu
3a38b0df30 Respect POSIX specification, a value return from pthread_attr_getguardsize
should be a value past to pthread_attr_setguardsize, not a rounded up value.
Also fix a stack size matching bug in thr_stack.c, now stack matching code
uses number of pages but not bytes length to match stack size, so for example,
size 512 bytes and size 513 bytes should both match 1 page stack size.

Reviewed by: deischen
2003-09-14 22:39:44 +00:00
davidxu
2733205df0 Avoid garbage bits in c_flags by direct assigning value.
Reviewed by: deischen
2003-09-14 22:33:32 +00:00
davidxu
45e25ef552 If user is seting scope process flag, clear PTHREAD_SCOPE_SYSTEM bit
accordingly.

Reviewed by: deischen
2003-09-14 22:32:28 +00:00
davidxu
52da9a294e Check invalid parameter and return EINVAL.
Reviewed by: deischen
2003-09-14 22:28:13 +00:00
ru
f501f1b590 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
ru
5f36712a74 mdoc(7): Fix common mistakes made in the SEE ALSO section. 2003-09-12 21:54:11 +00:00
ru
c581c0c568 mdoc(7): Properly mark C headers. 2003-09-10 19:24:35 +00:00
roberto
11fbeb6f7c Document the fact that send(2) can return EPIPE (like when a socket is not
connected).

PR:		docs/56683
Submitted by:	Chris S.J. Peron <maneo@bsdpro.com>
MFC after:	3 days
2003-09-10 19:19:49 +00:00
ru
cc428340fa Fixed -Wpointer-arith warning.
Submitted by:	Stefan Farfeleder
PR:		bin/56653
2003-09-09 23:50:57 +00:00
davidxu
a49f338da8 Original pthread_once code has memory leak if pthread_once_t is used in
a shared library or any other dyanmic allocated data block, once
pthread_once_t is initialized, a mutex is allocated, if we unload the
shared library or free those data block, then there is no way to deallocate
the mutex, result is memory leak.
To fix this problem, we don't use mutex field in pthread_once_t, instead,
we use its state field and an internal mutex and conditional variable in
libkse to do any synchronization, we introduce a third state IN_PROGRESS to
wait if another thread is already in invoking init_routine().
Also while I am here, make pthread_once() conformed to pthread cancellation
point specification.

Reviewed by: deischen
2003-09-09 22:38:12 +00:00
davidxu
fd097cd051 Add code to support pthread spin lock.
Reviewed by: deischen
2003-09-09 06:57:51 +00:00
ru
b8e742a388 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
iedowse
36075ef78b In the !MNT_BYFSID case, return EINVAL from unmount(2) when the
specified directory is not found in the mount list. Before the
MNT_BYFSID changes, unmount(2) used to return ENOENT for a nonexistent
path and EINVAL for a non-mountpoint, but we can no longer distinguish
between these cases. Of the two error codes, EINVAL was more likely
to occur in practice, and it was the only one of the two that was
documented.

Update the manual page to match the current behaviour.

Suggested by:	tjr
Reviewed by:	tjr
2003-09-08 16:23:21 +00:00
davidxu
06e4314d5e Add small piece of code to support pthread_rwlock_timedrdlock and
pthread_rwlock_timedrwlock.
2003-09-06 00:07:52 +00:00
kan
9fe3b42d97 The caller is expected to set up PIC register corectly before
jumping to .cerror. This means .cerror has to be present in the
same module with its consumers, or bad things will happen.
2003-09-05 18:08:19 +00:00
roam
5c08296b92 Clarify that the second argument to accept() may be a null pointer if
no peer address information is desired.

PR:		56044
Submitted by:	Felix Opatz <felix@zotteljedi.de> and
		Bernd Luevelsmeyer <bdluevel@heitec.net>
MFC after:	1 month
2003-09-05 15:41:52 +00:00
tjr
79fc736b7a Remove an unused and incorrect prototype for _none_init(). 2003-09-05 09:01:31 +00:00
simon
a39242b93f Move a sentence about the terminating \0 from the RETURN VALUES section
(where it didn't really belong), to the DESCRIPTION section.

English advice:	ceri
Requested by:	das
MFC after:	4 weeks
2003-09-04 20:36:54 +00:00
davidxu
f914f8856f Add code to support barrier synchronous object and implement
pthread_mutex_timedlock().

Reviewed by: deischen
2003-09-04 14:06:43 +00:00
davidxu
6a27d7fc87 Remove repeated macro THR_IN_CONDQ. 2003-09-04 07:46:26 +00:00
davidxu
e677b7320c Allow hooks registered by atexit() to run with current thread pointer set,
without this change, my atexit test dumps core.
2003-09-04 05:24:53 +00:00
peter
f8ae9fee59 Sigh. I can't win anything. Use addq rather than addl with %rsp. 2003-09-04 00:31:45 +00:00
peter
de34c3b774 Apply same basic fix for getcontext(2) as for i386. Store the return
value for getcontext() in a preserved register rather than on the stack.
The second time around, the stack value would likely have changed so we
can't depend on it for the return value.
2003-09-04 00:29:12 +00:00
peter
8113c1d20c Fix some minor whitespace botches 2003-09-04 00:26:40 +00:00
peter
73d537652a Make getcontext(2) work on i386. It needs a small wrapper in libc
otherwise the return from the syscall stub for getcontext will pop off
the return value for the caller to the getcontext stub and it will appear
as though the setcontext() syscall returned instead of the getcontext().
The same bug exists on amd64, a fix is coming there too.

The bug can be demonstrated with this test code fragment:
main()
{
        ucontext_t top;

        if (getcontext(&top) == 0) {
                write(2, "PING!\n", 6);
                /* Cause a return value of 1 from getcontext this time */
                top.uc_mcontext.mc_eax = 1;
                setcontext(&top);
                err(1, "setcontext() returned");
        }
        write(2, "PONG!\n", 6);
        _exit(0);
}
2003-09-04 00:20:40 +00:00
deischen
8271ec1da3 Don't assume sizeof(long) = sizeof(int) on x86; use int
instead of long types for low-level locks.

Add prototypes for some internal libc functions that are
wrapped by the library as cancellation points.

Add memory barriers to alpha atomic swap functions (submitted
by davidxu).

Requested by:	bde
2003-09-03 17:56:26 +00:00
davidxu
6a2d053fbe Move kse_wakeup_multi call to just before KSE_SCHED_UNLOCK.
Tested on: SMP
2003-09-03 00:21:10 +00:00
kan
4c3d911e6a Rethink the way thr_libc.So is generated. Relying on GCC to extract
only needed symbols from libc_pic is not working on sparc64.

Requested by: jake
2003-09-02 19:37:11 +00:00
dds
5039a5114a Fix/add errno return values to match the NFS client implementation and
better represent failures of special files accessed over NFS.

Approved by:	schweikh (mentor)
Reviewed by:	bde (as a description)
MFC after:	6 weeks
2003-09-02 16:50:17 +00:00
eivind
a367c138ae Update the kern.osreldate documentation to document the present format
used, and refer to <osreldate.h> to get userland date.

Submitted by:	ru
2003-09-01 14:26:33 +00:00
rwatson
c170c24baa Return (-1) not (ENOENT) for mac_prepare_type(), and set errno to
ENOENT instead.

Reported by:	"Kenneth D. Merry" <ken@kdm.org>
Submitted by:	Bryan Liesner <bleez@comcast.net>
2003-08-30 14:51:01 +00:00
ru
f666960067 Unbreak the NOINSTALLLIB install.
PR:		50945
Submitted by:	Rene de Vries <rene@tunix.nl>
Reminded by:	jmallett
2003-08-30 13:57:31 +00:00
deischen
78291f76e8 Allow the concurrency level to be reduced.
Reviewed by:	davidxu
2003-08-30 12:09:16 +00:00
dds
aba90a9ea4 Document that read(2) can also return EPERM
See e.g. nfsclient/nfs_vnops.c

static int
nfs_read(struct vop_read_args *ap)
{
        struct vnode *vp = ap->a_vp;

        if (vp->v_type != VREG)
                return (EPERM);
        return (nfs_bioread(vp, ap->a_uio, ap->a_ioflag, ap->a_cred));
}

Approved by:	schweikh (mentor)
MFC after:	6 weeks
2003-08-30 07:59:05 +00:00
seanc
184cb77a71 Add a reference to bn(3) for those looking for functional multiprecision
integer arithmetic.
2003-08-30 05:35:46 +00:00
des
2dd4214e98 Don't close a FILE * which we know is bogus. 2003-08-29 15:54:12 +00:00
phk
45b2e8fc31 Introduce more knobs to slim down FreeBSD userland
NO_TOOLCHAIN	skips Compilers and Binutils
NO_USB		skips USB stuff
NO_VINUM	skips Vinum stuff
NO_ACPI		skips ACPI stuff
2003-08-29 10:35:01 +00:00
obrien
45620e94dd Ignore ccd(4)'s. This is not the best solution, but it at least removes
the "BARF 360" ccd(4) user's experience.

Submitted by:	rwatson
2003-08-28 17:39:09 +00:00
phk
12349f1b7b Make build of libatm depend on existing NOATM conditional. 2003-08-27 20:00:48 +00:00
eivind
4a4391220d Clarify text 2003-08-26 15:52:47 +00:00
rwatson
c55f4a0c89 Add HISTORY sections to the remaining MAC library man pages.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 18:01:03 +00:00
rwatson
4d6f58c127 Update the mac_prepare(3) man page to reflect changes to the
mac_prepare() APIs.

Add a HISTORY section.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:58:38 +00:00
rwatson
4d31592507 Make the elements argument to mac_prepare() be const.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:49:59 +00:00
rwatson
8360be6900 As new objects begin to support new labels, start to generalize
the default label support in /etc/mac.conf.  Rather than maintain
each default label type in an explicit global variable in mac.c,
keep a list of defaults loaded from the configuration file.
Generalize the parsing so that we support both the older:

        default_file_labels foo
        default_ifnet_labels foo
        default_process_labels foo

And also a new:

        default_labels file foo
        default_labels ifnet foo
        default_labels process foo

We now accept arbitrary object classes in the first argument.  If
the same object is specified more than once, we discard the
earlier definition in favor of the later one.

Add a new API, mac_prepare_type(), which accepts a mac_t to
prepare, as well as an object name in the second argument, which
will pull a default label set for the object out of the
configuration loaded by mac_init_internal().  This permits the libc
to adapt to new objects known about by applications but not by libc
at compile-time.

Also liberalize the error handling a bit: if we're using implicit
initialization (i.e., the application didn't explicitly initialize
the MAC code), ignore syntax errors and only use valid lines.  In
the future, we may want to add explicit warnings and do this a
bit more consistently.

While here, add support for a MAC_CONFFILE environmental variable,
which may be used to specify an alternative mac.conf configuration
file if the application isn't running with modified privilege
(issetugid()).

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:36:23 +00:00
davidxu
6cea932126 Repost masked signal to kernel for scope system thread, it hardly happens
in real world.

Reviewed by: deischen
2003-08-21 22:02:18 +00:00
davidxu
46d65f5994 _thr_sig_check_pending is also called by scope system thread when it leaves
critical region, we wrap some syscalls for thread cancellation point, and
when syscalls returns, we call _thr_leave_cancellation_point, at the time
if a signal comes in, it would be buffered, and when the thread leaves
_thr_leave_cancellation_point, buffered signals will be processed, to avoid
messing up normal syscall errno, we should save and restore errno around
signal handling code.
2003-08-20 13:43:35 +00:00
deischen
d8051bc2b3 Add back a loop for up to PTHREAD_DESTRUCTOR_ITERATIONS to
destroy thread-specific data.  Display a warning when thread
specific data remains after PTHREAD_DESTRUCTOR_ITERATIONS.

Reviewed by:	davidxu
2003-08-20 02:34:14 +00:00
wollman
42b2e6a234 Add a kluge suggested by Marcel to paper over the difference between
gethostname()'s old and new signatures without requiring a library
bump.  Note that programs which called gethostname() with a negative
argument were already broken, since the same type conversion was done
by the old implementation.  Add a note in the Makefile so that whoever
next bumps the libc revision will delete the kluge at the same time
(as it will no longer be necessary).  This is only operative on 64-bit
platforms.

Submitted by:	marcel
2003-08-19 23:01:46 +00:00
wollman
bbaf57bc6d Change gethostname() to set errno to ENAMETOOLONG instead of ENOMEM
when the buffer is not long enough to hold the current host name.
POSIX does not standardize error returns for gethostname(), so it
doesn't matter which one we use, but ENAMETOOLONG is at least a little
more intuitive, and mi suggests the existence of prior art.  I've been
running with this change for a while on my home machine with no
effect.  At the same time, I've updated the prototype for
gethostname() to use the correct standard type (size_t) for the
namelen argument.

All of the in-tree callers fall into one of the following categories:
1) Call perror() or equivalent when gethostname() fails.
2) Ignore gethostname()'s return value entirely, potentially resulting
in data corruption if the buffer is too small.
3) Fall back to a (possibly sensible) default value if gethostname()
fails.

Many of the callers I examined shows signs of confusion about the
correct sizing of the host name buffer.  gethostname(3) now has more
information about this, as well as updated standards information.

PR:		48114
Submitted by:	mi (in part)
2003-08-19 20:38:44 +00:00
des
2658595cab Some servers respond to RETR in active mode with 125 (connection already
open) rather than 150 (opening connection).  There's no reason why we
shouldn't accept that.

PR:		misc/42172
MFC in:		3 days
2003-08-19 11:43:11 +00:00
davidxu
1fd6544c01 Support printing 64 bits pointer and long integer.
Reviewed by: deischen
2003-08-19 08:29:33 +00:00
davidxu
352ffda3af Save and restore errno around sigprocmask. 2003-08-19 03:33:51 +00:00
obrien
bf7b07bcb2 style.Makefile(5) 2003-08-18 15:25:39 +00:00
davidxu
397d22a6be Direct call exit if thread was never created. This makes it safe to call
pthread_exit in main() without creating any thread.

Tessted by: deischen
2003-08-18 04:03:08 +00:00
davidxu
260bbd66f6 Treat initial thread as scope system thread when KSE mode is not activated
yet, so we can protect some locking code from being interrupted by signal
handling. When KSE mode is turned on, reset the thread flag to scope process
except we are running in 1:1 mode which we needn't turn it off.
Also remove some unused member variables in structure kse.

Tested by: deischen
2003-08-18 03:58:29 +00:00
phk
a82593e559 It is not an error to have no devices. 2003-08-17 12:06:44 +00:00
gordon
4b82045616 Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.
2003-08-17 08:28:46 +00:00
obrien
0464919d76 Imply NOLIBC_R for PowerPC. 2003-08-16 21:21:07 +00:00
marcel
7230ef96de Fix wrong identifier on .end directive. The SYSCALL macro does name
mangling and creates an .ent directive with the mangled name.
2003-08-16 18:59:08 +00:00
davidxu
db28c0305b If threaded mode is not turned on yet, direct call __sys_sched_yield. 2003-08-16 13:02:45 +00:00
davidxu
161ca2a047 Replace some syscalls with libc version, this makes abort work better with
libkse. Tested under libc_r, libkse, libthr.

Reviewed by: deischen
2003-08-16 11:43:57 +00:00
davidxu
2c6b618a47 Keep initial kse and kse group just like we keep initial thread,
Don't free them, so some code can still reference them.

Reviewed by: deischen
2003-08-16 05:22:20 +00:00
davidxu
9c8977879e Access user provided pointer out of lock, and also check the case when
a key is less than 0.
2003-08-16 05:19:00 +00:00
marcel
deaa0e8184 Don't run verify directly as that would require the perl script to
have execute permissions. Run "perl verify" instead. Replace all
occurences of the hardcoding of ./verify with $(VERIFY) to allow
it to be overridden as well.
2003-08-13 03:59:18 +00:00
davidxu
51375674ef Always set tcb for bound thread, and switch tcb for M:N thread at correct
time.
2003-08-13 01:49:07 +00:00
davidxu
ccaab3b369 Don't forget to set kcb_self. 2003-08-12 22:13:06 +00:00
davidxu
a7dd76c9f7 Correctly set current tcb. This fixes some IA64/KSE problems.
Reviewed by: deischen, julian
2003-08-12 08:01:34 +00:00
iedowse
316c9b0831 Make the documentation of PT_STEP match its implementation: the
`data' parameter is not ignored; if non-zero, it specifies a signal
number to be delivered to the traced process.

MFC after:	1 day
2003-08-11 13:13:46 +00:00
bms
00dbbdbeb2 Add the mlockall()/munlockall() system call manual page from NetBSD.
PR:		kern/42426, standards/54223
Obtained from:	NetBSD
Reviewed by:	jake, alc
Approved by:	jake (mentor)
MFC after:	2 weeks
2003-08-11 07:16:21 +00:00
bms
ef68e851dd Add the mlockall() and munlockall() system calls.
- All those diffs to syscalls.master for each architecture *are*
   necessary. This needed clarification; the stub code generation for
   mlockall() was disabled, which would prevent applications from
   linking to this API (suggested by mux)
 - Giant has been quoshed. It is no longer held by the code, as
   the required locking has been pushed down within vm_map.c.
 - Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES
   to express their intention explicitly.
 - Inspected at the vmstat, top and vm pager sysctl stats level.
   Paging-in activity is occurring correctly, using a test harness.
 - The RES size for a process may appear to be greater than its SIZE.
   This is believed to be due to mappings of the same shared library
   page being wired twice. Further exploration is needed.
 - Believed to back out of allocations and locks correctly
   (tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC).

PR:             kern/43426, standards/54223
Reviewed by:    jake, alc
Approved by:    jake (mentor)
MFC after:	2 weeks
2003-08-11 07:14:08 +00:00
davidxu
e5b9617f19 Add some quick pathes to exit process when signal action is default and
signal can causes process to exit.

Reviewed by: deischen
2003-08-10 22:35:46 +00:00
davidxu
cb780acf7d Initialize rtld lock just before turning on thread mode and
uninitialize rtld lock after thread mode shutdown.
2003-08-10 22:30:20 +00:00
davidxu
abcfcf5e1e If thread mode is not activated yet, just call __sys_fork() directly,
otherwise masks all signals until fork() returns, in child process,
we reset library state before restoring signal masks until we reach
a safe to point.

Reviewed by: deischen
2003-08-10 22:20:41 +00:00
davidxu
aaa7178ea7 Tweak rtld lock to allow recursive on reader lock and detect recursive
on writer lock. This is first cut at rwlock for rtld.

Submitted by: desichen
2003-08-10 22:15:03 +00:00
davidxu
2fd1fb534f If thread mode is not activated yet, don't do extra work.
Reviewed by: deischen
2003-08-10 22:07:28 +00:00
ache
e8021e9302 For type 0 rng lower initial drop to 50, it is enough to hide linearity
Reorganize historic #ifdef section
2003-08-10 17:49:55 +00:00
tjr
0bfcd2147c Fix the case of the encoding name in the ENCODING line. Names are
case-sensitive, and MSKANJI does not work.
2003-08-10 11:41:38 +00:00
tjr
ae8b388b0b Cross-reference gbk(5). 2003-08-10 11:38:28 +00:00
tjr
02147fa3bd Cross-reference gbk(5) now that it exists. Fix a copy & paste error:
one occurrence of GB 18030 should have been 11383.
2003-08-10 11:36:42 +00:00
tjr
d5109bcfa5 Add a fairly minimal manual page for the GBK encoding. 2003-08-10 11:34:35 +00:00
tjr
039eabb0e8 Add a cross reference to Unicode 3.0. 2003-08-10 11:26:18 +00:00
tjr
3f1894db78 Add cross references to the new character encoding manual pages,
and to mbsinit(3) while I'm at it.
2003-08-10 09:25:52 +00:00
tjr
df079b6fc7 Add manual pages for the BIG5, GB18030 and MSKanji encodings. These may
need to be fleshed out a little, especially big5(5).
2003-08-10 09:23:51 +00:00
marcel
c4f1e0d95a o There are 6 trap disable bits in ar.fpsr, not five. Even though we
didn't provide a constant for one of them (non-IEEE denormal trap),
  in an attempt to not support it probably, it's not we are left with
  the lower 5 bits.
o Properly mask the passed or returned fp_except_t. Not doing so
  causes instant core dumps by trying to write an invalid value to
  ar.fpsr. Now that we're masking, stop using exclusive-or to invert
  bits.

This fixes the illegal instruction fault encountered when building
mozilla.
2003-08-09 17:07:24 +00:00
deischen
e2ccc73e15 Add libpthread to the alpha build.
Requested by ru: Since the majority of archs can now support the
build of libpthread, rearrange the Makefile to treat libpthread
as an exception.
2003-08-09 15:29:52 +00:00
deischen
55b1331d69 Add alpha support to libpthread. It compiles but hasn't been tested;
there is still some missing kernel support.

Reviewed by:	marcel
2003-08-09 05:44:27 +00:00
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