Commit Graph

2364 Commits

Author SHA1 Message Date
Doug Rabson 566643e39e Move the declaration of the interrupt type from the driver structure
to the BUS_SETUP_INTR call.
1999-05-08 21:59:43 +00:00
Peter Wemm 73d35bdd96 Change resource_set_*() to be more useful. BTW; resource_find() is a
bit odd, it looks like the wildcard stuff isn't right.
1999-05-08 18:08:59 +00:00
Peter Wemm 9c06a38614 Make sure the mem_range_AP_init() prototype is seen where it's needed, and
#ifdef SMP around it for fun.
1999-05-08 17:48:22 +00:00
Peter Wemm 4173e42044 Use KERNBASE for the load address of the kernel rather than magic constants
as it seems to work..  (at least on i386/elf).
1999-05-08 13:03:49 +00:00
Peter Wemm b5b15c3ff0 First stages of a module dependency cleanup. This part fixes a
particularly annoying hack, namely having the linker bash the moduledata
to set the container pointer, preventing it being const.  In the process,
a stack of warnings were fixed and will probably allow a revisit of the
const C_SYSINIT() changes.  This explicitly registers modules in files or
preload areas with the module system first, and let them initialize via
SYSINIT/DECLARE_MODULE later in their SI_ORDER_xxx order.  The kludge of
finding the containing file is no longer needed since the registration
of modules onto the modules list is done in the context of initializing
the linker file.
1999-05-08 13:01:59 +00:00
Poul-Henning Kamp 1637aa4b1c Fix some of the places where too much inside knowledge about major/minor
layout and dev_t structure is being (ab)used.
1999-05-08 07:02:41 +00:00
Poul-Henning Kamp 4be2eb8c49 I got tired of seeing all the cdevsw[major(foo)] all over the place.
Made a new (inline) function devsw(dev_t dev) and substituted it.

Changed to the BDEV variant to this format as well: bdevsw(dev_t dev)

DEVFS will eventually benefit from this change too.
1999-05-08 06:40:31 +00:00
Dag-Erling Smørgrav b83308b00b Nit fix. 1999-05-07 17:37:08 +00:00
Poul-Henning Kamp 46eede0058 Continue where Julian left off in July 1998:
Virtualize bdevsw[] from cdevsw.  bdevsw() is now an (inline)
        function.

        Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention
        to the order of the cmaj/bmaj arguments!)

        Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE
        (ditto!)

(Next step will be to convert all bdev dev_t's to cdev dev_t's
before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
1999-05-07 10:11:40 +00:00
Poul-Henning Kamp e994c55884 Fix a goof in the #ifdef DEVFS case which was found by inspection,
it may have made things very difficult for people if they tried to
used DEVFS.
1999-05-07 09:10:10 +00:00
Poul-Henning Kamp c48d17750f Introduce two functions: physread() and physwrite() and use these directly
in *devsw[] rather than the 46 local copies of the same functions.

(grog will do the same for vinum when he has time)
1999-05-07 07:03:47 +00:00
Poul-Henning Kamp b0eeea2042 remove b_proc from struct buf, it's (now) unused.
Reviewed by:	dillon, bde
1999-05-06 20:00:34 +00:00
Peter Wemm d5558c001a Fix up a few easy 'assignment used as truth value' and 'suggest parens
around && within ||' type warnings.  I'm pretty sure I have not masked
any problems here, I've committed real problem fixes seperately.
1999-05-06 18:44:42 +00:00
Peter Wemm dfd5dee1b0 Add sufficient braces to keep egcs happy about potentially ambiguous
if/else nesting.
1999-05-06 18:13:11 +00:00
Poul-Henning Kamp 84c55b38e4 Remove unused fields from struct buf:
b_savekva
	b_validoff
	b_validend

Reviewed by:	dillon, bde
1999-05-06 17:06:41 +00:00
Bruce Evans ea2b3e3d1b Fixed profiling of elf kernels. Made high resolution profiling compile
for elf kernels (it is broken for all kernels due to lack of egcs support).

Renaming of many assembler labels is avoided by declaring by declaring
the labels that need to be visible to gprof as having type "function"
and depending on the elf version of gprof being zealous about discarding
the others.  A few type declarations are still missing, mainly for SMP.

PR:		9413
Submitted by:	Assar Westerlund <assar@sics.se> (initial parts)
1999-05-06 09:44:57 +00:00
John Birrell 67481196cc Allow the init_path to be customised in an embedded system using the
INIT_PATH config option.

Also fix two bugs which caused an infinite loop in none of the programs
in the init_path were found. That code was obviously not tested!
1999-05-05 12:20:23 +00:00
Bill Fumerola 3d177f465a Add sysctl descriptions to many SYSCTL_XXXs
PR:		kern/11197
Submitted by:	Adrian Chadd <adrian@FreeBSD.org>
Reviewed by:	billf(spelling/style/minor nits)
Looked at by:	bde(style)
1999-05-03 23:57:32 +00:00
Alan Cox 4221e284a3 The VFS/BIO subsystem contained a number of hacks in order to optimize
piecemeal, middle-of-file writes for NFS.  These hacks have caused no
end of trouble, especially when combined with mmap().  I've removed
them.  Instead, NFS will issue a read-before-write to fully
instantiate the struct buf containing the write.  NFS does, however,
optimize piecemeal appends to files.  For most common file operations,
you will not notice the difference.  The sole remaining fragment in
the VFS/BIO system is b_dirtyoff/end, which NFS uses to avoid cache
coherency issues with read-merge-write style operations.  NFS also
optimizes the write-covers-entire-buffer case by avoiding the
read-before-write.  There is quite a bit of room for further
optimization in these areas.

The VM system marks pages fully-valid (AKA vm_page_t->valid =
VM_PAGE_BITS_ALL) in several places, most noteably in vm_fault.  This
is not correct operation.  The vm_pager_get_pages() code is now
responsible for marking VM pages all-valid.  A number of VM helper
routines have been added to aid in zeroing-out the invalid portions of
a VM page prior to the page being marked all-valid.  This operation is
necessary to properly support mmap().  The zeroing occurs most often
when dealing with file-EOF situations.  Several bugs have been fixed
in the NFS subsystem, including bits handling file and directory EOF
situations and buf->b_flags consistancy issues relating to clearing
B_ERROR & B_INVAL, and handling B_DONE.

getblk() and allocbuf() have been rewritten.  B_CACHE operation is now
formally defined in comments and more straightforward in
implementation.  B_CACHE for VMIO buffers is based on the validity of
the backing store.  B_CACHE for non-VMIO buffers is based simply on
whether the buffer is B_INVAL or not (B_CACHE set if B_INVAL clear,
and vise-versa).  biodone() is now responsible for setting B_CACHE
when a successful read completes.  B_CACHE is also set when a bdwrite()
is initiated and when a bwrite() is initiated.  VFS VOP_BWRITE
routines (there are only two - nfs_bwrite() and bwrite()) are now
expected to set B_CACHE.  This means that bowrite() and bawrite() also
set B_CACHE indirectly.

There are a number of places in the code which were previously using
buf->b_bufsize (which is DEV_BSIZE aligned) when they should have
been using buf->b_bcount.  These have been fixed.  getblk() now clears
B_DONE on return because the rest of the system is so bad about
dealing with B_DONE.

Major fixes to NFS/TCP have been made.  A server-side bug could cause
requests to be lost by the server due to nfs_realign() overwriting
other rpc's in the same TCP mbuf chain.  The server's kernel must be
recompiled to get the benefit of the fixes.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
1999-05-02 23:57:16 +00:00
Mark Murray a8af2bd86b This routine was "use"ing File::Basename. This commit removes that
"use" and replaces it with equivalent inline code. The reason is that
Perl has some very nasty circular dependancies, and I am trying to
get the System Perl upgraded by one maintenance level.

The basic rule, until I can find a way to solve this, is that
the build tools MAY NOT use any library code; it must all be inline.
1999-05-02 08:55:27 +00:00
Mike Smith 4a034f21cd Add a hook that can be called to initialise a slave processor's memory
range attributes after they have been extracted from the master.

Hook up the i686 MP code to do this for each AP.

Be more careful about printing the default memory type for the i686.

Suggestions from: luoqi
1999-04-30 22:09:45 +00:00
Poul-Henning Kamp 07901f227b Add beer-ware license and $Id$
Noticed by:	dillon
1999-04-30 06:51:51 +00:00
Poul-Henning Kamp 430210c00b Make BOOTP to work again.
Submitted by:	dillon
Reviewed by:	phk
1999-04-30 06:30:15 +00:00
Dmitrij Tejblum 188554bba1 Set curproc at the end of proc0_init().
This patch also moves the bogus comment (the comment is still not quite
right) and (as a side effect) removes some verbose initialisations (we
depend on static initialisation to 0 for almost everything in proc0).

The alpha kernels are bootable again. The change  won't affect i386's
until machdep.c is changed.

Submitted by:	bde
1999-04-29 22:51:59 +00:00
Alan Cox 0043b4376a Address a performance problem in getnewbuf:
In heavy-writing situations, QUEUE_LRU can contain a large number
	of DELWRI buffers at its head.  These buffers must be moved
	to the tail if they cannot be written async in order to reduce
	the scanning time required to skip past these buffers in later
	getnewbuf() calls.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
1999-04-29 18:15:25 +00:00
Poul-Henning Kamp 75c1354190 This Implements the mumbled about "Jail" feature.
This is a seriously beefed up chroot kind of thing.  The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.

For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact:  "real virtual servers".

Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.

Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.

It generally does what one would expect, but setting up a jail
still takes a little knowledge.

A few notes:

   I have no scripts for setting up a jail, don't ask me for them.

   The IP number should be an alias on one of the interfaces.

   mount a /proc in each jail, it will make ps more useable.

   /proc/<pid>/status tells the hostname of the prison for
   jailed processes.

   Quotas are only sensible if you have a mountpoint per prison.

   There are no privisions for stopping resource-hogging.

   Some "#ifdef INET" and similar may be missing (send patches!)

If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!

Tools, comments, patches & documentation most welcome.

Have fun...

Sponsored by:   http://www.rndassociates.com/
Run for almost a year by:       http://www.servetheweb.com/
1999-04-28 11:38:52 +00:00
Poul-Henning Kamp 02daf150a4 Add the jail system call. 1999-04-28 11:28:49 +00:00
Dmitrij Tejblum 604359cf9b s/static foo_devsw_installed = 0;/static int foo_devsw_installed;/.
(Edited automatically)
1999-04-28 10:54:24 +00:00
Luoqi Chen 5206bca10a Enable vmspace sharing on SMP. Major changes are,
- %fs register is added to trapframe and saved/restored upon kernel entry/exit.
- Per-cpu pages are no longer mapped at the same virtual address.
- Each cpu now has a separate gdt selector table. A new segment selector
  is added to point to per-cpu pages, per-cpu global variables are now
  accessed through this new selector (%fs). The selectors in gdt table are
  rearranged for cache line optimization.
- fask_vfork is now on as default for both UP and SMP.
- Some aio code cleanup.

Reviewed by:	Alan Cox	<alc@cs.rice.edu>
		John Dyson	<dyson@iquest.net>
		Julian Elischer	<julian@whistel.com>
		Bruce Evans	<bde@zeta.org.au>
		David Greenman	<dg@root.com>
1999-04-28 01:04:33 +00:00
Poul-Henning Kamp 1c308b817a Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
Poul-Henning Kamp f711d546d2 Suser() simplification:
1:
  s/suser/suser_xxx/

2:
  Add new function: suser(struct proc *), prototyped in <sys/proc.h>.

3:
  s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/

The remaining suser_xxx() calls will be scrutinized and dealt with
later.

There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.

More changes to the suser() API will come along with the "jail" code.
1999-04-27 11:18:52 +00:00
Peter Wemm b6ad3506f3 Register the local (unix domain) sockets ourselves. 1999-04-26 08:56:53 +00:00
Peter Wemm 5b23857d22 Redo domain registration to use SYSINITS rather than linker sets.
Get rid of the spl wrapper kludge, it doesn't seem to be needed between
init calls since all that's running is the domain/protocol timers and they
are safe since domain list modifications are splnet() protected (which
blocks the timers)
1999-04-26 08:56:09 +00:00
Peter Wemm fc51d58e62 Fix a very long standing bug in run_interrupt_driven_config_hooks(). It
was fetching the next pointer from memory that could have been free()'d.
1999-04-25 22:13:34 +00:00
Poul-Henning Kamp 0bb2226a4d Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify the
timecounter as well

Asked for by:	bde, jhay
1999-04-25 09:00:00 +00:00
Dmitrij Tejblum ba41a07d04 Fixed printf format errors on alpha. 1999-04-24 18:50:48 +00:00
Andrey A. Chernov 02a3d5261d Lite2 bugfixes merge:
so_linger is in seconds, not in 1/HZ
range checking in SO_*TIMEO was wrong

PR: 11252
1999-04-24 18:22:34 +00:00
Poul-Henning Kamp 22f054e258 Fix a braino in the v_id wraparound code. Give more (current) details
in comment.

PR:		11307
Spotted by:	Ville-Pertti Keinonen <will@iki.fi>
1999-04-24 17:58:14 +00:00
Dmitrij Tejblum 0dd9741eb4 Use pointer arithmetic to do pointer arithmetic. 1999-04-24 11:25:01 +00:00
SADA Kenji 565592bd9c The function msgrcv() could copy larger data than it should do
under some circumstances.
PR:		kern/10765
Submitted by:	Yasuhito FUTATSUKI <futatuki@fureai.or.jp>
1999-04-21 13:30:01 +00:00
Peter Wemm 54a8c69347 Stage 1 of a cleanup of the i386 interrupt registration mechanism.
Interrupts under the new scheme are managed by the i386 nexus with the
awareness of the resource manager.  There is further room for optimizing
the interfaces still.  All the users of register_intr()/intr_create()
should be gone, with the exception of pcic and i386/isa/clock.c.
1999-04-21 07:26:30 +00:00
Alan Cox f78fd73fa6 Address several problems in vn_read and vn_write:
1. Make read-ahead work for pread and aio_read.

2. Fix one place where a comparison of uio_offset with -1
   wasn't updated to use FOF_OFFSET.

3. Honor O_APPEND in the FOF_OFFSET case.

In addition, use the variable name "ioflag" in both vn_read and
vn_write to avoid possible confusion between the variable "flag"
and the parameter "flags".

Submitted by:	Bruce Evans <bde@zeta.org.au> and me
1999-04-21 05:56:45 +00:00
Dag-Erling Smørgrav 5f967b24fc Make the location of init(8) tunable at boot time. 1999-04-20 21:15:13 +00:00
Peter Wemm 4d823d728f GC some stray debugging printf()s... 1999-04-19 19:39:08 +00:00
Peter Wemm d95939af7a Zap LKM option and support. Farewell old friend. 1999-04-19 14:19:52 +00:00
Peter Wemm db42d90829 unifdef -DVM_STACK - it's been on for a while for x86 and was checked
and appeared to be working for the Alpha some time ago.
1999-04-19 14:14:14 +00:00
Peter Wemm 2072df97aa GC some unused code. 1999-04-17 09:12:35 +00:00
Peter Wemm e91896117b Well folks, this is it - The second stage of the removal for build support
for LKM's..
1999-04-17 08:36:07 +00:00
Peter Wemm 6182fdbda8 Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition.  eisa, isapnp and pccard* are
not yet using the new resource manager.  Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
 ATA driver to the Alpha.  Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by:	core
1999-04-16 21:22:55 +00:00
Dmitrij Tejblum 35871a15c5 getnewbuf(): check return value from tsleep(). Interruptible NFS may pass
PCATCH to slpflag.
1999-04-14 18:51:52 +00:00
Tor Egge 87c737bc83 Backout early start of APs since it caused some machines to hang. 1999-04-13 03:24:47 +00:00
Eivind Eklund e9e9477aac More consistent with surrounding style. (Hey - it looked great in the
diff...)

Prodded by:	bde
1999-04-12 14:34:52 +00:00
Dag-Erling Smørgrav eca2ddda6f Typo in comment. 1999-04-12 10:07:15 +00:00
Eivind Eklund 2a96b3faf9 Staticize. 1999-04-11 02:27:06 +00:00
Eivind Eklund 632a035f84 Staticize. 1999-04-11 02:17:47 +00:00
Tor Egge 44c57e7121 Add prototype for wait_ap(). 1999-04-11 00:43:43 +00:00
Tor Egge 90c26b0d2d Let BSP wait until all APs are initialized. 1999-04-10 22:58:29 +00:00
Dag-Erling Smørgrav 5a00f36414 Allow setting MAXFILES in the kernel config. 1999-04-09 16:28:11 +00:00
Nick Sayer c0bd94a75d More secure clock management. Allow positive steps only once per second
for as much as one second, but no more. Allows a miscreant to
double-time march the clock, but no worse.

XXX Unlike putting negative deltas in a while(1), performing small
positive steps inside of a while(1) will return EPERM for the
unpermitted ones. Repeated negative deltas are clamped without
error (but the kernel does log a notice).
1999-04-07 19:48:09 +00:00
Matt Jacob 3f92429a24 Fix last delta so file would compile again- I think I got it
right. Add a clarifying (to me at least) comment. Some formatting
fixes.
1999-04-07 17:32:21 +00:00
Peter Wemm bfda1e3ff7 Disable the mtrr copy calls, it doesn't work with the i686_mem.c stuff.
This should make it compile/link again.
1999-04-07 17:08:40 +00:00
Nick Sayer fcae3aa61f If securelevel>1, allow the clock to be adjusted negatively only up to
1 second prior to the highest the clock has run so far. This allows
time adjusters like xntpd to do their work, but the worst a miscreant
can do is "freeze" the clock, not go back in time.

We still need to decide on an algorithm to clamp positive adjustments.
As it stands, it is possible to achieve arbitrary negative adjustments
by "wrapping" time around.

PR:		10361
1999-04-07 16:36:56 +00:00
Alan Cox b2e2337ba1 Fix a performance problem with the new getnewbuf() code: in an outofspace
condition ( bufspace > hibufspace ), an inappropriate scan of the empty
queue was performed looking for buffer space to free up.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
1999-04-07 02:41:54 +00:00
Peter Wemm 57dc594832 Use the reference counted PHOLD()/PRELE() rather than P_PHYSIO. 1999-04-06 03:04:47 +00:00
Peter Wemm af8ad83e5c Use the reference-counted PHOLD()/PRELE() rather than P_NOSWAP. 1999-04-06 03:03:34 +00:00
Peter Wemm 88b4f4ee55 LK_RETRY is a vn_lock() flag, not one for lockmgr(). 1999-04-06 03:02:11 +00:00
Julian Elischer 8d17e69460 Catch a case spotted by Tor where files mmapped could leave garbage in the
unallocated parts of the last page when the file ended on a frag
but not a page boundary.
Delimitted by tags PRE_MATT_MMAP_EOF and POST_MATT_MMAP_EOF,
in files alpha/alpha/pmap.c i386/i386/pmap.c nfs/nfs_bio.c vm/pmap.h
    vm/vm_page.c vm/vm_page.h vm/vnode_pager.c miscfs/specfs/spec_vnops.c
    ufs/ufs/ufs_readwrite.c kern/vfs_bio.c

Submitted by: Matt Dillon <dillon@freebsd.org>
Reviewed by: Alan Cox <alc@freebsd.org>
1999-04-05 19:38:30 +00:00
Dmitrij Tejblum 5cc4ab5323 Regenerate (padding for pread and pwrite). 1999-04-04 21:43:36 +00:00
Dmitrij Tejblum 8fe387ab84 Add standard padding argument to pread and pwrite syscall. That should make them
NetBSD compatible.

Add parameter to fo_read and fo_write. (The only flag FOF_OFFSET mean that
the offset is set in the struct uio).

Factor out some common code from read/pread/write/pwrite syscalls.
1999-04-04 21:41:28 +00:00
Poul-Henning Kamp a508801763 Fix a division which I had made a multiplication.
Fix return value from ntp_adjtime().

Submitted by:	jhay
1999-04-04 19:56:04 +00:00
Poul-Henning Kamp 34cffbe3f6 Dang, lost some LL's there. 1999-04-04 10:53:59 +00:00
Poul-Henning Kamp f425c1f631 Update to latest version from Dave Mills. Mostly textual. 1999-04-04 10:28:42 +00:00
John Polstra 4fe88fe637 Restore support for executing BSD/OS binaries on the i386 by passing
the address of the ps_strings structure to the process via %ebx.
For other kinds of binaries, %ebx is still zeroed as before.

Submitted by:	Thomas Stephens <tas@stephens.org>
Reviewed by:	jdp
1999-04-03 22:20:03 +00:00
Poul-Henning Kamp c4a6db710a Don't open window for race condition.
Detected by:	Reg Clemens <reg@dwf.com>
1999-04-02 13:57:21 +00:00
Poul-Henning Kamp 6a5d592ae8 Purging lint from the Bruce filter. 1999-03-30 09:00:45 +00:00
Doug Rabson 6350e58a8a Add some useful functions to the device framework:
* bus_setup_intr() as a wrapper for BUS_SETUP_INTR
* bus_teardown_intr() as a wrapper for BUS_TEARDOWN_INTR
* device_get_nameunit() which returns e.g. "foo0" for name "foo" and unit 0.
* device_set_desc_copy() malloc a copy of the description string.
* device_quiet(), device_is_quiet(), device_verbose() suppress probe message.

Add one method to the BUS interface, BUS_CHILD_DETACHED() which is called
after the child has been detached to allow the bus to clean up any memory
which it allocated on behalf of the child.

I also fixed a bug which corrupted the list of drivers in a devclass if
a driver was added to more than one devclass.
1999-03-29 08:54:20 +00:00
Doug Rabson ecc6e7d5ef Fix a bug which prevented more than two clients from sharing a resource. 1999-03-29 08:30:17 +00:00
Doug Rabson 67e7cb89d9 Call ptrace_u_check with the right size. 1999-03-29 08:29:22 +00:00
Nick Hibma 2bee57be2f Fixed line counting error. 1999-03-27 22:41:40 +00:00
Alan Cox 4160ccd978 Added pread and pwrite. These functions are defined by the X/Open
Threads Extension.  (Note: We use the same syscall numbers as NetBSD.)

Submitted by:	John Plevyak <jplevyak@inktomi.com>
1999-03-27 21:16:58 +00:00
Eivind Eklund 361d0ec590 Remove incorrect lock specs for vop_whiteout (introduced by Lite/2).
The lock specs are for vnodes only.

Add (hopefully correct) lock specs for vop_strategy, vop_getpages and
vop_putpages.
1999-03-27 03:08:07 +00:00
Alan Cox cde9bc877b Changed vn_read/write such that fp->f_offset isn't touched
if uio->uio_offset != -1.  This fixes a problem with aio_read/write
and permits a straightforward implementation of pread/pwrite.

PR:		kern/8669
Submitted by:	John Plevyak <jplevyak@inktomi.com>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
1999-03-26 20:25:21 +00:00
Doug Rabson 6ca34d85be Call the module's unload handler before removing the device from the
cdevsw list.  This allows a handler to veto the load without losing its
place in the list.

PR:	kern/10653
1999-03-23 21:11:47 +00:00
Poul-Henning Kamp cc7532aaf0 Add a sysctl variable which can help stop chroot(2) escapes.
kern.chroot_allow_open_directories = 0
	chroot(2) fails if there are open directories.

kern.chroot_allow_open_directories = 1 (default)
	chroot(2) fails if there are open directories and the process
	is subject of a previous chroot(2).

kern.chroot_allow_open_directories = anything else
	filedescriptors are not checked.  (old behaviour).

I'm very interested in reports about software which breaks when
running with the default setting.
1999-03-23 14:26:40 +00:00
Poul-Henning Kamp 7f4173cc09 Fix some nasty hangs if garbage were passed.
Noticed by:	Emmanuel DELOGET <pixel@DotCom.FR>
Remembered by:	msmith
1999-03-23 14:23:15 +00:00
Poul-Henning Kamp 3a25914cfd Make the same size rounding error both ways. 1999-03-22 14:01:58 +00:00
Bruce Evans 96ebc5810b Fixed a serious bug in rev.1.202. getnewbuf() sometimes didn't
initialise bp->b_data.  This tended to cause panics for file
systems whose block size is smaller than one page.
1999-03-19 10:17:44 +00:00
Poul-Henning Kamp 884ab557d9 Don't run FLL fodder through the median-filter.
Reduce max integration time to 128sec and use 50% exponential decay rather
than 256sec/25%.
1999-03-16 08:39:37 +00:00
Poul-Henning Kamp fafbe352c0 Allow !suser() R/O access to ntp_adjtime()
Noticed by: Reg Clemens <reg@dwf.com>
1999-03-15 08:35:40 +00:00
Julian Elischer 50d3b68c81 fix breakage for alphas.
Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>
1999-03-15 05:11:27 +00:00
Bruce Evans 6fc8f347cb Enforce monotonicity of apparent process user, system and interrupt times.
PR:		975, 10402
1999-03-13 19:46:13 +00:00
Poul-Henning Kamp 30f27235cb Fix an old cut&paste bogon.
Noticed by: bde
1999-03-12 21:58:54 +00:00
Poul-Henning Kamp 37d39f0a50 Remove duplicate include.
Noticed by: bde
1999-03-12 11:09:50 +00:00
Julian Elischer beef8a367c This solves a deadlock that can occur when read()ing into a file-mmap()
space. When doing this, it is possible to for another process to attempt
to get an exclusive lock on the vnode and deadlock the mmap/read
combination when the uiomove() call tries to obtain a second
shared lock on the vnode. There is still a potential deadlock
situation with write()/mmap().
Submitted by: Matt Dillon <dillon@freebsd.org>
Reviewed by: Luoqi Chen <luoqi@freebsd.org>
Delimmitted by tag PRE_MATT_MMAP_LOCK and POST_MATT_MMAP_LOCK
in kern/kern_lock.c kern/kern_subr.c
1999-03-12 03:09:29 +00:00
Julian Elischer 4ef2094e45 Reviewed by: Many at differnt times in differnt parts,
including alan, john, me, luoqi, and kirk
Submitted by:	Matt Dillon <dillon@frebsd.org>

This change implements a relatively sophisticated fix to getnewbuf().
There were two problems with getnewbuf(). First, the writerecursion
can lead to a system stack overflow when you have NFS and/or VN
devices in the system. Second, the free/dirty buffer accounting was
completely broken. Not only did the nfs routines blow it trying to
manually account for the buffer state, but the accounting that was
done did not work well with the purpose of their existance: figuring
out when getnewbuf() needs to sleep.

The meat of the change is to kern/vfs_bio.c. The remaining diffs are
all minor except for NFS, which includes both the fixes for bp
interaction AND fixes for a 'biodone(): buffer already done' lockup.
Sys/buf.h also contains a chaining structure which is not used by
this patchset but is used by other patches that are coming soon.
This patch deliniated by tags PRE_MAT_GETBUF and POST_MAT_GETBUF.
(sorry for the missing T matt)
1999-03-12 02:24:58 +00:00
Bruce Evans 56ce1a8dc4 Fixed runtime accounting. The time since the previous context switch
was discarded on every call to calcru().  Hacking on the `switchtime'
global for a related fix in rev.1.38 of kern_resource.c was too fragile
and broke when p_switchtime went away.

PR:		10402
1999-03-11 21:53:12 +00:00
Poul-Henning Kamp 32c203577a Make even more of the PPSAPI implementations generic.
FLL support in hardpps()

Various magic shuffles and improved comments

Style fixes from Bruce.
1999-03-11 15:09:51 +00:00
Alan Cox 0a91231d3b For clarity, use the "map" variable introduced by the last commit
throughout exec_aout_imgact.
1999-03-10 07:07:42 +00:00
Poul-Henning Kamp a2210fe12b Make TIMER_FREQ a normal, undocumented option. Raise confusion to
a higher level with example in LINT.

Clarify comment about PPS_SYNC.  Ignore for now that it doesn't
work in FLL mode, it will in a few days.
1999-03-09 20:20:09 +00:00
Poul-Henning Kamp c68996e271 Integrate the new "nanokernel" PLL from Dave Mills.
This code is backwards compatible with the older "microkernel" PLL, but
allows ntpd v4 to use nanosecond resolution.  Many other improvements.

PPS_SYNC and hardpps() are NOT supported yet.
1999-03-08 12:36:14 +00:00