Commit Graph

7642 Commits

Author SHA1 Message Date
Mike Makonnen
9dc6e7848f Move a misplaced comment.
Approved by:	markm/mentor (implicit), re/blanket libthr
2003-05-20 18:48:41 +00:00
Daniel Eischen
28f318b941 Eek, staticize a couple of functions that shouldn't
be external (initialize()!).

Remove cancellation points from _pthread_cond_wait and
_pthread_cond_timedwait (single underscore versions are
libc private functions).  Point the weak reference(!) for
these functions to the versions with cancellation points.

Approved by:	re@(blanket till 5/19)
Pointed out by:	kan (cancellation point bug)
2003-05-19 23:04:50 +00:00
Dag-Erling Smørgrav
7691f66abf Retire the useless NOSECURE knob.
Approved by:	re (scottl)
2003-05-19 15:52:01 +00:00
Ruslan Ermilov
aba60fa66b Fixed troff(1) and mdoc(7) warnings.
Approved by:	re (blanket)
2003-05-18 21:05:22 +00:00
Martin Blapp
f8af072548 Fix a simple bug that prevents svc_tli_create to bind to the address
specified by caller.

NetBSD rev. 1.6

Reviewed by:	rwatson
Approved by:	rwatson (re)
Obtained from:	NetBSD
2003-05-18 15:07:25 +00:00
Ruslan Ermilov
0b00d54eed Moved libgeom.so dependencies to where they belong.
Reviewed by:	phk
Approved by:	re (scottl)
2003-05-17 19:05:17 +00:00
Marcel Moolenaar
f2c49dd248 Revamp of the syscall path, exception and context handling. The
prime objectives are:
o  Implement a syscall path based on the epc inststruction (see
   sys/ia64/ia64/syscall.s).
o  Revisit the places were we need to save and restore registers
   and define those contexts in terms of the register sets (see
   sys/ia64/include/_regset.h).

Secundairy objectives:
o  Remove the requirement to use contigmalloc for kernel stacks.
o  Better handling of the high FP registers for SMP systems.
o  Switch to the new cpu_switch() and cpu_throw() semantics.
o  Add a good unwinder to reconstruct contexts for the rare
   cases we need to (see sys/contrib/ia64/libuwx)

Many files are affected by this change. Functionally it boils
down to:
o  The EPC syscall doesn't preserve registers it does not need
   to preserve and places the arguments differently on the stack.
   This affects libc and truss.
o  The address of the kernel page directory (kptdir) had to
   be unstaticized for use by the nested TLB fault handler.
   The name has been changed to ia64_kptdir to avoid conflicts.
   The renaming affects libkvm.
o  The trapframe only contains the special registers and the
   scratch registers. For syscalls using the EPC syscall path
   no scratch registers are saved. This affects all places where
   the trapframe is accessed. Most notably the unaligned access
   handler, the signal delivery code and the debugger.
o  Context switching only partly saves the special registers
   and the preserved registers. This affects cpu_switch() and
   triggered the move to the new semantics, which additionally
   affects cpu_throw().
o  The high FP registers are either in the PCB or on some
   CPU. context switching for them is done lazily. This affects
   trap().
o  The mcontext has room for all registers, but not all of them
   have to be defined in all cases. This mostly affects signal
   delivery code now. The *context syscalls are as of yet still
   unimplemented.

Many details went into the removal of the requirement to use
contigmalloc for kernel stacks. The details are mostly CPU
specific and limited to exception_save() and exception_restore().
The few places where we create, destroy or switch stacks were
mostly simplified by not having to construct physical addresses
and additionally saving the virtual addresses for later use.

Besides more efficient context saving and restoring, which of
course yields a noticable speedup, this also fixes the dreaded
SMP bootup problem as a side-effect. The details of which are
still not fully understood.

This change includes all the necessary backward compatibility
code to have it handle older userland binaries that use the
break instruction for syscalls. Support for break-based syscalls
has been pessimized in favor of a clean implementation. Due to
the overall better performance of the kernel, this will still
be notived as an improvement if it's noticed at all.

Approved by: re@ (jhb)
2003-05-16 21:26:42 +00:00
Daniel Eischen
fd626336fd Add a method of yielding the current thread with the scheduler
lock held (_thr_sched_switch_unlocked()) and use this to avoid
dropping the scheduler lock and having the scheduler retake the
same lock again.

Add a better way of detecting if a low-level lock is in use.

When switching out a thread due to blocking in the UTS, don't
switch to the KSE's scheduler stack only to switch back to
another thread.  If possible switch to the new thread directly
from the old thread and avoid the overhead of the extra
context switch.

Check for pending signals on a thread when entering the scheduler
and add them to the threads signal frame.  This includes some
other minor signal fixes.

Most of this was a joint effor between davidxu and myself.

Reviewed by:	davidxu
Approved by:	re@ (blanket for libpthread)
2003-05-16 19:58:30 +00:00
Tim J. Robbins
6e7988b9c5 Catch up with the renaming of the "union" filesystem to "unionfs".
Fixes a problem where directory entries could show up twice: once
on the top layer of the union stack, and once on the bottom layer.

Approved by:	re (rwatson)
2003-05-16 02:15:07 +00:00
Mike Makonnen
dd3b229e2c Do some cleanup with respect to condition variables. The implementation
of pthread_cond_timedwait() is moved into cond_wait_common().
Pthread_cond_wait() and pthread_cond_timedwait() are now wrappers around
this function. Previously, the former called the latter with the abstime
pointing to 0 time. This violated Posix semantics should an application
have reason to call it with that argument because instead or returning
immediately it would have waited indefinitely for the cv to be signaled.

Approved by:	markm/mentor, re/blanket libthr
Reviewed by:	jeff
2003-05-15 18:17:13 +00:00
Mike Makonnen
6da7f4937e o Make the setting/checking of cancel state atomic with
respect to other threads and signal handlers by moving to
  the _thread_critical_enter/exit functions.

o Introduce an static function, testcancel(), that is used by
  the other functions in this module. This allows it to make
  locking assumptions that the top-level functions can't.

o Rework the code flow a bit to reduce indentation levels.

Approved by:	markm/mentor, re/blanket libthr
Reviewed by:	jeff
2003-05-15 17:56:18 +00:00
John Baldwin
840558b971 s/procsig/sigacts/ to catch up to procsig and sigacts changes in the kernel.
Approved by:	re (scottl)
2003-05-14 15:01:20 +00:00
Peter Wemm
e472fbeee2 Bandaid for world. jhb gets the pointy hat here and he needs to look at
this.

Approved by:   re (scottl)
2003-05-14 07:28:43 +00:00
Doug Barton
336c22c598 * The copy of the stat struct in the man page has rotted, so remove it.
Those who really need this information can find it in the include file.

* Include a succinct description of the st_birthtime field.

Approved by:	re (bmah)
2003-05-13 08:10:05 +00:00
Hiten Pandya
4a49423d71 Following MLINKS added, which point to host_access(3):
- hosts_ctl(3), hosts_access(3), request_init(3),
	  request_set(3).

PR: docs/52000
Submitted by: Simon L. Nielsen <simon@nitro.dk>
Approved and Reviewed by: des (mentor), re (scottl)
2003-05-12 21:59:16 +00:00
Mike Makonnen
479778b07f msg2 2003-05-12 10:40:53 +00:00
Mike Makonnen
c984b5a72a msg1 2003-05-12 10:34:01 +00:00
Peter Wemm
6b22ec82bf Update ldexp.c for amd64. 2003-05-10 00:47:52 +00:00
David Schultz
b7412bf571 Add a comment describing why it's important for the values in this
file to be correct, and how to generate them automatically.

Caused much pain and suffering for:	peter
2003-05-08 13:50:44 +00:00
Peter Wemm
0b1bb81ae6 SIG_SETMASK is 3, not 1. Sigh. 2003-05-08 07:41:24 +00:00
Peter Wemm
7ef6516c60 Fix an embarresing transcription error from i386 to amd64. Put the arguments
to sigprocmask(2) int the correct order. *blush*.
For sigsetjmp(), match up the pushq/popq in the non-savemask case.
2003-05-08 06:25:03 +00:00
Peter Wemm
dffecce67c Tidy up modf.S and make it actually work. It wasn't extracting
the value out of ST(0) before copying it to %xmm0.  Also remove bogus stack
frame and work in the red zone.
2003-05-08 03:19:37 +00:00
Peter Wemm
74b0b3cfcb Fix typo, even though this is unused. 2003-05-08 00:02:47 +00:00
Peter Wemm
c48f718c25 Like ia64, amd64 has got a 16 byte sized and aligned 'long double'.
Obtained from:	re (blanket amd64)
2003-05-08 00:02:03 +00:00
Peter Wemm
cf2720dda4 Turn off alloca.S - it cannot possibly work like this since on AMD64, gcc
doesn't use stack frames.  It uses offsets relative to %rsp, not %rbp.  So
we cannot just change %rsp like this.

Approved by:	re (blanket amd64)
2003-05-07 23:49:24 +00:00
Peter Wemm
be78acdf64 Actually use the correct values for AMD64. It is a 64 bit platform,
configure gdtoa as such.
2003-05-07 23:48:05 +00:00
John Baldwin
664234c6e2 Properly cleanup the stack before jumping to cerror() if rfork(2) fails.
Submitted by:	Igor Sysoev <is@rambler-co.ru>
Approved by:	re (scottl)
2003-05-07 17:23:25 +00:00
Mike Makonnen
a260623c5f Fix a null dereference leading to a core dump when
the number of threads exceeds the number of open slots
in ldt_entries[].

Approved by:	markm (mentor)(implicit)
Reviewed by:	jeff
2003-05-06 02:33:49 +00:00
Mike Makonnen
ae0df91f34 o Correct a debug message that refered to the wrong function
o Remove an unncecesary if clause

Approved by:	markm (mentor)(implicit)
Reviewd by:	jeff
2003-05-06 02:30:52 +00:00
Daniel Eischen
07e6b1c7a3 Make pthread_join() async-cancel-safe. David was going to commit
this, but I think he's asleep and want to be sure it gets in before
the freeze.

Submitted by:	davidxu
2003-05-06 00:02:54 +00:00
Dag-Erling Smørgrav
8b48559cff OpenPAM is WANRS6-clean. 2003-05-05 21:15:35 +00:00
Mark Murray
dbf104e68d Turn MAKE_KERBEROS5 into NO_KERBEROS by negating the logic. Some extra
cleanups were necessary in release/Makefile, and the tinderbox code
was syntax checked, not run checked.
2003-05-05 07:58:44 +00:00
Murray Stokely
eb8b21f78b Backout last commit. It is redundant in -CURRENT.
Pointed out by:	David Schultz
2003-05-05 06:25:03 +00:00
David Xu
f508d26091 call dump_queues() only when DEBUG_THREAD_KERN is defined, save some
cpu cycles.
2003-05-05 05:01:19 +00:00
Daniel Eischen
e8baaa7062 Replace use of a spinlock with a mutex. 2003-05-04 22:36:46 +00:00
Daniel Eischen
c72cd7c9e2 Protect against a race between granting a lock and accessing
other parts of the lock.

Submitted by:	davidxu
2003-05-04 22:29:09 +00:00
Murray Stokely
d8082d11aa Note that the idletime setting is not enforced.
PR:		docs/40952
MFC After:	3 days
2003-05-04 21:35:41 +00:00
David E. O'Brien
1628730478 This is now Gcc 3.3 WARNS 6 clean. 2003-05-04 18:34:00 +00:00
David E. O'Brien
bbe4999bd1 Set abitag __unused. 2003-05-04 18:33:26 +00:00
Daniel Eischen
40791d9d15 Fix suspend and resume.
Submitted (in part) by:	Kazuaki Oda <kaakun@highway.ne.jp>
2003-05-04 16:17:01 +00:00
Murray Stokely
df788a526f Document the login-backoff and login-retries capabilities.
PR:		docs/51397
MFC After:	3 days
2003-05-04 06:43:24 +00:00
David Xu
99c883294c Handle thread canceled case, it is same as signal caused backout,
but will break out of loop.
2003-05-02 11:39:00 +00:00
Mark Murray
aaa2c2ab24 Trasmute moer "krb5" distibutions into "crypto". 2003-05-01 21:21:15 +00:00
Tom Rhodes
a460614661 Use the .Dl macro.
Discussed with:	mdoc(7) officer ru
2003-05-01 20:27:59 +00:00
Ruslan Ermilov
a52672e938 Build non-crypto telnet(1) and telnetd(8) if NO_OPENSSL is defined.
Submitted by:	Marius Strobl <marius@alchemy.franken.de>
2003-05-01 19:38:15 +00:00
Tom Rhodes
7b98ad3005 State the fact that the range is twice the traditional RAND_MAX.
Add an EXAMPLES section.

PR:		48493
Submitted by:	Paul Herman <pherman@frenchfries.net> (original version)
2003-05-01 19:09:16 +00:00
Jacques Vidrine
d05090827f Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
2003-05-01 19:03:14 +00:00
David E. O'Brien
d37f19f084 Convert the i386 alloca(3) to the x86-64 ISA.
Alignment hack from:	NetBSD
2003-05-01 16:04:38 +00:00
Dag-Erling Smørgrav
6c0510dc2f Use C99-style varadic macros instead of the non-standard gcc syntax. 2003-05-01 15:08:55 +00:00
Dag-Erling Smørgrav
e50fb9d500 Mark libpam as c99- and WARNS5-clean. 2003-05-01 14:55:06 +00:00
Dag-Erling Smørgrav
60a87a5fa2 Mark libfetch as c99-clean. Always build at WARNS level 2 rather than
juggling with levels 2 and 3, as this has lead to world breakage for
NOCRYPT users in the past.
2003-05-01 14:39:43 +00:00
Peter Wemm
8e80f8a438 AMD64 support (another IEEEFP platform) 2003-04-30 21:06:30 +00:00
Peter Wemm
a1de871d26 AMD64 support; repocopied from i386 2003-04-30 21:05:33 +00:00
Peter Wemm
2512cd4e8f Teach libdisk that AMD64 works just like i386 2003-04-30 21:03:16 +00:00
Peter Wemm
f7f1bb1485 Add __amd64__ to the list of things that use IEEEFP 2003-04-30 19:32:25 +00:00
Peter Wemm
5aed8cd5f6 Tell malloc.c that AMD64 uses the same pagesize as i386. 2003-04-30 19:30:34 +00:00
Peter Wemm
0f055c5bd8 Add __amd64__ to the list of things that use HIDENAME() to hide minbrk 2003-04-30 19:29:02 +00:00
Peter Wemm
1b376078fd Update for AMD64. repocopied from i386-elf/crt1.c. Deal with regparm
argument passing rather than stack based args.  The kernel passes the
base of the argument/env vector in %rdi (arg1).
2003-04-30 19:27:07 +00:00
Peter Wemm
d95bef1cef Turn off libstand for amd64 for the time being. It is built in i386
mode, and we do not need the complications for now.
2003-04-30 18:42:25 +00:00
Peter Wemm
adcebdf45d Delete i386_* syscall wrappers and manpages. Rename Ovfork.S to vfork.S. 2003-04-30 18:17:07 +00:00
Peter Wemm
0191e03a4e Update for AMD64 after repocopy from i386/sys/*. This means:
- strip out the nasty PIC_PROLOGUE/EPILOGUE stuff, since we dont have
to lose a register in PIC mode anymore (we use %rip-relative addressing).
- update for C register argument passing conventions.
- convert 32 bit to 64 bit register sizes etc.
2003-04-30 18:16:33 +00:00
Peter Wemm
0b8d851ef7 I have no idea why the reboot(2) syscall wrapper ends with iret, but
update it to be iretq for completeness.
2003-04-30 18:14:44 +00:00
Peter Wemm
0ffd54b17b Update for AMD64. Depend on %rdi (first syscall argument) being preserved
across a "syscall"-style syscall
2003-04-30 18:13:48 +00:00
Peter Wemm
173564016e Update for AMD64 (repocopied from i386/sys/Ovfork.S - why is it O?)
Depend on %rsi being preserved across the "syscall"-style syscall and strip
out the PIC stuff (this cpu has full PC-relative addressing, at last!)
2003-04-30 18:13:13 +00:00
Peter Wemm
1482008e2b Update for AMD64 contexts. Note that this still has some x87-style FPU
instructions here, these may need to be updated for SSE.
(Repocopied from i386/gen)
2003-04-30 18:09:33 +00:00
Peter Wemm
96f94e7d64 Reduce the SRCS to what compiles 2003-04-30 18:08:01 +00:00
Peter Wemm
8d8a622e6b Update for AMD64 (repocopied from i386/net). We can depend on having
the bswap instruction (yay!).  Update for register parameter passing
instead of i386 style stack based param passing.
2003-04-30 18:07:23 +00:00
Peter Wemm
4dbb9c65d7 Update for AMD64-style syscalls. Repocopied from i386/SYS.h.
Note that the syscall instruction clobbers %rcx, which is inconvenient
because it is the fourth syscall argument, so we use %r10 (another scratch
register) for the 4th syscall arg instead (I picked %r10 to be the same as
NetBSD).  int 0x80 is still possible though, and it uses %rcx as usual.
Note that the syscall style syscall does *NOT* preserve all the registers,
unlike int 0x80.  We do not preserve the scratch registers except for
%rdi and %rsi.  int 0x80 does preserve everything but the return values.
2003-04-30 18:06:14 +00:00
David E. O'Brien
9be6d929b1 Only define platform once -- in a C file. 2003-04-30 17:14:58 +00:00
David E. O'Brien
32fdc4235e Floating point libc functions traditionally written in ASM.
AMD64 does away with the x87 in 64-bit long mode, so we have to play the
SSE/SSE2 game now.

Obtained from:	NetBSD/x86-64
2003-04-30 16:21:03 +00:00
David E. O'Brien
bba777dd3b Symlink with -f. 2003-04-30 15:49:40 +00:00
David E. O'Brien
6b385310ff No libc_r for AMD64. 2003-04-30 15:33:50 +00:00
Daniel Eischen
d143dde438 Move the mailbox to the beginning of the thread and align the
thread so that the context (SSE FPU state) is also aligned.
2003-04-30 15:05:17 +00:00
Mike Makonnen
6c688436bb Backout my changes in rev. 1.32 and 1.33. There is some code that depends
on the previous behaviour. This also brings strptime(3) behaviour back in line
with the other BSDs.

Approved by:	markm (mentor)
2003-04-30 10:25:57 +00:00
Ruslan Ermilov
2550f696d6 Fixed alignment. 2003-04-30 07:13:50 +00:00
David Xu
d1021be03f Call kse_wakeup_mutli() after remove current thread from RUNQ to avoid
doing unnecessary idle kse wakeup.
2003-04-30 01:15:21 +00:00
David Xu
30a2952c90 Call kse_wakeup_multi() to wakeup idle KSEs when there are threads ready
to run.
2003-04-30 01:03:58 +00:00
Dag-Erling Smørgrav
8f3031025b Make sure rhostip is always initialized.
PR:		bin/51508
Submitted by:	Peter Grimshaw <peter@tesseract.demon.co.uk>
2003-04-30 00:49:42 +00:00
Dag-Erling Smørgrav
ccd703cfe4 Treat an empty PAM_RHOST the same as a NULL one.
PR:		bin/51508
2003-04-30 00:44:05 +00:00
Dag-Erling Smørgrav
3edc7b4e0b Set $HOME to the correct directory (within the chroot tree). 2003-04-30 00:40:24 +00:00
Jacques Vidrine
5723e501ab `Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's
version if the application defines them.

Inspired by:	qpopper's interfering and buggy version of strlcpy
2003-04-29 21:13:50 +00:00
Daniel Eischen
a8b5a9cd12 Jump to the correct label upon detecting an error. 2003-04-29 21:05:17 +00:00
Daniel Eischen
6cc13fa9ad Create the thread signal lock as a KSE lock (as opposed to
a thread lock).

Better protect access to thread state while searching for
threads to handle a signal.

Better protect access to process pending signals while processing
a thread in sigwait().

Submitted by:	davidxu
2003-04-29 21:03:33 +00:00
Matthew N. Dodd
4161ee3d26 Document VM86_INTCALL.
Submitted by:	 Bruce M Simpson
2003-04-29 08:35:28 +00:00
Daniel Eischen
55613576f5 o Don't add a scope system thread's KSE to the list of available
KSEs when it's thread exits; allow the GC handler to do that.

o Make spinlock/spinlock critical regions.

The following were submitted by davidxu

  o Alow thr_switch() to take a null mailbox argument.

  o Better protect cancellation checks.

  o Don't set KSE specific data when creating new KSEs; rely on the
    first upcall of the KSE to set it.

  o Add the ability to set the maximum concurrency level and do this
    automatically.  We should have a way to enable/disable this with
    some sort of tunable because some applications may not want this
    to be the default.

  o Hold the scheduling lock across thread switch calls.

  o If scheduling of a thread fails, make sure to remove it from the list
    of active threads.

  o Better protect accesses to a joining threads when the target thread is
    exited and detached.

  o Remove some macro definitions that are now provided by <sys/kse.h>.

  o Don't leave the library in threaded mode if creation of the initial
    KSE fails.

  o Wakeup idle KSEs when there are threads ready to run.

  o Maintain the number of threads active in the priority queue.
2003-04-28 23:56:12 +00:00
Daniel Eischen
76f344139c Use the correct link entry for walking the list of threads.
While I'm here, use the TAILQ_FOREACH macro instead of a more
manual method which was inherited from libc_r (so we could
remove elements from the list which isn't needed for libpthread).

Submitted by:	Kazuaki Oda <kaakun@highway.ne.jp>
2003-04-28 21:35:06 +00:00
Robert Drehmel
da0db726f7 Replace the return value of rfork_thread(3) in its manual page
function prototype with `pid_t' to match the declaration in
<unistd.h>.
2003-04-27 21:07:27 +00:00
Robert Drehmel
d1c2c89dd2 Correct the return value of vfork(2) and rfork(2) in their
manual page function prototypes.
2003-04-27 21:01:34 +00:00
Tom Rhodes
6c4e78ae1a Add vmemoryuse to the list.
PR:		50796
Submitted by:	Dmitry Sivachenko <mitya@cavia.pp.ru>
2003-04-26 15:15:05 +00:00
Tom Rhodes
225823c590 Add sys/user.h to the list of includes. Without it you lack a definition of
'struct kinfo_proc' for calls to kvm_getargv() and kvm_getenvv().

PR:	51322
2003-04-26 15:00:57 +00:00
Robert Watson
2715ba4892 Add some strategic whitespace. 2003-04-26 03:32:18 +00:00
Jacques Vidrine
c14d379de1 When using `compat' mode, be sure to re-dispatch setpwent, endpwent,
setgrent, and endgrent also.  (The previous NSS implementation used to
simply twiddle the internal data of the various modules directly.)

A symptom (group list set incorrectly in sshd) was
Reported by:	Glenn Johnson <gjohnson@srrc.ars.usda.gov>

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-25 18:25:19 +00:00
Ruslan Ermilov
a14744f268 Restore bzip2(1) support in loader(8) after Peter's renames of
malloc() to Malloc(), and free() to Free(), in zalloc_malloc.c.
2003-04-25 06:44:56 +00:00
Daniel Eischen
c20264770f Connect libpthread to the (i386) world. It is currently installed
as libkse and will once again be renamed libpthread after more
testing.

Approved by:	re
2003-04-25 01:34:43 +00:00
Daniel Eischen
fd47bf962d Remove the %gs restoring hack (already commented out).
Don't install man pages.

Temporarily (again) rename the library to libkse.  It will be put back
to libpthread after more wide-spread testing.
2003-04-25 01:31:56 +00:00
Jacques Vidrine
e2527daf1a In compat mode, we `redispatch' the lookup. It is probably a good
idea to re-initialize `struct passwd', because e.g. pw_class might
get set by one module, but not by another.  Add another call to the
internal pwd_init function to accomplish this.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 23:56:58 +00:00
Jacques Vidrine
0030cba4aa Catch up with nsdispatch.c: nsdispatch(3) is now `hidden' by
namespace.h.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 20:16:21 +00:00
Jacques Vidrine
43f9b2521d Don't complain about missing NSS methods when built statically. It is
annoying and not very useful.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 19:57:31 +00:00
Jacques Vidrine
c5774e2d30 Catch up with nsdispatch.c: nsdispatch(3) is now `hidden' by
namespace.h.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 18:05:48 +00:00
Jacques Vidrine
20e0e084e7 Catch up with nsdispatch.c: nsdispatch(3) is now `hidden' by
namespace.h.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-24 17:41:20 +00:00
Dag-Erling Smørgrav
be01d58da1 Remove a bogus null password check which assumed that a user with an empty
password must necessarily have an empty pwd->pw_passwd.  Also add a check
that prevents users from setting a blank password unless the nullok option
was specified.  Root is still allowed to give anyone a blank password.
2003-04-24 12:26:25 +00:00
Daniel Eischen
10629b6587 Add a macro to get the current thread mailbox pointer. 2003-04-23 21:49:34 +00:00
Daniel Eischen
c159269082 Remove the i386-specific hack (well, we only run on i386 anyways)
to always set %gs when resuming a thread.

Install this library as libpthread instead of libkse.
2003-04-23 21:48:29 +00:00
Daniel Eischen
f1c8192fd4 Protect thread errno from being changed while operating
on behalf of the KSE.

Add a kse_reinit function to reinitialize a reused KSE.

Submitted by:	davidxu
2003-04-23 21:46:50 +00:00
Poul-Henning Kamp
604c210c15 Fix a compiler warning.
Submitted by:	David Leimbach <leimy2k@mac.com>
2003-04-23 12:15:31 +00:00
Jacques Vidrine
5460b1abd2 ``Strong typing is a crutch for people with weak memories.''
Correct a bug that should have wreaked havoc everywhere, but for
some reason only bit unlucky people who use `-march' optimizations.
The compiler cannot assist one in distinguishing between the two
function calls below.

   int nsdispatch(void *, ...);
   void *discard;

   nsdispatch(&discard, ...);  /* correct .. no, really! */
   nsdispatch(discard, ...);   /* Boom                   */

Robin provided me with a debugging environment in which I could see
what was going on.

Badness when using CPUTYPE was
Reported by:	"Robin P. Blanchard" <Robin.Blanchard@gactr.uga.edu>
Reported by:	nork

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-22 22:19:05 +00:00
Daniel Eischen
29fde418c1 Set the quantum for scope system threads to 0 (no quantum). 2003-04-22 21:32:32 +00:00
Daniel Eischen
42a5f6248b Add a working pthread_[gs]etconcurrency. Initial null implementation
provided by Sergey A. Osokin <osa@freebsd.org.ru>.

In order to test this on a single CPU machine, you need to:

    sysctl kern.threads.debug=1
    sysctl kern.threads.virtual_cpu=2
2003-04-22 20:29:16 +00:00
Daniel Eischen
6dee371a55 Add a couple asserts to pthread_cond_foo to ensure the (low-level)
lock level is 0.  Thus far, the threads implementation doesn't use
mutexes or condition variables so the lock level should be 0.

Save the return value when trying to schedule a new thread and
use this to return an error from pthread_create().

Change the max sleep time for an idle KSE to 1 minute from 2 minutes.

Maintain a count of the number of KSEs within a KSEG.

With these changes scope system threads seem to work, but heavy
use of them crash the kernel (supposedly VM bugs).
2003-04-22 20:28:33 +00:00
Poul-Henning Kamp
64a5766ef7 Collapse the meta arguments into normal arguments, trying to distinguish
just makes our own life harder.
2003-04-22 19:31:00 +00:00
Poul-Henning Kamp
32c44cd7bb Fix compilation errors.
I wonder how I managed to cross-compile this yesterday.
2003-04-22 05:34:35 +00:00
Poul-Henning Kamp
9ad2132174 Update libdisk to use the explicing encoding function for sunlabel data
structures.
2003-04-21 20:36:44 +00:00
Jacques Vidrine
905ec0db3b Correct a bug that was somehow both obvious and hard-to-see. :-)
An incorrectly-sized allocation was being made due to an incorrect
argument to the `sizeof' operator.  Obvious, because it violated the
`foo = malloc(sizeof(*foo))' idiom.  Hard-to-see, because it was a
missing `*' (`*p' versus `**p').

Resulting failure was
Reported by:	ache

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-21 15:44:25 +00:00
Jacques Vidrine
d3fc864f93 Don't try to access the NIS `master' maps unless we have superuser
privileges.  To do so may cause the NIS server to log spurious and
annoying `access denied' messages.

Reported by:	Philip Paeps <philip@paeps.cx>
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-21 13:57:58 +00:00
Daniel Eischen
02245e6120 Add an i386-specifc hack to always set %gs. There still seems
to be instances where the kernel doesn't  properly save and/or
restore it.

Use noupcall and nocompleted flags in the KSE mailbox.  These
require kernel changes to work which will be committed sometime
later.  Things still work without the changes.

Remove the general kse entry function and use two different
functions -- one for scope system threads and one for scope
process threads.  The scope system function is not yet enabled
and we use the same function for all threads at the moment.

Keep a copy of the KSE stack for the case that a KSE runs
a scope system thread and uses the same stack as the thread
(no upcalls are generated, so a separate stack isn't needed).
This isn't enabled yet.

Use a separate field for the KSE waiting flag.  It isn't
correct to use the mailbox flags field.

The following fixes were provided by David Xu:

  o Initialize condition variable locks with thread versions
    of the low-level locking functions instead of the kse versions.

  o Enable threading before creating the first thread instead
    of after.

  o Don't enter critical regions when trying to malloc/free
    or call functions that malloc/free.

  o Take the scheduling lock when inheriting thread attributes.

  o Check the attribute's stack pointer instead of the
    attributes stack size for null when allocating a
    thread's stack.

  o Add a kseg reinit function so we don't have to destroy and
    then recreate the same lock.

  o Check the return value of kse_create() and return an
    appropriate error if it fails.

  o Don't forget to destroy a thread's locks when freeing it.

  o Examine the correct flags word for checking to see if
    a thread is in a synchronization queue.

Things should now work on an SMP kernel.
2003-04-21 04:02:56 +00:00
Daniel Eischen
6c2a22923c Use popfl to get the flags off the stack instead of popf.
Submitted by:	davidxu
2003-04-21 03:59:07 +00:00
David E. O'Brien
ce48b9e432 fix __FBSDID 2003-04-20 18:41:16 +00:00
David E. O'Brien
bfd738788b style.Makefile(5) 2003-04-20 18:38:59 +00:00
Robert Watson
8aa884cb01 Add FILES section to mac.3 and mac.conf.5. Properly Xref mac.conf.5
from mac.3; likewise, mac.conf.5 from mac_prepare.3.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-20 04:43:56 +00:00
Robert Watson
781a15a533 Add a man page for the mac.conf MAC library configuration file.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-20 03:18:44 +00:00
Marcel Moolenaar
1d3e7116dc Add support for ia64.
Note that the tp register (r13) is reserved as the TLS pointer in
the same way that that gp register (r1) is reserved as the global
pointer. This implementation uses the tp register to point to the
thread structure used by the threads implementation. This is not
in violation with the runtime specification provided the TLS is
a fixed distance from the thread structure. This is only an issue
when code used the __thread keyword to create TLS. This is not
supported at the moment.
2003-04-20 03:06:42 +00:00
Marcel Moolenaar
09dd61fd99 Use STDERR_FILENO as the file descriptor passed to _thread_printf()
instead of 0 (ie stdin). Writing to stdin may not be possible.
2003-04-20 02:58:30 +00:00
Robert Watson
23408b001b Add the mac_prepare{,_*}() functions to the high-level function list
in the mac.3 library man page.  They were already cross-referenced
at the end of the man page, just not explicitly listed here.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-20 02:56:16 +00:00
Marcel Moolenaar
e7c9b7517b Fix build breakage (on ia64) caused by a missing file descriptor to
_thread_printf(). Use STDERR_FILENO as the file descriptor.
2003-04-20 02:56:12 +00:00
John Polstra
8c0d4b5f92 Add stub implementations of pthread_[gs]etconcurrency to libc_r and
libthr.  No changes were made to libpthread by request of deischen,
who will soon commit a real implementation for that library.

PR:		standards/50848
Submitted by:	Sergey A. Osokin <osa@freebsd.org.ru>
MFC after:	1 week
2003-04-20 01:53:13 +00:00
Jacques Vidrine
43652a6ba6 Repair a bug in which a faulty group entry (one with only 2 colons)
would result in an incorrectly terminated grouplist.

login(1) crashes
Reported by:	Morten Rodal <morten@rodal.no>,
		Matthias Schuendehuette <msch@snafu.de>
2003-04-20 01:12:00 +00:00
David Schultz
1f2a0cdf58 %E-like %g and %G conversions should remove trailing zeroes unless
the # flag is present.  Implement this behavior and add a comment
describing it.

Noticed by:	Enache Adrian <enache@rdslink.ro>
Pointy hat to:	das
2003-04-19 23:53:19 +00:00
Poul-Henning Kamp
0b1b370c47 Add prototype for compute_stats() so that libdevstat is WARNS=4 clean.
Spotted by:	kris
2003-04-19 07:42:13 +00:00
Jacques Vidrine
171614bfd6 Follow-up to revision 1.74: Using the result buffer to store our empty
string was an incredibly dumb idea (of course it will be changed by an
NSS module on success!).  Use a static empty string instead.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-18 22:07:30 +00:00
Jacques Vidrine
a9ceaa9dc8 Follow-up to revision 1.73: set _PWF_FILES when `compat' source is used
but user is found in local file.

Reported by:	Shizuka Kudo <shizukakudo_99@yahoo.com>
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-18 21:13:35 +00:00
Jacques Vidrine
4c3c0fecae Don't use `memset' to initialize a struct passwd. A module
may not fill in all fields, and in the case of string fields, this could
cause trouble for applications.  (The only likely example is `pw_class',
because this field is not used by all modules in all cases.)

Move initialization of struct passwd from module-specific code to the
dispatch code.

The problem of a NULL pw_class was
Noticed by:	Philip Paeps <philip@paeps.cx>
                    and the c^Htrusty ssh(1) command.
Déjà vu by:	getpwent.c revision 1.56

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-18 17:27:05 +00:00
Jacques Vidrine
71cc8f0764 Correctly set _PWF_FILES in pw_fields when appropriate.
(_PWF_NIS and _PWF_HESIOD were already being set.)

Reported by:	Shizuka Kudo <shizukakudo_99@yahoo.com>
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-18 16:24:25 +00:00
Jacques Vidrine
b4603f3dd4 Revert the definitions of _PW_KEY* to their previous values. There is
at least one consumer outside of libc and pwd_mkdb.
Adjust the versioning in libc and pwd_mkdb accordingly.

named was the application affected, and that fact was first
Reported by:	Zherdev Anatoly <tolyar@mx.ru>

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-18 14:11:17 +00:00
Ruslan Ermilov
27220696ca Make this compile under cs_CZ.ISO8859-2 locale.
Reported by:	Pav Lucistnik <pav@oook.cz>

We hit this problem earlier, in PR misc/45460.
2003-04-18 13:01:07 +00:00
Daniel Eischen
078d4c1b8b Remove duplicate $FreeBSD$ id. 2003-04-18 07:45:03 +00:00
Daniel Eischen
e4c2ac1637 Sorry folks; I accidentally committed a patch from what I was working
on a couple of days ago.  This should be the most recent changes.

Noticed by:	davidxu
2003-04-18 07:09:43 +00:00
Daniel Eischen
0174b69f92 Comment out the addition of -g to CFLAGS. This snuck in from
my local version.
2003-04-18 05:06:56 +00:00
Daniel Eischen
a0240e2cb0 Revamp libpthread so that it has a chance of working in an SMP
environment.  This includes support for multiple KSEs and KSEGs.

The ability to create more than 1 KSE via pthread_setconcurrency()
is in the works as well as support for PTHREAD_SCOPE_SYSTEM threads.
Those should come shortly.

There are still some known issues which davidxu and I are working
on, but it'll make it easier for us by committing what we have.

This library now passes all of the ACE tests that libc_r passes
with the exception of one.  It also seems to work OK with KDE
including konqueror, kwrite, etc.  I haven't been able to get
mozilla to run due to lack of java plugin, so I'd be interested
to see how it works with that.

Reviewed by:	davidxu
2003-04-18 05:04:16 +00:00
Daniel Eischen
b025fc9a31 Add FIFO queueing locking operations based on atomic swap.
Modify thread errno for the new libpthread changes.

Reviewed by:	davidxu
2003-04-18 05:02:39 +00:00
Daniel Eischen
27f625a036 Add architecture dependent atomic ops (atomic_swap only), KSE specific
data, and userland versions of [gs]etcontext().

Modify the UTS entry and exit functions to account of FPU validity
and format.
2003-04-18 05:00:52 +00:00
Jacques Vidrine
1b467db206 The default if nsswitch.conf(5) is not present is supposed to be the
hated `compat' source, not `files'.

Reported by:	Philip Paeps <philip@paeps.cx>
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-18 01:00:37 +00:00
Tom Rhodes
59ac15c152 Add a manual page for the ntp_gettime syscall.
Reviewed by:	ru, phk (older version).
2003-04-17 18:39:30 +00:00
Jacques Vidrine
05f98035ee = Implement thread-safe versions of the getpwent(3) and getgrent(3)
family of functions using the new nsdispatch(3) core.  Remove
  arbitrary size limits when using the thread-safe versions.

= Re-implement the traditional getpwent(3)/getgrent(3) functions on
  top of the thread-safe versions.

= Update the on-disk format of the hashed version of the passwd(5)
  databases to allow for versioned entries.  The legacy version is
  `3'.  (Don't ask.)

= Add support for version `4' entries in the passwd(5) database.
  Entries in this format are identical to version 3 entries except
  that all integers are stored as 32-bit integers in network byte
  order (big endian).

= pwd_mkdb is updated to generate both version 3 and version 4
  entries.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-17 14:15:26 +00:00
Jacques Vidrine
46d9306383 = Implement name service switch modules (NSS modules). NSS modules
may be built into libc (`static NSS modules') or dynamically loaded
  via dlopen (`dynamic NSS modules').  Modules are loaded/initialized
  at configuration time (i.e.  when nsdispatch is called and nsswitch.conf
  is read or re-read).

= Make the nsdispatch(3) core thread-safe.

= New status code for nsdispatch(3) `NS_RETURN', currently used to
  signal ERANGE-type issues.

= syslog(3) problems, don't warn/err/abort.

= Try harder to avoid namespace pollution.

= Implement some shims to assist in porting NSS modules written for
  the GNU C Library nsswitch interface.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-17 14:14:22 +00:00
Munechika SUMIKAWA
296e054f23 Buffer size is not enough in the previous commit. Use 128.
Pointed out by:	nectar
MFC after:	1 week
2003-04-17 07:20:00 +00:00
Robert Watson
ecf889825d Clarify the relationship between the MAC library APIs and POSIX.1e:
they resemble one another, but POSIX.1e interfaces were not sufficiently
expressive to do what we needed.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-16 20:40:34 +00:00
Munechika SUMIKAWA
6089e562ff Make character buffer more bigger.
Obtained from:	KAME
MFC after:	1 week
2003-04-16 11:21:12 +00:00
Tom Rhodes
7456d3c673 Add a manual page for the ntp_adjtime syscall.
PR:		32674
Reviewed by:	phk, ru
2003-04-15 15:42:10 +00:00
Tim J. Robbins
d73c448b1c Merge in vfprintf.c rev. 1.58. 2003-04-14 12:15:59 +00:00
David Schultz
81ae2e9a4d Fix a bug where printf was erroneously printing a decimal point for
%f and sufficiently short %g specifiers where the precision was
explicitly zero, no '#' flag was specified, and the floating point
argument was > 0 and <= 0.5.  While at it, add some comments to better
explain the relevant bits of code.

Noticed by:	Christoph Kukulies <kuku@physik.rwth-aachen.de>
2003-04-14 11:24:53 +00:00
Robert Drehmel
5a1c2d4f62 Trust the code more than the comment(s) and correct some false
statements about pointer data type sizes, which spread probably
by copy-and-paste.
2003-04-12 07:36:44 +00:00
Tim J. Robbins
a40248455d Return "/boot/kernel/kernel" instead of "/kernel" if the sysctl() call
fails. The documentation was incorrectly updated in getbootfile.3 rev. 1.10.
2003-04-11 13:54:28 +00:00
Julian Elischer
a0ddbf497b Catch up with the kernel. Move the current cpu indicator to the thread. 2003-04-10 17:41:40 +00:00
Dag-Erling Smørgrav
b7d6bb0833 Brucify. 2003-04-10 10:26:18 +00:00
Tim J. Robbins
e3e8878435 When called with s == NULL, behave as if wc == L'\0' as required by the
standard.
2003-04-10 09:20:38 +00:00
Dag-Erling Smørgrav
e7d9d9217c Correctly detect the case where a password entry was changed while we were
preparing to edit it.

PR:		bin/50563
2003-04-09 18:20:51 +00:00
Dag-Erling Smørgrav
e947f78c16 Apply the correct fix for bin/50679: don't mess around with process groups
or the tty, just block selected signals in the parent like system(3) does.
Many thanks to bde for his assistance in finding the correct solution.

PR:		bin/50679
2003-04-09 16:39:47 +00:00
Poul-Henning Kamp
1455c4e2ec If rounding results in -epsilon device busy %, set it to zero. 2003-04-09 07:49:15 +00:00
David Schultz
fad677445e /strtopx/ s/result/&result/
This is the version I *meant* to commit last week.
2003-04-09 05:58:43 +00:00
Mike Barcroft
fd7a8150fb o In struct prison, add an allprison linked list of prisons (protected
by allprison_mtx), a unique prison/jail identifier field, two path
  fields (pr_path for reporting and pr_root vnode instance) to store
  the chroot() point of each jail.
o Add jail_attach(2) to allow a process to bind to an existing jail.
o Add change_root() to perform the chroot operation on a specified
  vnode.
o Generalize change_dir() to accept a vnode, and move namei() calls
  to callers of change_dir().
o Add a new sysctl (security.jail.list) which is a group of
  struct xprison instances that represent a snapshot of active jails.

Reviewed by:	rwatson, tjr
2003-04-09 02:55:18 +00:00
Matthew N. Dodd
cf0e07e504 Sync with NetBSD.
- Bump shared library version on libusbhid.
- Retire libusbhid.h; it is called usbhid.h now.
- hid_start_parse() takes a third argument.
- hid_locate() takes a fifth argument.
- hid_report_size() order of arguments changes.
- Other changes, including formatting and whitespace.

Bump __FreeBSD_version.

This change will break all third party applications that rely on previous
FreeBSD specific behavior.
2003-04-09 01:52:49 +00:00
Dag-Erling Smørgrav
c794881f8c Band-aid for the "^C kills the editor" problem. I haven't yet found the
proper way to fix this.  The way this works is to prepend "exec " to
the editor command to eliminate the "shell in the middle" which prevents
us from properly reawakening the editor after a SIGTSTP.

PR:		bin/50679
2003-04-08 18:04:30 +00:00
Dag-Erling Smørgrav
a8643c9882 Connect the pam_chroot(8) module to the build. 2003-04-08 16:52:34 +00:00
Dag-Erling Smørgrav
d4e15f10b1 Add a cwd option which specifies where to chdir(2) after the chroot(2).
When using the /home/./foo scheme, this defaults to the rhs (/foo);
otherwise it defaults to /.
2003-04-08 16:52:18 +00:00
Matthew N. Dodd
196f440aa2 Bump the date. 2003-04-07 22:59:12 +00:00
Matthew N. Dodd
564b641ef9 Clarify the behavior of PATH_FSTAB with regard to 'tainted' execution.
Requested by:	 ru
2003-04-07 14:21:14 +00:00
Matthew N. Dodd
134dbc4c32 - Add setfstab() and getfstab().
- Use the environment variable 'PATH_FSTAB' if set rather than the
  hardcoded '/etc/fstab' (fstab.h:_PATH_FSTAB)
2003-04-07 12:55:00 +00:00
Tim J. Robbins
adfd6b312d Catch up with recent vfprintf.c changes. 2003-04-07 06:36:49 +00:00
Andrey A. Chernov
6f098a4811 __wcsconv(): free(convbuf) before returning NULL 2003-04-07 03:17:39 +00:00
David Schultz
d890afb84d Today just isn't my day. Remove some old commented out code that snuck
into the last commit.

Noticed by:	mike
2003-04-07 01:07:48 +00:00
Matthew N. Dodd
234e6b87fa MF NetBSD:
- Reduce diffs with NetBSD.
  - Formatting and explicit values for enum declaration.
  - Order of prototypes.
  - zero report_size in hid_clear_local()
  - errx() needs no newline
  - Don't initialie variable in declaration in hid_parse_usage_in_page().
- Use fmtcheck() in hid_usage_in_page().
2003-04-07 00:49:53 +00:00
David Schultz
3b204b7d09 - %e conversions with precision 0 should not cause a decimal point to
be printed.
- Fix %f conversions where the number of significant digits is < expt.
  This would be a one-line change were it not for thousands separators.
  Noticed by tjr.
- Remove some unnecessary code in the parsing of precision specifiers.
2003-04-07 00:42:19 +00:00
Peter Wemm
77ac203091 Sync up with kern/subr_prf.c. This adds %ll, %j, %q, %z, etc. 2003-04-06 05:25:48 +00:00
David Schultz
ebbad5ec5c Rework the floating point code in printf(). Significant changes:
- We used to round long double arguments to double.  Now we print
  them properly.

- Bugs involving '%F', corner cases of '#' and 'g' format
  specifiers, and the '.*' precision specifier have been
  fixed.

- Added support for the "'" specifier to print thousands' grouping
  characters in a locale-dependent manner.

- Implement the __vfprintf() side of hexadecimal floating point
  support.  All that is still needed is a routine to convert the
  mantissa to hex digits one nibble at a time in the style of ultoa().

Reviewed by:	silence on standards@
2003-04-05 22:11:42 +00:00
David Schultz
92b93b37c0 Add __ldtoa(), a wrapper around gdtoa() to make it look like dtoa().
In support of this, add some MD macros to assist in converting long
doubles to the format expected by gdtoa().

Reviewed by:	silence on standards@
2003-04-05 22:10:13 +00:00
David Schultz
b936664e72 Add missing #include to unbreak previous commit. 2003-04-05 22:08:53 +00:00
David Schultz
38cac8f88b Correct some buffer sizes.
- __vfprintf()'s 'buf' has never been used for floating point, so
  don't define it in terms of (incorrect) constants describing
  floating point numbers.  The actual size needed depends on
  sizeof(uintmax_t) and locale details, so I slightly overestimated.

- We don't need a 308-character buffer to store the string "308".
  With long doubles and %a we need more than three characters, though.
2003-04-05 22:03:43 +00:00
Warner Losh
30aaff1192 Migrate to a new way of dealing with building from old revisions of
FreeBSD.  This method attempts to centralize all the necessary hacks
or work arounds in one of two places in the tree (src/Makefile.inc1
and src/tools/build).  We build a small compatibility library
(libbuild.a) as well as selectively installing necessary include
files.  We then include this directory when building host binaries.

This removes all the past release compatibilty hacks from various
places in the tree.  We still build on tip of stable and current.  I
will work with those that want to support more, although I anticipate
it will just work.

Many thanks to ru@, obrien@ and jhb@ for providing valuable input at
various stage of implementation, as well as for working together to
positively effect a change for the better.
2003-04-05 20:30:30 +00:00
Tim J. Robbins
63e6ca586e MFp4: Link strtof.3 and strtold.3 to strtod.3. 2003-04-05 07:33:46 +00:00
Mike Makonnen
f23f149866 Zero out the struct tm supplied by the caller. Otherwise,
strange things might happen when garbage values in the struct
get passed in to localtime_r() and family.

Noticed by:	marcus
Approved by:	markm (mentor)(implicit)
2003-04-05 05:46:43 +00:00
Tim J. Robbins
799d93559b MFp4: Pentium/Athlon-optimised implementation of wcschr(). 2003-04-05 04:17:05 +00:00
Poul-Henning Kamp
a12b1b124a Use sized cast matching the sized pointer. 2003-04-04 16:59:39 +00:00
Poul-Henning Kamp
197e5e73ef Libdisk does not need to include <sys/diskslice.h> any more.
Move the remaining bits of <sys/diskslice.h> to <i386/include/bootinfo.h>

Move i386/pc98 specific bits from <sys/reboot.h> to
<i386/include/bootinfo.h> as well.

Adjust includes in sys/boot accordingly.
2003-04-04 16:35:16 +00:00
David Schultz
6d3bd9530d Fix braino in definition of isfinite().
Noticed by:	marcus
Pointy hat to:	das
2003-04-04 13:27:47 +00:00
Warner Losh
33c2c9a3fa No need to have ifdef < FreeBSD 4.0-current in here. Remove it to
avoid false positive while searching for __FreeBSD_version abuse.
2003-04-04 04:16:06 +00:00
Jake Burkholder
55ad402a8f - Pass a ucontext_t to _set_curthread. If non-NULL the new thread is set
as curthread in the new context, so that it will be set automatically when
  the thread is switched to.  This fixes a race where we'd run for a little
  while with curthread unset in _thread_start.

Reviewed by:	jeff
2003-04-03 03:34:50 +00:00
Jeff Roberson
996a395d37 - Don't overrun the ldt buffer.
Submitted by:	gordan@freebsd.org
2003-04-02 22:53:52 +00:00
Jake Burkholder
68c724b96f Implement _get_curthread and _set_curthread. This is especially easy. 2003-04-02 08:15:07 +00:00
Jeff Roberson
26f52e2f8b - Define curthread as _get_curthread() and remove all direct calls to
_get_curthread().  This is similar to the kernel's curthread.  Doing
   this saves stack overhead and is more convenient to the programmer.
 - Pass the pointer to the newly created thread to _thread_init().
 - Remove _get_curthread_slow().
2003-04-02 03:05:39 +00:00
Jake Burkholder
dd3dd8724d Add MD makefile. 2003-04-01 23:52:24 +00:00
Jake Burkholder
9f5a511863 Implement makecontext. 2003-04-01 23:28:50 +00:00
Jeff Roberson
00c301540e - Don't drop and reacquire giant in thread_suspend(). Change callers to do
this manually.  This will facilitate the unrolling of giant.
 - Don't allow giant to recurse anymore.  This should never happen.
2003-04-01 22:41:41 +00:00
Jeff Roberson
901d86ae8a - Reenable setschedparam and the prioceiling code now that the mutex code
has been restored.
2003-04-01 22:40:29 +00:00
Jeff Roberson
360a519459 - Restore old mutex code from libc_r. It is more standards compliant.
This was changed because originally we were blocking on the umtx and
   allowing the kernel to do the queueing.  It was decided that the
   lib should queue and start the threads in the order it decides and the
   umtx code would just be used like spinlocks.
2003-04-01 22:39:31 +00:00
Ceri Davies
d5882f3f58 [1] - Document EHOSTUNREACH as a possible error
[2]	- Remove a contraction

PR:		docs/50401
Submitted by:	[1] Slaven Rezic <slaven@rezic.de>
MFC after:	1 week
2003-04-01 20:25:46 +00:00
Jeff Roberson
7a57e9abdd - Adjust the makefiles so we have a per architecture makefile. 2003-04-01 07:07:38 +00:00
Jeff Roberson
42d3ad7144 - Spell SIGSETOR correctly. 2003-04-01 04:49:12 +00:00
Jeff Roberson
70d5093a8b - Commit the forgotten libthr/sys bits. 2003-04-01 03:51:08 +00:00
Jeff Roberson
bb535300dd - Add libthr but don't hook it up to the regular build yet. This is an
adaptation of libc_r for the thr system call interface.  This is beta
   quality code.
2003-04-01 03:46:29 +00:00
Jeff Roberson
31a9779e5d - Catch up with kernel signal changes. 2003-03-31 22:57:55 +00:00
Wes Peters
f4cf2141f6 Add a facility allowing processes to inform the VM subsystem they are
critical and should not be killed when pageout is looking for more
memory pages in all the wrong places.

Reviewed by:	arch@
Sponsored by:	St. Bernard Software
2003-03-31 21:09:57 +00:00
Dag-Erling Smørgrav
eac956b2d1 Experimental pam_chroot module (not connected to the build) 2003-03-30 22:58:23 +00:00
Juli Mallett
5b3a32e4a8 MFp4: Fix copy&paste English error. 2003-03-30 18:00:24 +00:00
Max Khon
839e119ec8 BDE'ify 2003-03-29 21:56:59 +00:00
Max Khon
057e4034dd fix truncation check and buffer overflow check 2003-03-29 21:34:13 +00:00
Daniel Eischen
67aba1c6a4 Align signal frame placed on stack to 16 bytes so that SSE FPU register
restores can work.  Also correct allocation for signal frame size.

Reviewed by:	mini
2003-03-29 16:38:15 +00:00
Dag-Erling Smørgrav
762892c047 Don't dereference flags if NULL (see http.c rev 1.87) 2003-03-29 15:15:38 +00:00
Mike Makonnen
764628c056 Fill in the rest of the fields in the resulting struct tm
from strptime(3). Previously, they would get filled only
for the %s specifier and as a side effect of using the
the %Z specifier with a GMT time zone.

PR:		misc/48993
Approved by:	markm (mentor)
Silence on:	-standards
2003-03-29 11:55:37 +00:00
Max Khon
be6a158e0f - MAXPATHLEN -> PATH_MAX (pass correct buffer size to readlink as well)
Requested by:		bde
2003-03-28 12:05:45 +00:00
Juli Mallett
7a51271b68 Close the disk file descriptor that is RO before trying to open the
new one, and do not fall back to the RO fd.  There was a bug here
in that the RO fd was never closed, if the RDRW open succeeded, but
this code is bogus anyway, and it breaks newfs of floppies, at least
for me, due to "Device busy."  Anything that wants to fall back is
doing something significantly odd that it should have some more complex
code on its end.
2003-03-28 01:50:11 +00:00
Max Khon
226a0f0f8b Make realpath() thread-safe. New implementation does not use chdir(2) at all.
Submitted by:	Constantin S. Svintsoff <kostik (at) iclub.nsu.ru>
2003-03-27 20:48:53 +00:00
Poul-Henning Kamp
63728c47e8 Run a revision on the OAM api.
Use prefix gctl_ systematically.
Add flag with access perms for each argument.
Add ro/rw versions of argument building functions.
General cleanup.
2003-03-27 14:35:00 +00:00
Jeff Roberson
cc3521d660 - Define a _spinunlock() function so that threading implementations may do
more complicated things than just setting the lock to 0.
 - Implement stubs for this function in libc and the two threading libraries
   that are currently in the tree.
2003-03-26 04:02:24 +00:00
Matthew N. Dodd
7db77bf0c1 Back off WARNS until I've had a chance to deal with the problems on
sparc64/alpha.
2003-03-25 17:40:00 +00:00
Matthew N. Dodd
619531d847 Fix warnings. 2003-03-25 04:29:26 +00:00
Philippe Charnier
b43dc21149 The .Fn function
The ... 2 system call
2003-03-24 16:07:19 +00:00
Philippe Charnier
9d09157a0f The .Fn function. Use .Xr where appropriate. 2003-03-24 16:05:24 +00:00
Philippe Charnier
0552350ecc The .Fn function 2003-03-24 16:02:05 +00:00
Philippe Charnier
592bb5e477 The .Nm library 2003-03-24 16:01:01 +00:00
Philippe Charnier
4cacb61823 The .Fn function
The .Fa argument
2003-03-24 15:58:53 +00:00
Philippe Charnier
0dc90c7a0d The .Fn function
The .Nm library
2003-03-24 15:56:36 +00:00
Poul-Henning Kamp
4b8938c1d5 Add marshalling functions for OAM api. 2003-03-23 10:15:02 +00:00
Andrey A. Chernov
85bebbc156 According to C99 decimal_point can't be empty 2003-03-20 08:18:55 +00:00
Andrey A. Chernov
cfcd9a45b5 According to C99 decimal_point can't be the empty string, mention it. 2003-03-20 08:13:34 +00:00
Andrey A. Chernov
befb332a6b decimal_point can't be "" according to C99, so set it to standard "."
in that case.
2003-03-20 08:05:20 +00:00
Mike Makonnen
4418f9df30 The flags passed in to _ftp_get_proxy may be null
Approved by:	des, markm (mentor)(implicit)
2003-03-19 21:39:00 +00:00
Robert Drehmel
0d74f328ae - Revamp the function _nis_initshells() to make getusershell() backed
by NIS work, like nsswitch.conf(5) promises to be able to.
   (These modifications will be fed back to NetBSD, of course)
 - In endusershell(), do not set `sl' to NULL if we know it already has
   that value.
2003-03-19 14:17:24 +00:00
Poul-Henning Kamp
ec0fa09c8c typo 2003-03-19 14:15:32 +00:00
Poul-Henning Kamp
773865de4e Further unbreak devstat: sort the index array in correct order too. 2003-03-19 14:11:14 +00:00
Robert Drehmel
916560b152 If realloc(3) fails in copyline(), do not make matters worse by
leaving without deallocating `data' thereby creating a memory leak.
2003-03-19 14:01:35 +00:00
Poul-Henning Kamp
cb3733b78d ARGH!
Pointy hat to:	phk
2003-03-18 17:05:27 +00:00
Poul-Henning Kamp
0d2fdd7850 Commit ken@' changes to this file: Bump version and append new entries
to stay backwards compatible.
2003-03-18 16:44:10 +00:00
Poul-Henning Kamp
b193011a02 Update to match reality closer. 2003-03-18 13:45:08 +00:00
Poul-Henning Kamp
36eab1f55a Add more devstat calculations, mostly filling in holes, but also adding
a couple of reqests:  DSM_BUSY_PCT and DSM_QUEUE_LENGTH.

I have no further plans for mutilating this API at this point in
time, and will update the man-page to reflect current reality as
the next thing.

Reviewed by:    ken
2003-03-18 09:57:54 +00:00
Poul-Henning Kamp
2892a228ad Use devstat instead of GEOM private statistics structure. 2003-03-18 09:53:46 +00:00
Poul-Henning Kamp
2ad2651a98 Constify arg to geom_lookupid().
Improve a diagnostic printf.
2003-03-17 08:22:48 +00:00
Poul-Henning Kamp
2082addf66 Ignore GBDE devices.
Spotted by:	Lucky Green <shamrock@cypherpunks.to>
2003-03-17 07:25:50 +00:00
David Schultz
5d907c3dd2 Make pw_edit() use /bin/sh to interpret the EDITOR environment
variable.

PR:		48748
Reviewed by:	mike (mentor)
2003-03-17 02:12:55 +00:00
Poul-Henning Kamp
16830b0cc2 And I managed to make a regression here too.
I have too many source trees :-(
2003-03-15 22:22:11 +00:00
Poul-Henning Kamp
7194d335cf Run a revision of the devstat interface:
Kernel:

Change statistics to use the *uptime() timescale (ie: relative to
boottime) rather than the UTC aligned timescale.  This makes the
device statistics code oblivious to clock steps.

Change timestamps to bintime format, they are cheaper.

Remove the "busy_count", and replace it with two counter fields:
"start_count" and "end_count", which are updated in the down and
up paths respectively.  This removes the locking constraint on
devstat.

Add a timestamp argument to devstat_start_transaction(), this will
normally be a timestamp set by the *_bio() function in bp->bio_t0.
Use this field to calculate duration of I/O operations.

Add two timestamp arguments to devstat_end_transaction(), one is
the current time, a NULL pointer means "take timestamp yourself",
the other is the timestamp of when this transaction started (see
above).

Change calculation of busy_time to operate on "the salami principle":
Only when we are idle, which we can determine by the start+end
counts being identical, do we update the "busy_from" field in the
down path.  In the up path we accumulate the timeslice in busy_time
and update busy_from.

Change the byte_* and num_* fields into two arrays: bytes[] and
operations[].

Userland:

Change the misleading "busy_time" name to be called "snap_time" and
make the time long double since that is what most users need anyway,
fill it using clock_gettime(CLOCK_MONOTONIC) to put it on the same
timescale as the kernel fields.

Change devstat_compute_etime() to operate on struct bintime.

Remove the version 2 legacy interface: the change to bintime makes
compatibility far too expensive.

Fix a bug in systat's "vm" page where boot relative busy times would
be bogus.

Bump __FreeBSD_version to 500107

Review & Collaboration by:	ken
2003-03-15 21:59:06 +00:00
David Schultz
e31c9eb10b The gdtoa import apparently hasn't caused anything or anyone to
explode, so nix the old strtod() / dtoa().  This change is part
of the gdtoa patches reviewed on standards@.
2003-03-15 09:47:05 +00:00
David Xu
5b54b0891a Backout last commit.
Requested by: jhb
2003-03-15 04:45:42 +00:00
Tim J. Robbins
564529ff1a MFp4: Pentium/Athlon-optimised implementation of wcslen(). 2003-03-14 11:01:12 +00:00
Tim J. Robbins
ce7be15190 Merge vfprintf.c revision 1.52. 2003-03-14 08:50:43 +00:00
David Schultz
3ba6b6dd9d Kludge around a bug that results from printf() assuming that
dtoa() is buggy.  The bug would cause incorrect output to be
generated when format strings such as '%5.0f' were used with
nonzero numbers whose magnitude is less than 1.

Reported by:	df(1) by way of periodic(8)
Reviewed by:	mike
2003-03-14 04:48:09 +00:00
Tim J. Robbins
15a66d2798 Unexpand RCS tag. 2003-03-14 04:46:02 +00:00
Jean-Marc Zucconi
c6aa003c0d In src/lib/libz/gzio.c the function gzprintf does not check if the
amount of bytes (supposed to be) written by vsnprintf exceeds the
size of the buffer.

PR:		bin/48844
Submitted by:	Peter A Jonsson <pj@ludd.luth.se>
Obtained from:	OpenBSD
MFC after:	1 month
2003-03-14 01:47:01 +00:00
David Xu
047a20e644 Fix a bug in rwlock. When a rwlock was locked by reader threads, a
writter thread can block reader threads to get read lock.
2003-03-14 01:02:47 +00:00
John Baldwin
8b7a975ed4 Catch up to p_tracep -> p_tracevp rename to unbreak world.
Pointy hat to:	jhb
2003-03-13 21:40:54 +00:00
David E. O'Brien
120a95cb50 Clean up the way gdtoa sources are found.
OK'ed by:	das
2003-03-13 18:55:14 +00:00