Commit Graph

2872 Commits

Author SHA1 Message Date
Bruce Evans
b473d62c73 Fixed a memory leak for slices with an (unsupported) bad sector table.
Broken in: rev.1.80.
2000-01-28 11:51:08 +00:00
Bruce Evans
7b17f8ffbd Don't permit generation of non-physical disk addresses.
subr_diskmbr.c:
Don't "helpfully" enlarge our idea of the disk size to cover all the
primary slices.  Instead, truncate or discard slices that don't seem
to be on the disk.  The enlargement was a hack for disks that don't
report their size (e.g., MFM disks).  It is just wrong in general.

wd.c:
In CHS mode, limit the disk size so that cylinder numbers >= 65536
cannot occur.  This normally only affects disks larger than 33.8GB.
CHS mode accesses to addresses above the limit are now properly broken
(an error is returned instead of garbage for reads and disk corruption
for writes).

PR:		15611
Reviewed by:	readers of freebsd-bugs did not respond to a request
            	for review
2000-01-28 10:22:07 +00:00
David Greenman
27b8623f21 Fixed sign and overflow bugs that caused the allocation size of the kernel
malloc region (kmem_map) to be wrong and semi-random on systems with more
than 1GB of RAM. This is not a complete fix, but is sufficient for
machines with 4GB or less of memory. A complete fix will require some
changes to the getenv stuff so that 64bit values can be passed around.

NOT FIXED: machines with more than 4GB of RAM (e.g. some large Alphas)
since we're still using ints to hold some of the values.

Reviewed by:	bde
2000-01-28 04:04:58 +00:00
Archie Cobbs
d6113ed044 When an attempt to install a line discipline fails, check for
known KLD's that might support it, and load the KLD if found.
Currently the list includes SLIPDISC, PPPDISC, and NETGRAPHDISC.
2000-01-28 02:22:22 +00:00
Bruce Evans
6bfb820292 Quick fix for stack overflow when there are more than about 25 slices.
Using recursion to traverse the recursive data structure for extended
partitions was never good, but when slice support was implemented in
1995, the recursion worked for the default maximum number of slices
(32), and standard fdisk utilities didn't support creating more than
the default number.  Even then, corrupt extended partitions could
cause endless recursion, because we attempt to check all slices, even
ones which we don't turn into devices.

The recursion has succumbed to creeping features.  The stack requirements
for each level had grown to 204 bytes on i386's.  Most of the growth was
caused by adding a 64-byte copy of the DOSpartition table to each frame.
The kernel stack size has shrunk to about 5K on i386's.  Most of the
shrinkage was caused by the growth of `struct sigacts' by 2388 bytes
to support 128 signals.

Linux fdisk (a 1997 version at least) can now create 60 slices (4 standard
ones, 56 for logical drives within extended partitions, and it seems to
be leaving room to map the 4 BSD partitions on my test drive), and Linux
(2.2.29 and 2.3.35 at least) now reports all these slices at boot time.

The fix limits the recursion to 16 levels (4 + 16 slices) and recovers
32 bytes per level caused by gcc pessimizing for space.  Switching to
a static buffer doesn't cause any problems due to recursion, since the
buffer is not passed down.  Using a static buffer is wrong in general
because it requires the giant lock to protect it.  However, this problem
is small compared with using a static buffer for dsname().  We sometimes
neglect to copy the result of dsname() before sleeping.

Also fixed slice names when we find more than MAX_SLICES (32) slices.
The number of the last slice found was not passed passed recursively.
The limit on the recursion now prevents finding more than 32 slices
with a standard extended partition data structure anyway.
2000-01-27 05:11:29 +00:00
Kirk McKusick
7881bb5d5f Add soft updates to the set of things being tagged. Syntax cleanup. 2000-01-27 01:22:06 +00:00
Bruce Evans
2f40e526a5 Improved English in the messages printed by diskerr().
Fixed some formatting bugs.
2000-01-26 10:28:23 +00:00
Bruce Evans
f4675a30ed Don't follow null pointers if we somehow have a null devswitch entry
despite having a non-null cn_tab entry.  This case now works the same
as if there is no physical console, except i/o at the kernel printf
level may still work.  This frees drivers of physical console drivers
from the responsibility of attaching the device no matter what.
2000-01-25 09:20:08 +00:00
Bruce Evans
dd7f8ecff6 Fixed some style bugs (mainly ones associated with the bogus name
condev_t for a non-typedef).
2000-01-24 11:48:11 +00:00
Boris Popov
8dc74b6288 Backout previous commit. It was a mistake. 2000-01-23 15:47:46 +00:00
Boris Popov
9e991dfa2f Replace non obvious number with SPECNAMELEN constant.
Reviewed by:	phk
2000-01-23 14:58:53 +00:00
Poul-Henning Kamp
7fd299cb92 Add a couple of strategic sysctls for monitoring.
In the rather obscure case of hardpps(), use a type-II PLL if the external
signal is phase locked, but a FLL if it isn't.
2000-01-23 14:52:37 +00:00
Warner Losh
27e2c03a27 Fix the style bugs in the style bugs fix. The style bug fix made the
new function inconsistant with the rest of this file.  The spelling
and grammer fixes were good and remain.
2000-01-21 06:57:52 +00:00
Brian Feldman
bd9079fa6c Fix style bugs in the last commit. 2000-01-21 02:52:54 +00:00
Warner Losh
7001be49f8 bdeize last commit:
o Remove opt_dontuse.h and ifdef PROCFS

Subitted by: bde, peter
2000-01-20 17:03:53 +00:00
Jason Evans
b7592c7bea Back out the previous spl change, since it opens a race window.
Reviewed by:	alfred, dillon, peter
2000-01-20 08:15:13 +00:00
Warner Losh
5e2664428c When we are execing a setugid program, and we have a procfs filesystem
file open in one of the special file descriptors (0, 1, or 2), close
it before completing the exec.

Submitted by: nergal@idea.avet.com.pl
Constructive comments: deraadt@openbsd.org, sef, peter, jkh
2000-01-20 07:12:52 +00:00
Jason Evans
60ffb01993 Don't tsleep() while at splbio().
Correctly return EINPROGRESS from aio_error() even when an aio request
is still in the socket queue.

Submitted by:	Adrian Chadd <adrian@bofh.co.uk>
2000-01-20 01:59:58 +00:00
Robert Watson
8f0738756c Fix bde'isms in acl/extattr syscall interface, renaming syscalls to
prettier (?) names, adding some const's around here, et al.

Reviewed by:	bde
2000-01-19 06:07:34 +00:00
Robert Watson
9b0be035b8 Fix bde'isms in acl/extattr syscall interface, renaming syscalls to
prettier (?) names, adding some const's around here, et al.

Commit 2 out of 3.

Reviewed by:	bde
2000-01-19 06:02:31 +00:00
Robert Watson
5134b3e92a Fix bde'isms in acl/extattr syscall interface, renaming syscalls to
prettier (?) names, adding some const's around here, et al.

Commit 1 out of 3.

Reviewed by:	bde
2000-01-19 06:01:07 +00:00
Kirk McKusick
71c87cfd7e Need to reset the buffer pointer to avoid reconsidering the same buffer
again (without this the rollback analysis was being lost). Should reduce
the write count for most workloads.

Submitted by:	Craig A Soules <soules+@andrew.cmu.edu>
2000-01-18 02:13:26 +00:00
Brian Feldman
f582ac0630 Fix vn_isdisk() usage to make AIO work on non-disk-files again, rather
than just return ENOTBLK.

PR:	16163
Submitted by:	Adrian Chadd <adrian@FreeBSD.org>
2000-01-17 21:18:39 +00:00
Peter Wemm
8ccd633455 Implement setres[ug]id() and getres[ug]id(). This has been sitting in
my tree for ages (~2 years) waiting for an excuse to commit it.  Now Linux
has implemented it and it seems that Staroffice (when using the
linux_base6.1 port's libc) calls this in the linux emulator and dies in
setup.  The Linux emulator can call these now.
2000-01-16 16:34:26 +00:00
Poul-Henning Kamp
2a277567e2 Cleanup some more remaining bdev fluff. 2000-01-16 09:25:34 +00:00
Jason Evans
bfbbc4aa44 Add aio_waitcomplete(). Make aio work correctly for socket descriptors.
Make gratuitous style(9) fixes (me, not the submitter) to make the aio
code more readable.

PR:		kern/12053
Submitted by:	Chris Sedore <cmsedore@maxwell.syr.edu>
2000-01-14 02:53:29 +00:00
Matthew N. Dodd
de9cfdd736 Allow SMP systems with an MCA bus to work properly.
Reviewed by:	peter
2000-01-13 09:09:02 +00:00
Luoqi Chen
49503b44fd Seconds to ticks conversion was done at the wrong place. 2000-01-12 17:26:42 +00:00
Kazutaka YOKOTA
35e61cbd71 Add a new mechanism, cndbctl(), to tell the console driver that
ddb is entered.  Don't refer to `in_Debugger' to see if we
are in the debugger.  (The variable used to be static in Debugger()
and wasn't updated if ddb is entered via traps and panic anyway.)

- Don't refer to `in_Debugger'.
- Add `db_active' to i386/i386/db_interface.d (as in
  alpha/alpha/db_interface.c).
- Remove cnpollc() stub from ddb/db_input.c.
- Add the dbctl function to syscons, pcvt, and sio. (The function for
  pcvt and sio is noop at the moment.)

Jointly developed by: bde and me

(The final version was tweaked by me and not reviewed by bde.  Thus,
if there is any error in this commit, that is entirely of mine, not
his.)

Some changes were obtained from: NetBSD
2000-01-11 14:54:01 +00:00
Poul-Henning Kamp
d685023e68 Also handle zero return from dscheck().
PR:		15956
2000-01-10 12:21:39 +00:00
Poul-Henning Kamp
ba4ad1fcea Give vn_isdisk() a second argument where it can return a suitable errno.
Suggested by:	bde
2000-01-10 12:04:27 +00:00
Warner Losh
310086415a Panic if proc0 hasn't been created and we try to call kthread_create.
This prevents a more mysterious crash later.

XXX The long term solution is defer creation of these things until
XXX proc0 lives
2000-01-10 08:00:58 +00:00
Sean Eric Fagan
893618352c Handle the case where we truss an SUGID program -- in particular, we need
to wake up any processes waiting via PIOCWAIT on process exit, and truss
needs to be more aware that a process may actually disappear while it's
waiting.

Reviewed by:	Paul Saab <ps@yahoo-inc.com>
2000-01-10 04:09:05 +00:00
Kirk McKusick
cf60e8e4bf Several performance improvements for soft updates have been added:
1) Fastpath deletions. When a file is being deleted, check to see if it
   was so recently created that its inode has not yet been written to
   disk. If so, the delete can proceed to immediately free the inode.
2) Background writes: No file or block allocations can be done while the
   bitmap is being written to disk. To avoid these stalls, the bitmap is
   copied to another buffer which is written thus leaving the original
   available for futher allocations.
3) Link count tracking. Constantly track the difference in i_effnlink and
   i_nlink so that inodes that have had no change other than i_effnlink
   need not be written.
4) Identify buffers with rollback dependencies so that the buffer flushing
   daemon can choose to skip over them.
2000-01-10 00:24:24 +00:00
Kirk McKusick
bd5f5da94d Add bwillwrite to all system calls that create things in the filesystem.
Benchmarks that create huge trees of empty files overwhelm the buffer cache.
2000-01-10 00:08:53 +00:00
Kirk McKusick
411e1480fd Remove the P_BUFEXHAUST flag from the syncer process (leaving
it only on the buf_daemon process). The problem is that when the
syncer process starts running the worklist, it wants to delete
lots of files. It does this by VFS_VGET'ing the vnodes, clearing
the blocks in them and bdwrite'ing the buffer. It can process close
to a thousand files per second which generates a large number of
dirty buffers. So, giving it special priviledge at the buffer trough
leads to trouble as the buf_daemon does occationally need a free
buffer to proceed and if the syncer has used every last one up,
we are toast.
2000-01-10 00:07:24 +00:00
Eivind Eklund
e12d97d239 Change NDFREE() from a macro to a function for the time being; the macro
version caused intolerable bloat (30k).  I'm likely to revisit this with an
attempt at a smarter macro.

Bloat noticed by:       bde
2000-01-08 16:20:06 +00:00
Luoqi Chen
5c8b298e0e Allow SMP && NCPU == 1 to work. From now on, there's no restriction on the
value of NCPU relative to the number of cpus physically present, the actual
number of cpus utilized will be the smaller of the two.
2000-01-07 08:49:25 +00:00
Luoqi Chen
5e95083920 Introduce a mechanism to suspend/resume system processes. Suspend syncer
and bufdaemon prior to disk sync during system shutdown.
2000-01-07 08:36:44 +00:00
Peter Wemm
8cb96f20f8 Export the nselcoll counter via the kern.nselcoll sysctl so we can see
just how bad it gets in various situations.

Reminded by:  adrian
2000-01-05 19:40:17 +00:00
Matthew Dillon
c37c9620cd Enhance reassignbuf(). When a buffer cannot be time-optimally inserted
into vnode dirtyblkhd we append it to the list instead of prepend it to
    the list in order to maintain a 'forward' locality of reference, which
    is arguably better then 'reverse'.  The original algorithm did things this
    way to but at a huge time cost.

    Enhance the append interlock for NFS writes to handle intr/soft mounts
    better.

    Fix the hysteresis for NFS async daemon I/O requests to reduce the
    number of unnecessary context switches.

    Modify handling of NFS mount options.  Any given user option that is
    too high now defaults to the kernel maximum for that option rather then
    the kernel default for that option.

Reviewed by:	 Alfred Perlstein <bright@wintelcom.net>
2000-01-05 05:11:37 +00:00
Tor Egge
82916a1126 ISA device drivers use the ISA source interrupt number in locations where
the low level interrupt handler number should be used.  Change
setup_apic_irq_mapping() to allocate low level interrupt handler X (Xintr${X})
for any ISA interrupt X mentioned in the MP table.

Remove an assumption in the driver for the system clock (clock.c) that
interrupts mentioned in the MP table as delivered to IOAPIC #0 intpin Y
is handled by low level interrupt handler Y (Xintr${Y}) but don't assume
that low level interrupt handler 0 (Xintr0) is used.

Don't allocate two low level interrupt handlers for the system clock.
Reviewed by:	NOKUBI Hirotaka <hnokubi@yyy.or.jp>
2000-01-04 22:24:59 +00:00
Poul-Henning Kamp
fb01c24c11 Be more careful about NOUDEV and NODEV.
Submitted by:	bde
2000-01-04 12:51:50 +00:00
Poul-Henning Kamp
6a77f60d4a Create a separate pps_offset variable to use for applying the
hardpps() produced offset component.  This is tested and behaved
stable with frequency offsets from -338.05 to +499.91 PPM.

Interestingly the machine I tested this on would fail if the clock
were slower than 14.3132 MHz whereas it was perfectly happy to run
at 16.384 MHz, in other words [-340PPM ... +14.4%]

Make pps_shift tweakable with sysctl.
2000-01-04 12:04:39 +00:00
Poul-Henning Kamp
b9effc8901 truss /usr/bin/su
login (or not if root)
	then exit the shell

truss will get stuct in tsleep

I dont know if this is correct, but it fixes the problem and
according to the commends in pioctl.h, PF_ISUGID is set when we
want to ignore UID changes.

The code is checking for when PF_ISUGID is not set and since it
never is set, we always ignore UID changes.

Submitted by:	Paul Saab <ps@yahoo-inc.com>
2000-01-03 14:26:47 +00:00
Poul-Henning Kamp
19c5221906 Don't use time_offset as a leaky bucket variable in hardpps(), this
resulted in vastly optimistic offset values reported to userland
(typically a factor 40+ too small).  Apart from that, the code had
two sign-bugs.

Apply the hardpps() phase with the right sign with a simply
scaling by integration interval.  (This may be too stiff at
long integration intervals, see below).

Allow pps_shiftmax to be reduced again.

Before this, the phase lock in hardpps() were broken, but due to
two bugs mostly cancelling out, it would end up basically working
with a large stochastic component.  Now it behaves as one would
expect: smooth and quiet.

It seems that pps_shiftmax above 7..9 somewhere makes the phaselock
too weak to hold onto random walk phase errors from a HP-105 OCXO,
which basically means that it is too weak for real-life use with
such integration times.  This is yet to be resolved.

Submitted to:	Prof. Dave "NTP" Mills.
Tested by:	Terje Mathisen <Terje.Mathisen@hda.hydro.com>
1999-12-29 14:39:24 +00:00
Peter Wemm
8b70d192e3 Remove vnode_if.sh - it's a perl script. This stayed around for a while
because bsd.kmod.mk is usually out of sync with kernel source.  However
bsd.kmod.mk has to be updated now because of the _KERNEL change so there
is no need to keep this (pre-repo copy) version around.
1999-12-29 05:37:14 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Mike Smith
736e4b67ae Actively limit the allocation of mbufs to NMBUFS/nmbufs and mbuf clusters
to NMBCLUSTERS/nmbclusters/kern.ipc.nmbclusters.

Add a read-only sysctl kern.ipc.nmbufs matching kern.ipc.nmbclusters.

Submitted by:	Bosko Milekic <bmilekic@dsuper.net>
1999-12-28 06:35:57 +00:00
Bruce Evans
654f6be1c8 Changed the type used to represent the user stack pointer from `long *'
to `register_t *'.  This fixes bugs like misplacement of argc and argv
on the user stack on i386's with 64-bit longs.  We still use longs to
represent "words" like argc and argv, and assume that they are on the
stack (and that there is stack).  The suword() and fuword() families
should also use register_t.
1999-12-27 10:42:55 +00:00
Bruce Evans
9f79feec16 Fixed some type mismatches. p_retval[0] in struct proc has type
register_t, so pointers to it must be passed around as `register_t *',
not as `int *'.  The type mismatches were non-benign on alphas, but
the broken code is normally only configured by LINT.
1999-12-27 10:22:09 +00:00
Brian Feldman
c2696359ab Correct an uninitialized variable use, which, unlike most times, is
actually a bug this time.

Submitted by:	bde
Reviewed by:	bde
1999-12-27 06:31:53 +00:00
Bruce Evans
f85bdfcc66 Removed unused includes.
Rumoved unused compatibility cruft for dup().  Using it today would just
break dup() on fd's >= 64.

Fixed some style bugs.
1999-12-26 14:07:43 +00:00
Bruce Evans
da211f5bf6 Use vfs_timestamp() instead of getnanotime() to set timestamps. This
fixee incoherency of pipe timestamps relative to file timestamps in
the usual case where getnanotime() is not used for the latter.  (File
and pipe timestamps are still incoherent relative to real time unless
the vfs_timestamp_precision sysctl is set to 2 or 3).
1999-12-26 13:04:52 +00:00
Doug Rabson
54ac5b9b76 * Set the devclass of a device before calling the probe method. This allows
device_printf() etc. to print something intelligible.
* Allow device_set_devclass(dev, 0) for clearing the devclass.
1999-12-24 16:21:15 +00:00
Bruce Evans
586453fee2 Fixed a cast of a pointer to an integer of a possibly different size.
Fixed casts of non-`void *' pointers to uintptr_t.  Fixed related
style bugs.  This file uses perfectly non-KNF formatting for casts.
1999-12-24 15:33:36 +00:00
Kirk McKusick
02b0085406 Prettyness police: Identify flags in b_xflags with BX_ to distinguish
them from flags in b_flags which are prefixed with B_
1999-12-22 03:11:04 +00:00
Alfred Perlstein
80ef02b65d regenerate after making getfh a standard syscall. 1999-12-21 20:21:48 +00:00
Alfred Perlstein
20883b0f10 make getfh a standard syscall instead of dependant on having
NFSSERVER defined, useful for userland fileservers that want to
use a filehandle type interface to the filesystem.

Submitted by: Assar Westerlund assar@stacken.kth.se
PR: kern/15452
1999-12-21 20:21:12 +00:00
Eivind Eklund
369dc8ceb8 Change incorrect NULLs to 0s 1999-12-21 11:14:12 +00:00
Matthew Dillon
8f95b97072 Reimplement buf_daemon / getnewbuf() interaction for dealing with
stressful situations.  buf_daemon now makes a distinction between
    being woken up and its sleep timing out, and as a consequence is now
    much better able to dynamically tune itself to its environment.

Reviewed by:	Alfred Perlstein <bright@wintelcom.net>
1999-12-20 20:28:40 +00:00
Eivind Eklund
6357e7b507 Make m_print const correct (avoids a warning) 1999-12-20 18:10:00 +00:00
Greg Lehey
580e7e5a0f If we fail to find init, print out the search path used. This helps
differentiate between one of three different scenarios:

1.  No init.
2.  Path to init munged by an incorrect loader configuration.
3.  Root file system not mounted.

Reviewed-by:  billf
1999-12-20 02:50:49 +00:00
Poul-Henning Kamp
1b4ce5ce9b Don't ignore return value from tsleep().
Spotted by:	charnier
1999-12-19 12:36:41 +00:00
Robert Watson
91f37dcba1 Second pass commit to introduce new ACL and Extended Attribute system
calls, vnops, vfsops, both in /kern, and to individual file systems that
require a vfsop_ array entry.

Reviewed by:	eivind
1999-12-19 06:08:07 +00:00
Robert Watson
ef351daa32 First pass commit to introduce new ACL and Extended Attribute system calls.
The second pass commit with all the supporting code will happen shortly
afterwards.

Reviewed by:	eivind
1999-12-19 05:54:46 +00:00
Eivind Eklund
d776d82c4d Since VOP_LOCK can be used to up and downgrade locks, it is not possible
to say anything about the lockstate before and after it.  Thus, change the
lockspec from U L U to ? ? ?.
1999-12-18 23:01:52 +00:00
Brian Feldman
2cfa173c50 Woops, I'm so sorry I forgot this! From the last mbuf.h change:
m_mballoc_wakeup() (inline) -> MMBWAKEUP() (macro)
	m_clalloc_wakeup() (inline) -> MCLWAKEUP() (macro)

Noticed by:	peter
1999-12-18 20:04:19 +00:00
Eivind Eklund
762e6b856c Introduce NDFREE (and remove VOP_ABORTOP) 1999-12-15 23:02:35 +00:00
Brian Feldman
6c54410230 Bug fix:
The variables "m_mclalloc_wid" and "m_mballoc_wid" were not in the
proper place.  They should have been in uipc_mbuf.c and have been global,
not in mbuf.h and local per each file that uses mbuf.h.

Sorta bug fix:
   In mbuf.h, the definitions of various things for KERNEL and not
KERNEL cases were very screwy.   This fixes all of that which I could
find.
1999-12-14 02:23:14 +00:00
Tor Egge
f52523701c Fix two problems with pipe_write():
1. Data written beyond end of pipe buffer, causing kernel memory corruption.

    - Check that space is still valid after obtaining the pipe lock.

    - Defer the calculation of transfer size until the pipe
      lock has been obtained.

    - Update the pipe buffer pointers while holding the pipe lock.

 2. Writes of size <= PIPE_BUF not always atomic.

    - Allow an internal write to span two contiguous segments,
      so writes of size <= PIPE_BUF can be kept atomic
      when wrapping around from the end to the start of the
      pipe buffer.

PR:		15235
Reviewed by:	Matt Dillon <dillon@FreeBSD.org>
1999-12-13 02:55:47 +00:00
Peter Wemm
6f77b2defc Use a seperate -c and -h mode. The vnode_if.c file is compiled only into
the kernel while the vnode_if.h header is a bunch of inlines to call the
code that is in the kernel. Generating the .h file on the fly is kinda
bogus because it has to match the one compiled into the kernel.

IMHO we should have kern/vnode_if.c and sys/vnode_if.h committed in the
tree but that's another battle.
1999-12-12 16:43:05 +00:00
Peter Wemm
cfdd238335 Put on asbestos suit and put a splcam() around the 'Mounting root from..'
message to stop it splitting.  Every single scsi machine I've seen seems
to reliably collide with this and it's rather annoying.
1999-12-12 16:34:43 +00:00
Peter Wemm
016fc47da3 The sysctl mod_xx hack is no longer required now that we have totally
dynamic sysctl registration.
1999-12-12 16:30:34 +00:00
Brian Feldman
f48b807fc0 This is Bosko Milekic's mbuf allocation waiting code. Basically, this
means that running out of mbuf space isn't a panic anymore, and code
which runs out of network memory will sleep to wait for it.

Submitted by:	Bosko Milekic <bmilekic@dsuper.net>
Reviewed by:	green, wollman
1999-12-12 05:52:51 +00:00
Matthew Dillon
3854a87ef3 Remove accidental pollution unrelated to previous commit. The issue
here is real but has not yet been discussed with Eivind.
1999-12-12 03:28:14 +00:00
Matthew Dillon
4f79d873c1 Add MAP_NOSYNC feature to mmap(), and MADV_NOSYNC and MADV_AUTOSYNC to
madvise().

    This feature prevents the update daemon from gratuitously flushing
    dirty pages associated with a mapped file-backed region of memory.  The
    system pager will still page the memory as necessary and the VM system
    will still be fully coherent with the filesystem.  Modifications made
    by other means to the same area of memory, for example by write(), are
    unaffected.  The feature works on a page-granularity basis.

    MAP_NOSYNC allows one to use mmap() to share memory between processes
    without incuring any significant filesystem overhead, putting it in
    the same performance category as SysV Shared memory and anonymous memory.

Reviewed by: julian, alc, dg
1999-12-12 03:19:33 +00:00
Eivind Eklund
6bdfe06ad9 Lock reporting and assertion changes.
* lockstatus() and VOP_ISLOCKED() gets a new process argument and a new
  return value: LK_EXCLOTHER, when the lock is held exclusively by another
  process.
* The ASSERT_VOP_(UN)LOCKED family is extended to use what this gives them
* Extend the vnode_if.src format to allow more exact specification than
  locked/unlocked.

This commit should not do any semantic changes unless you are using
DEBUG_VFS_LOCKS.

Discussed with:	grog, mch, peter, phk
Reviewed by:	peter
1999-12-11 16:13:02 +00:00
Peter Wemm
4537138981 Zap c_index() and c_rindex(). Bruce prefers these to implicitly convert
a const into a non-const as they do in libc.  I feel that defeating the
type checking like that quite evil, but that's the way it is.
1999-12-10 17:38:41 +00:00
Poul-Henning Kamp
2ac0d0a1f7 Make adjtime(2) adjust boottime so it doesn't cause non-monotonous
uptime.
1999-12-08 10:02:12 +00:00
Poul-Henning Kamp
e8452d59e3 Scan cdevs for potential root devices, rather than bdevs. 1999-12-08 10:01:18 +00:00
Poul-Henning Kamp
7d5961670c Remove BAD144 support, it has already been disabled for some time. 1999-12-08 09:33:00 +00:00
Mike Smith
9eec696993 Change the default poweroff delay from 0 to 5 seconds. This seems to be
adequate for the IDE disks that I have available for testing.  Most seem
to wait between 1 and 3 seconds before flushing their caches.

Add the ability to override the delay at compile time via the
undocumented option POWEROFF_DELAY.  The delay can still be set via
sysctl as it was originally implemented.
1999-12-07 04:35:37 +00:00
Poul-Henning Kamp
72dfe7a3d7 I always forget to check before I reboot a system, and while it
boots I try in vain to remember which month or even year this system
was last booted in.

Print out the uptime before rebooting, and give people like me
less (or more as it may be) to think about while the systems boots.
1999-12-06 22:35:51 +00:00
Peter Wemm
bb6a234e47 Put on my asbestos underwear and commit the patch that I posted to -arch
some time ago that changes kern.randompid from a boolean to a randomness
range for the next pid assigment.  Too high causes a lot of extra work
to scan for free pids, and too low merely wastes randomness entropy.  It's
still possible to select a completely random range by using PID_MAX (100k)
or -1 as a shortcut to mean "the whole range".
Also, don't waste randomness when doing a wraparound.
1999-12-06 11:13:50 +00:00
Luoqi Chen
91c28bfde0 User ldt sharing. 1999-12-06 04:53:08 +00:00
Matt Jacob
9efed284d5 correct incomplete last change 1999-12-03 09:10:04 +00:00
Matthew N. Dodd
fe0d408987 Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered().  'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t.  Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything.  I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by:	peter, dfr
1999-12-03 08:41:24 +00:00
Nick Hibma
39e86a12aa Remove check for attached state.
sc = devclass_get_softc(devclass, unit);

doesn't return NULL during attach anymore, and produces the sc,
identical to (for devclass_get_unit(devclass, unit) != NULL that is):

   sc = device_get_softc(devclass_get_unit(devclass, unit));

Reviewed-by:   dfr
1999-12-02 16:30:21 +00:00
Archie Cobbs
1c38f2ea70 The functions m_copym() and m_copypacket() return read-only copies,
because in the case of mbuf clusters they only increment the reference
count rather than actually copying the data.

Add comments to this effect, and add a new routine called m_dup() that
returns a real, writable copy of an mbuf chain.

This is preliminary work required for implementing 'ipfw tee'.

Reviewed by:	julian
1999-12-01 22:31:32 +00:00
Brian Feldman
226420a464 Separate some common sysctl code into sysctl_find_oid() and calling
thereof.  Also, make the errno returns  _correct_, and add a new one
which is more appropriate.
1999-12-01 02:25:19 +00:00
Kirk McKusick
e9cc475851 Collect read and write counts for filesystems. This new code
drops the counting in bwrite and puts it all in spec_strategy.
I did some tests and verified that the counts collected for writes
in spec_strategy is identical to the counts that we previously
collected in bwrite. We now also get read counts (async reads
come from requests for read-ahead blocks). Note that you need
to compile a new version of mount to get the read counts printed
out. The old mount binary is completely compatible, the only
reason to install a new mount is to get the read counts printed.

Submitted by:	Craig A Soules <soules+@andrew.cmu.edu>
Reviewed by:	Kirk McKusick <mckusick@mckusick.com>
1999-12-01 02:09:30 +00:00
Peter Wemm
ebc49c5654 Don't make the ktrace hook in tsleep() deref a null curproc after a panic.
PR:		15169
Submitted by:	David Gilbert <dgilbert@velocet.ca>
1999-11-30 09:01:46 +00:00
Matthew N. Dodd
44a451ba24 Reduce code duplication.
Hopefully this clears up some confusion about the nature of
devclass_get_softc() vs. device_get_softc() as well.

The check against DS_ATTACHED remains as this is not
a change that modifies functionality.

Reviewed by:	Peter "in principle" Wemm
1999-11-30 07:06:03 +00:00
Matthew Dillon
245efbba4d Remove vfs_getrootfsid() function (a temporary hack added a few months
ago to make BOOTP work again).  It is no longer required by BOOTP and
    no longer used.
1999-11-29 22:25:36 +00:00
Poul-Henning Kamp
c464420c89 Report swapdevices as cdevs rather than bdevs.
Remove unused dev2budev() function.
1999-11-29 21:37:18 +00:00
Poul-Henning Kamp
38941f351c Remove the now unused chrtoblk() function. 1999-11-29 20:50:58 +00:00
Matthew Dillon
99e659dcfa Make BOOTP work again.
Submitted by:	Doug Ambrisko <ambrisko@whistle.com>
1999-11-29 18:51:04 +00:00
Poul-Henning Kamp
8f04f6c729 Add a bit of sanity checking and problem avoidance in case the
timecounter hardware is bogus.

This will produce a new warning "microuptime() went backwards"
and try to not screw up the process resource accounting.
1999-11-29 11:29:04 +00:00
Mike Smith
c0da4cacd0 Use the correct mounted-from path when allocating the root mount, if we know
what it is.

Be more correct in unbusying the mountpoint (especially before freeing it).

Remove support for mounting 'r' devices as root.  You don't mount 'r'
devices anywhere else, and they're going away anyway.

Submitted by:	bde
1999-11-28 22:20:18 +00:00