Commit Graph

2027 Commits

Author SHA1 Message Date
Peter Wemm 1c5bb3eaa1 add #include <sys/kernel.h> where it's needed by MALLOC_DEFINE() 1998-11-10 09:16:29 +00:00
Peter Wemm c6105dce78 Register and unregister vnodeops the new way rather than leaking on
unload.
1998-11-10 09:12:40 +00:00
Peter Wemm 5ad3d2212f kzipboot uses kern/inflate.c outside the kernel by providing its own
minimal malloc/free implementation.  Stop passing M_GZIP to it.
1998-11-10 09:08:49 +00:00
Peter Wemm 4e61198e8f Make the vnode opv vector construction fully dynamic. Previously we
leaked memory on each unload and were limited to items referenced in
the kernel copy of vnode_if.c.  Now a kernel module is free to create
it's own VOP_FOO() routines and the rest of the system will happily
deal with it, including passthrough layers like union/umap/etc.

Have VFS_SET() call a common vfs_modevent() handler rather than
inline duplicating the common code all over the place.

Have VNODEOP_SET() have the vnodeops removed at unload time (assuming a
module) so that the vop_t ** vector is reclaimed.

Slightly adjust the vop_t ** vectors so that calling slot 0 is a panic
rather than a page fault.  This could happen if VOP_something() was called
without *any* handlers being present anywhere (including in vfs_default.c).
slot 1 becomes the default vector for the vnodeop table.

TODO: reclaim zones on unload (eg: nfs code)
1998-11-10 09:04:09 +00:00
Peter Wemm edfbe15080 Arrange for unload-time linker set hooks to be called. While cut/pasting
some code, I changed the original to be consistant with the rest of the
file rather than duplicating the problems.
1998-11-10 08:49:28 +00:00
Peter Wemm db66937855 Have MALLOC_DECLARE() initialize malloc types explicitly, and have them
removed at module unload (if in a module of course).
However; this introduces a new dependency on <sys/kernel.h> for things
that use MALLOC_DECLARE().  Bruce told me it is better to add sys/kernel.h
to the handful of files that need it rather than add an extra include to
sys/malloc.h for kernel compiles. Updates to follow in subsequent commits.
1998-11-10 08:46:24 +00:00
Don Lewis 643a8daaaf If the session leader dies, s_leader is set to NULL and getsid() may
dereference a NULL pointer, causing a panic.  Instead of following
s_leader to find the session id, store it in the session structure.

Jukka found the following info:

	BTW - I just found what I have been looking for. Std 1003.1
	Part 1: SYSTEM API [C LANGUAGE] section 2.2.2.80 states quite
	explicitly...

	Session lifetime: The period between when a session is created
	and the end of lifetime of all the process groups that remain
	as members of the session.

	So, this quite clearly tells that while there is any single
	process in any process group which is a member of the session,
	the session remains as an independent entity.

Reviewed by:	peter
Submitted by:	"Jukka A. Ukkonen" <jau@jau.tmt.tele.fi>
1998-11-09 15:08:04 +00:00
Nicolas Souchu 31a7daae9e Add semicolon to INTERFACE declaration. 1998-11-08 18:51:38 +00:00
Nicolas Souchu 7a8ecb9e64 Add semicolon to INTERFACE declarations 1998-11-08 18:35:53 +00:00
Nicolas Souchu 1864a32626 "Here is the most recent version of makedevops.pl. I've made the parsing
of the input file more strict and the error messages more elaborate.
Second, the output file has slightly improved looks when >80 character
lines are concerned (I needed a 80 character line formatter anyway for
work...)."

Submitted by: Nick Hibma <nick.hibma@jrc.it>
1998-11-08 18:33:11 +00:00
Doug Rabson 7095ee912b * Fix a couple of places in the device pager where an address was
truncated to 32 bits.
* Change the calling convention of the device mmap entry point to
  pass a vm_offset_t instead of an int for the offset allowing
  devices with a larger memory map than (1<<32) to be supported
  on the alpha (/dev/mem is one such).

These changes are required to allow the X server to mmap the various
I/O regions used for device port and memory access on the alpha.
1998-11-08 12:39:07 +00:00
David Greenman bd81f199b5 Added support for non-blocking sockets to sendfile(2). 1998-11-06 19:16:30 +00:00
Peter Wemm caab6e909e Don't put aggregate structs 4K large on the kernel stack, especially when
we can recurse when loading dependencies and that the kstack is limited
to something like 6 or 7KB.  Having a single dependency caused an instant
double panic, and I stronly suspect some of the other strange "events"
that I have seen are possibly as a result of taking a couple of interrupts
with a large chunk of the stack already in use.

While here, fix a minor logic hiccup in a sanity check.
1998-11-06 15:16:07 +00:00
Peter Wemm 21ce23eb91 Define the kld_debug variable if KLD_DEBUG is enabled 1998-11-06 15:10:17 +00:00
Peter Wemm f9d919e98f put a \n on an error message printf 1998-11-06 02:18:57 +00:00
David Greenman dd0b2081f4 Implemented zero-copy TCP/IP extensions via sendfile(2) - send a
file to a stream socket. sendfile(2) is similar to implementations in
HP-UX, Linux, and other systems, but the API is more extensive and
addresses many of the complaints that the Apache Group and others have
had with those other implementations. Thanks to Marc Slemko of the
Apache Group for helping me work out the best API for this.
Anyway, this has the "net" result of speeding up sends of files over
TCP/IP sockets by about 10X (that is to say, uses 1/10th of the CPU
cycles) when compared to a traditional read/write loop.
1998-11-05 14:28:26 +00:00
Bill Fenner 0931333f8d Fix sbcheck() to check all packets on socket buffer.
Also fix data types and printf formats while I'm here.

PR:	misc/8494

Panic instead of looping forever in sbflush().  If sb_mbcnt counts
more mbufs than sb_cc counts bytes, the original code can turn into an
infinite loop of removing 0 bytes from the socket buffer until it's empty.
1998-11-04 20:22:11 +00:00
Peter Wemm 84e40f5627 The handle for the kernel is common. With this fix, ELF kernels can load
a.out kld modules, and a.out kernels can load ELF kld modules.
1998-11-04 15:20:58 +00:00
Peter Wemm ee9d248c5f General tidy up: remove more unused code, update comments, simplify some
routines a little.
1998-11-04 03:18:10 +00:00
Peter Wemm 02fc72dbe5 make mount(2) automatically kldload modules if the requested filesystem
isn't present.
1998-11-03 14:29:09 +00:00
Peter Wemm 7837745438 Have the in-kernel linker try a default extension of .ko. This means that
"kldload nfs" works.  We use the same default extension in the /boot/loader
system.
1998-11-03 14:27:05 +00:00
Peter Wemm e91a7f30cf Initialize the a.out kld loader after elf, so that elf gets first shot at
a kldload attempt.
1998-11-03 14:25:21 +00:00
Peter Wemm b913711e0c Use the kvm space pathname that we copied in, not the one in user space. 1998-11-03 13:09:31 +00:00
Peter Wemm 8c14bf40a1 Change the #ifdef UNION code into a callable hook. Arrange to have this
set up when unionfs is present, either statically or as a kld module.
1998-11-03 08:01:48 +00:00
Peter Wemm f3d6ee090e Only do one VOP_ACCESS() per open() instead of two. This should reduce
the NFSv3 ACCESS RPC problems a little for busy clients that do a lot of
open/close.  The nfs code could probably cache the results, but I'm not
sure whether this would be legal or useful.  The problem is that with
a CPU farm, on each open there would be a lookup, getattr then access RPC
then the read/write RPC activity.  Caching the access results probably
isn't going to help much if the clients access lots of files.  Having the
nfs_access() routine interpret the getattr results is a bit of a hack, but
it's how NFSv2 is done and it might be OK for a mount attribute for v3.
1998-11-02 02:36:16 +00:00
Peter Wemm 40c8cfe552 Use TAILQ macros for clean/dirty block list processing. Set b_xflags
rather than abusing the list next pointer with a magic number.
1998-10-31 15:31:29 +00:00
Peter Wemm 16e9e530cc Convert lists for bufs attached to vnodes from a LIST to a TAILQ.
- Use TAILQ_* macros extensively instead of internal names
- use b_xflags instead of the NOLIST magic number hack in the next pointer
- clean bufs are inserted at the tail rather than the head.
- redo dirty buffer insert so that metadata (negative lbn) goes to the
  tail directly rather than at the HEAD.  This makes a difference when
  inserting dirty data blocks in lbn sorted order since data block
  insertion will not have to bypass all the metadata cruft.  data is
  lbn sorted since it makes sense for clustering and writeback ordering,
  while metadata sorting doesn't help much since the lbn's are
  meaningless when walking the list for writebacks.

Small systems will not notice much (if any) benefit from this, but really
busy systems with large dirty block lists should get a lot more.

I've tested this with softdep, and it doesn't seem to mind the change of
queueing of metadata.

Reviewed (in princible) by: dg
Obtained from: partly from John Dyson's work-in-progress patches in June.
1998-10-31 14:20:39 +00:00
Peter Wemm b421db370b The last argument to vm_object_page_clean() are now bit flags, rather than
the old true/false.

While here, have vfs_msync() only call vm_object_page_clean() with
OBJPC_SYNC if called with MNT_WAIT flags.  vfs_msync() is called at unmount
time (with MNT_WAIT) and from the syncer process (formerly update).
This should make dirty mmap writebacks a little less nasty.

I have tested this a little with SOFTUPDATES enabled, but I don't normally
use it since I've been badly burned too many times.
1998-10-31 07:42:04 +00:00
David Greenman 2a78b8d1f8 Unwire everything to the inactive queue in order to preserve LRU ordering. 1998-10-30 14:53:54 +00:00
Mike Smith 35d27a0f39 Add the ability to specify where on the at_shutdown queue a handler is
installed.

Remove cpu_power_down, and replace it with an entry at the end of the
SHUTDOWN_FINAL queue in the only place it's used (APM).

Submitted by:	Some ideas from Bruce Walter <walter@fortean.com>
1998-10-30 05:41:15 +00:00
Bruce Evans cbbbd4c330 Oops, rev.1.167 made the device number checking in bdevvp() too strict
for mfs root mounts.  Don't require major 255 to be in bdevsw[].
1998-10-29 11:50:32 +00:00
David Greenman 0d5a725446 Fixed editing error. Pointed out by bde. 1998-10-29 11:04:22 +00:00
Peter Wemm 20f02ef5e9 Remove the V_SAVEMETA flag, nothing uses it any more now that msdosfs and
ext2fs call vtruncbuf() directly.  This simplifies and cleans up
vinvalbuf() a little.
1998-10-29 09:51:28 +00:00
Garrett Wollman a64d49d14f A Perl5 version of makedevops.sh. Fixes a bug in the sh/awk version
which really annoyed me at the time but I don't think bites me any
more.
1998-10-29 01:52:59 +00:00
Garrett Wollman af2a5c769a The new resource manager, hopefully in a reasonably stable form. 1998-10-29 01:48:36 +00:00
David Greenman 730075613a Added a second argument, "activate" to the vm_page_unwire() call so that
the caller can select either inactive or active queue to put the page on.
1998-10-28 13:37:02 +00:00
Doug Rabson 45a576b57a Lots of debugging code and some bugfixes.
Submitted by: Nick Hibma <nick.hibma@jrc.it>
1998-10-27 09:21:43 +00:00
Bruce Evans 885bf0b57a Updated the major number check in vfs_object_create(). It's not
clear if the check is necessary, but vfs_object_create() is called
for all vnodes and it was silly to create objects for VBLK vnodes
that don't even have a driver.
1998-10-26 08:07:00 +00:00
Bruce Evans fffd686a31 Fixed breakage of the GPROF case of statclock() in the previous commit. 1998-10-26 06:13:18 +00:00
Bruce Evans b64f28be2d Oops, back out some local changes that shouldn't have been in the
previous commit.
1998-10-25 20:11:36 +00:00
Bruce Evans c8a1bed2ab Fixed breakage of the !SMP case of roundrobin() in the previous commit. 1998-10-25 19:57:23 +00:00
Poul-Henning Kamp f5ef029e92 Nitpicking and dusting performed on a train. Removes trivial warnings
about unused variables, labels and other lint.
1998-10-25 17:44:59 +00:00
Bruce Evans 37906c686d Fixed device number checking in bdevvp():
- dev != NODEV was checked for, but 0 was returned on failure.  This was
  fixed in Lite2 (except the return code was still slightly wrong (ENODEV
  instead of ENXIO)) but the changes were not merged.  This case probably
  doesn't actually occur under FreeBSD.
- major(dev) was not checked to have a valid non-NULL bdevsw entry.  This
  caused panics when the driver for the root device didn't exist.

Fixed minor misformattings in bdevvp().  Rev.1.14 consisted mainly of
gratuitous reformattings that seem to have caused many Lite2 merge
errors.

PR:			8417
1998-10-25 16:11:49 +00:00
Bruce Evans a6cda5b68f Fixed sysctl attachment for statically configured vfs's.
Broken in:		previous commit
1998-10-25 10:52:34 +00:00
Mike Smith 6fe8861e01 Don't put 0x in front of %p, it does it already.
Submitted by:	 Brian Feldman <green@janus.syracuse.net>
1998-10-24 18:35:09 +00:00
Poul-Henning Kamp 3bac064ff7 Change the way we simulate stable storage for timecounters.
If you have problems with the "calcru" messages and processes being
killed for excessive cpu time, try to increase the NTIMECOUNTER
#define and report your findings.
1998-10-23 10:44:52 +00:00
John Polstra 2c2a0cf191 Eliminate a superfluous comment. 1998-10-21 16:31:38 +00:00
Peter Wemm 52c24af701 Some cleanups and optimizations:
- Use the system headers method for Elf32/Elf64 symbol compatability
- get rid of the UPRINTF debugging.
- check the ELF header for compatability much more completely
- optimize the section mapper.  Use the same direct VM interfaces that
  imgact_aout.c and kern_exec.c use.
- Check the return codes from the vm_* functions better.  Some return
  KERN_* results, not an errno.
- prefault the page tables to reduce startup faults on page tables like
  a.out does.
- reset the segment protection to zero for each loop, otherwise each
  segment could get progressively more privs. (eg: if the first was
  read/write/execute, and the second was meant to be read/execute, the
  bug would make the second r/w/x too.  In practice this was not a
  problem because executables are normally laid out with text first.)
- Don't impose arbitary limits.  Use the limits on headers imposed by
  the need to fit them into one page.
- Remove unused switch() cases now that the verbose debugging is gone.

I've been using an earlier version of this for a month or so.
This sped up ELF exec speed a bit for me but I found it hard to get
consistant benchmarks when I tested it last (a few weeks ago).
I'm still bothered by the page read out of order caused by the
transition from data to bss. This which requires either part filling the
transition page or clearing the remainder.
1998-10-18 15:55:12 +00:00
Bruce Evans 95242f5a02 Overload the correct errno for attempts to set an in-core label with
a raw partition at a nonzero offset (EINVAL should have been EXDEV;
DIOCSDINFO was broken, and DIOCWDINFO was broken because it depended
on DIOCSDINFO).

A zero offset for the raw partition should probably be enforced in
setdisklabel(), and DIOCWDINFO should probably always be handled by
first calling setdisklabel() so that writedisklabel() doesn't need to
enforce it, but this has never been done; dsioctl() has a special
check.  Changes in this commit are limited to dsioctl() to preserve
bug for bug compatibility in drivers that don't use the slice code
(notably the ccd driver, which allows setting a bogus label in
DIOCWDINFO and doesn't undo the setting when writedisklabel() fails).
1998-10-17 09:46:42 +00:00
Bruce Evans e36b4f594a Use only the correct raw partition for writing labels. Don't use the
partition that the label ioctl is being done on just because it has
offset 0, since there is no guarantee that such a partition is large
enough to contain the label.  Don't use the wrong raw partition (0
instead of RAW_PART).

This fixes problems rewriting bizarre labels (with a nonzero offset
for the 'a' partition) in newfs(8).  Such labels shouldn't normally
be used, but creating them was allowed if the ioctl was done on the
raw partition, and sysinstall creates them if the root partition isn't
allocated first.

Note that allowing write access to a partition other than the one that
has been checked for write access doesn't increase security holes
significantly, since write access to any partition already allows
changing the in-core label.

This fix should be in 3.0R.  Rev.1.26 of newfs/newfs.c shouldn't be
in 3.0R.
1998-10-17 07:49:04 +00:00