Commit graph

1629 commits

Author SHA1 Message Date
Bruce Evans d02601f8cf Fixed rev.1.81. mp->mnt_kern_flag was restored in the non-error case of
`mount -u'.  This only matters for `mount -u' competing with unmounts.
If I understand the locking correctly: if mount() blocks, then unmount()
may run and set mp->kern_flag for the same mp.  Then unmount() blocks
waiting for mount() to finish.  When unmount() continues, its MNTK flags
(MNTK_UNMOUNT and MNTK_MWAIT) may have been clobbered.

Didn't fix old bugs:
- restoring mp->mnt_kern_flag is wrong for the same reasons in the error
  case.
- the error case of unmount() seems to be broken too:
  (a) MNTK_UNMOUNT gets clobbered, although another unmount() may have
      set it.  Perhaps it shouldn't be set until after the full lock is
      aquired.
  (b) MNTK_MWAIT isn't honoured.

Fixed a nearby style bug.
1997-11-22 06:10:36 +00:00
Bruce Evans 6881d20fbb Const poisoning from ks_shortdesc. 1997-11-21 11:37:03 +00:00
Bruce Evans d73424aa6b Fixed a sloppy common-style definitions. 1997-11-20 20:07:59 +00:00
Bruce Evans 01166e9245 Avoid passing a `retval' to wait1()
Disallow wait options that are not a combination of the standard POSIX
options WUNTRACED and WNOHANG, as is required by POSIX.  BSD doesn't
have any extensions here, but the code was `#ifdef notyet' for some
reason.
1997-11-20 19:09:43 +00:00
Bruce Evans be67169a57 Removed unused includes.
Staticized.

Avoid passing a `retval' to fork1().

Fixed some style bugs.
1997-11-20 16:36:17 +00:00
Bruce Evans d96bc99dac Removed unused #includes. Ifdefed a conditionally used #include.
Fixed nonblocking mode.  It was per-device instead of per-file.

Don't depend on gcc's misfeature of rewriting char args in old-style
function definitions to match wrong prototypes.  Break K&R1 support
to fix this quickly.
1997-11-18 16:12:51 +00:00
Bruce Evans fc8f7066d2 Get buffer stuff by #including <sys/buf.h> instead of <sys/vnode.h>.
Staticized boot().

Fixed a gratuitous ANSIism.
1997-11-18 15:16:43 +00:00
Bruce Evans d662024a0d Removed an unused #include.
Fixed a style bug (one of many KNF breakages in vfs_subr.c moved here).
1997-11-18 13:03:48 +00:00
Bruce Evans 1fe5398ce7 Get tty ioctl numbers by #including <sys/ttycom.h> instead of
<sys/tty.h>.  Don't #include <sys/fcntl.h> (the select -> poll
changes removed all dependencies on it).
1997-11-18 12:59:09 +00:00
Bruce Evans b7f5d5b54d Removed an unused #include. Added an unsed #include of <sys/ucred.h>
to prepare for not including it in <sys/param.h>.  Moved conditionally
used #includes inside an ifdef.
1997-11-18 12:52:10 +00:00
Bruce Evans e4474ce8bf Removed an unused #include. Ifdefed a conditionally used #include. 1997-11-18 12:43:41 +00:00
Bruce Evans 99af8d4e43 Removed unused #include. 1997-11-18 12:24:22 +00:00
Bruce Evans fdebd4f0fd Get locking stuff by #including <sys/lock.h> instead of <sys/vnode.h>. 1997-11-18 10:02:40 +00:00
Peter Wemm 6245570f67 Don't generate new prototype files with the extra int retval[] arg at
the end since pdk deleted them.

Forgotten by: phk
1997-11-18 03:34:39 +00:00
Julian Elischer 52bf64c787 Reviewed by: hackers@freebsd.org in general
Obtained from: Whistle Communications tree

Add an option to the way UFS works dependent on the SUID bit of directories
This changes makes things a whole lot simpler on systems running as
fileservers for PCs and MACS. to enable the new code you must
1/ enable option SUIDDIR on the kernel.
2/ mount the filesystem with option suiddir.
hopefully this makes it difficult enough for people to
do this accidentally.
see the new chmod(2) man page for detailed info.
1997-11-13 00:28:51 +00:00
Tor Egge d72ec6655e Set return value for the correct process in ptrace(). 1997-11-12 12:28:12 +00:00
Julian Elischer b1f4a44b03 Reviewed by: various.
Ever since I first say the way the mount flags were used I've hated the
fact that modes, and events, internal and exported, and short-term
and long term flags are all thrown together. Finally it's annoyed me enough..
This patch to the entire FreeBSD tree adds a second mount flag word
to the mount struct. it is not exported to userspace. I have moved
some of the non exported flags over to this word. this means that we now
have 8 free bits in the mount flags. There are another two that might
well move over, but which I'm not sure about.
The only user visible change would have been in pstat -v, except
that davidg has disabled it anyhow.
I'd still like to move the state flags and the 'command' flags
apart from each other.. e.g. MNT_FORCE really doesn't have the
same semantics as MNT_RDONLY, but that's left  for another day.
1997-11-12 05:42:33 +00:00
Jordan K. Hubbard 64bd2f7b57 MF22: MSG_EOR bug fix.
Submitted by:	wollman
1997-11-09 05:07:40 +00:00
Tor Egge 31e5225482 Use UPAGES when setting up private pages for SMP (which includes idle stack). 1997-11-07 19:58:34 +00:00
Poul-Henning Kamp 0abc78a697 Rename some local variables to avoid shadowing other local variables.
Found by: -Wshadow
1997-11-07 09:21:01 +00:00
Poul-Henning Kamp 4a11ca4e29 Remove a bunch of variables which were unused both in GENERIC and LINT.
Found by:	-Wunused
1997-11-07 08:53:44 +00:00
Poul-Henning Kamp cb226aaa62 Move the "retval" (3rd) parameter from all syscall functions and put
it in struct proc instead.

This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.

I have not removed the /*ARGSUSED*/, they will require some looking at.

libkvm, ps and other userland struct proc frobbing programs will need
recompiled.
1997-11-06 19:29:57 +00:00
Poul-Henning Kamp d1bbc7ec65 Remove the long description from the in-kernel datastructure.
Put a magic field in there instead, to help catch uninitialized
malloc types.
1997-10-28 19:01:02 +00:00
Bruce Evans 55b211e3af Removed unused #includes. 1997-10-28 15:59:26 +00:00
Bruce Evans 1315bcf7d4 Fixed style bugs in open() fix. 1997-10-28 10:29:55 +00:00
Bruce Evans 4090154b9e Moved declaration of etext from <machine/md_var.h> to <machine/cpu.h>
and fixed everything that dependended on it being declared in the old
place.  It is used in "machine-independent" code in subr_prof.c.

Moved declaration of btext from subr_prof.c to <machine/cpu.h>.  It
is machine-dependent.
1997-10-27 17:23:18 +00:00
Bruce Evans 32e4d4c5e6 Use 127 instead of CHAR_MAX for the limit on the sequence count. The
limit doesn't have anything to do with characters.  The count mainly
needs to fit in the VOP_READ() ioflag after being left shifted by 16.

Moved vn_lock() before vn_closefile().  vn_lock() was mismerged from
Lite2.

Removed some gratuitous braces.
1997-10-27 15:26:23 +00:00
Poul-Henning Kamp dba3870c10 VFS interior redecoration.
Rename vn_default_error to vop_defaultop all over the place.
Move vn_bwrite from vfs_bio.c to vfs_default.c and call it vop_stdbwrite.
Use vop_null instead of nullop.
Move vop_nopoll from vfs_subr.c to vfs_default.c
Move vop_sharedlock from vfs_subr.c to vfs_default.c
Move vop_nolock from vfs_subr.c to vfs_default.c
Move vop_nounlock from vfs_subr.c to vfs_default.c
Move vop_noislocked from vfs_subr.c to vfs_default.c
Use vop_ebadf instead of *_ebadf.
Add vop_defaultop for getpages on master vnode in MFS.
1997-10-26 20:55:39 +00:00
Poul-Henning Kamp e83f76772d Remade syscalls.master derived files. 1997-10-26 20:28:54 +00:00
Poul-Henning Kamp e6e21bc0a4 Add "NOIMPL" for syscalls we know what is, but don't implement as "STD".
Use this for getfh & nfssvc.
1997-10-26 20:27:51 +00:00
Poul-Henning Kamp 1b09ae776d Simplify the lease_check stuff. 1997-10-26 20:26:33 +00:00
John-Mark Gurney f173e80c8b make a couple functions static...
also change module_register_static to module_register_init as this
function initalizes the module for both dynamic and static modules...
1997-10-24 05:29:07 +00:00
KATO Takenori 1c1ff2947b Disallow non-root mount. If you want to allow non-root mount, change
vfs.usermount into 1 with sysctl.
1997-10-23 09:29:09 +00:00
Joerg Wunsch 2094bd7342 Reject attempts to call open() with an illegal combination of O_RDONLY,
O_WRONLY, O_RDWR.
1997-10-22 07:28:51 +00:00
Poul-Henning Kamp c988324000 Add const to a couple of casts to silence some of the warnings Bruce
has let loose on us.
1997-10-21 13:28:36 +00:00
Andrey A. Chernov 5332bc655c Fix returned sleep period for large values
Submitted by: bde
1997-10-20 18:43:49 +00:00
David Greenman 916ca17535 kern.maxproc is not writable since there are tables that are statically
sized at startup.
PR: 4675
1997-10-19 18:45:59 +00:00
David Greenman 7aef05003a Killed non-sensical call to splimp/splx in crfree(). 1997-10-17 23:52:56 +00:00
Poul-Henning Kamp d54d34b533 Make a set of VOP standard lock, unlock & islocked VOP operators, which
depend on the lock being located at vp->v_data.  Saves 3x3 identical
vop procs, more as the other filesystems becomes lock aware.
1997-10-17 12:36:19 +00:00
Poul-Henning Kamp e9565321ea VFS clean up "hekto commit"
1.  Add defaults for more VOPs
        VOP_LOCK        vop_nolock
        VOP_ISLOCKED    vop_noislocked
        VOP_UNLOCK      vop_nounlock
    and remove direct reference in filesystems.

2.  Rename the nfsv2 vnop tables to improve sorting order.
1997-10-16 22:01:05 +00:00
Poul-Henning Kamp 987f569678 Another VFS cleanup "kilo commit"
1.  Remove VOP_UPDATE, it is (also) an UFS/{FFS,LFS,EXT2FS,MFS}
    intereface function, and now lives in the ufsmount structure.

2.  Remove VOP_SEEK, it was unused.

3.  Add mode default vops:

    VOP_ADVLOCK          vop_einval
    VOP_CLOSE            vop_null
    VOP_FSYNC            vop_null
    VOP_IOCTL            vop_enotty
    VOP_MMAP             vop_einval
    VOP_OPEN             vop_null
    VOP_PATHCONF         vop_einval
    VOP_READLINK         vop_einval
    VOP_REALLOCBLKS      vop_eopnotsupp

    And remove identical functionality from filesystems

4.   Add vop_stdpathconf, which returns the canonical stuff.  Use
     it in the filesystems.  (XXX: It's probably wrong that specfs
     and fifofs sets this vop, shouldn't it come from the "host"
     filesystem, for instance ufs or cd9660 ?)

5.   Try to make system wide VOP functions have vop_* names.

6.   Initialize the um_* vectors in LFS.

(Recompile your LKMS!!!)
1997-10-16 20:32:40 +00:00
Poul-Henning Kamp 2df896458d Oops. forgot the blasted cvs add.
Pointed hat sent from:	Karl Denninger  <karl@Mcs.Net>
1997-10-16 17:48:22 +00:00
Poul-Henning Kamp cec0f20ce7 VFS mega cleanup commit (x/N)
1.  Add new file "sys/kern/vfs_default.c" where default actions for
    VOPs go. Implement proper defaults for ABORTOP, BWRITE, LEASE,
    POLL, REVOKE and STRATEGY.  Various stuff spread over the entire
    tree belongs here.

2.  Change VOP_BLKATOFF to a normal function in cd9660.

3.  Kill VOP_BLKATOFF, VOP_TRUNCATE, VOP_VFREE, VOP_VALLOC.  These
    are private interface functions between UFS and the underlying
    storage manager layer (FFS/LFS/MFS/EXT2FS).  The functions now
    live in struct ufsmount instead.

4.  Remove a kludge of VOP_ functions in all filesystems, that did
    nothing but obscure the simplicity and break the expandability.
    If a filesystem doesn't implement VOP_FOO, it shouldn't have an
    entry for it in its vnops table.  The system will try to DTRT
    if it is not implemented.  There are still some cruft left, but
    the bulk of it is done.

5.  Fix another VCALL in vfs_cache.c (thanks Bruce!)
1997-10-16 10:50:27 +00:00
Julian Elischer 4199ed4098 We are mounting the root.
mount it at the HEAD of the queue, DEVFS might already be there..
1997-10-16 07:32:14 +00:00
Guido van Rooij d021ae3db5 On execing a sgid program, do not set P_SUGID when cr_gid and cr)_uid
do not change.
PR:		4755
Reviewed by:	Bruce Evans
1997-10-15 18:28:34 +00:00
Peter Wemm 987163643c Sigh. Signal handlers are executed on leaving the system call, not
at moment of delivery.  Restoring the signal mask after the tsleep()
is next to useless since the signal is still queued.. This was interacting
with usleep(3) on receipt of a SIGALRM causing it to near busy loop.

Now, we set the new signal mask "permanently" for signanosleep().

Problem noted by:  bde
1997-10-15 13:58:52 +00:00
Poul-Henning Kamp 138ec1f71a vnops megacommit
1.  Use the default function to access all the specfs operations.
2.  Use the default function to access all the fifofs operations.
3.  Use the default function to access all the ufs operations.
4.  Fix VCALL usage in vfs_cache.c
5.  Use VOCALL to access specfs functions in devfs_vnops.c
6.  Staticize most of the spec and fifofs vnops functions.
7.  Make UFS panic if it lacks bits of the underlying storage handling.
1997-10-15 13:24:07 +00:00
Poul-Henning Kamp a1c995b626 Last major round (Unless Bruce thinks of somthing :-) of malloc changes.
Distribute all but the most fundamental malloc types.  This time I also
remembered the trick to making things static:  Put "static" in front of
them.

A couple of finer points by:	bde
1997-10-12 20:26:33 +00:00
Peter Wemm 0c111a5c17 Try and fix some style problems 1997-10-12 15:24:39 +00:00
Poul-Henning Kamp 55166637cd Distribute and statizice a lot of the malloc M_* types.
Substantial input from:	bde
1997-10-11 18:31:40 +00:00
Poul-Henning Kamp 22c6434807 Freeing with unknown type is a panic kind of thing. 1997-10-11 13:13:09 +00:00
Poul-Henning Kamp a6cf5c6dfc Remove all traces of M_VFSCONF, which were for all practical
purposes unused.
1997-10-11 13:11:32 +00:00
Poul-Henning Kamp a42428bb03 Remove a debug printf entirely. 1997-10-11 10:49:43 +00:00
Peter Wemm bd975223e0 Disable an extremely annoying printf. 1997-10-11 10:41:44 +00:00
Poul-Henning Kamp f7891f9adb Dike out a weird warning. 1997-10-11 07:34:27 +00:00
John Dyson c486068695 Make the target for the number of AIO daemons work. 1997-10-11 01:07:03 +00:00
Poul-Henning Kamp 60a513e942 Rename "struct kmemstats" to "struct malloc_type" it makes more sense now.
Fix type argument to hashinit() and phashinit()
1997-10-10 18:14:23 +00:00
Poul-Henning Kamp 254c6cb330 Make malloc more extensible. The malloc type is now a pointer to
the struct kmemstats that describes the type.

This allows subsystems to declare their malloc types locally
and <sys/malloc.h> doesn't need tweaked everytime somebody
gets an idea.  You can even have a type local to a lkm...

I don't know if we really need the longdesc, comments welcome.

TODO: There is a single nit in ext2fs, that will be fixed later,
and I intend to remove all unused malloc types and distribute
the rest closer to their use.
1997-10-10 14:06:34 +00:00
Peter Wemm b67dffdad2 Compensate for pcb.h tweaks.
(Bruce pointed out the nesting)
1997-10-10 12:42:54 +00:00
Peter Wemm 98823b2366 Convert the VM86 option from a global option to an option only depended
on by the files that use it.  Changing the VM86 option now only causes
a recompile of a dozen files or so rather than the entire kernel.
1997-10-10 09:44:12 +00:00
John Dyson a624e84fff Major cleanup and debugging of the new AIO/LIO code. The LIO code is
now corrected.  New tunables/instrumentation added.  The code is now
likely "good enough to use."  I will add the userland support soon.
The "high performance" mode for raw devices is still missing, and will
be added next.  POSIX system calls that now appear to work:
aio_cancel, aio_error, aio_read, aio_return, aio_suspend, aio_write,
lio_listio.  Missing, but to be added soon: aio_fsync.
1997-10-09 04:14:41 +00:00
Peter Wemm 115526d03e Ack! Fix excessive cut/paste blunder during poll mods. Who had the
pointy hat last? :-]

When one is selecting (or polling) for write, it helps if we use the
write side of the pipe when requesting wakeups instead of the read side.
This broke ghostview (at least) - I'm suprised it wasn't noticed for
so long.

Reviewed by:  Greg Lehey <grog@lemis.com>
1997-10-06 08:30:08 +00:00
Nate Williams fd35ecc322 - Hide the 'device doesn't supported shared interrupts' code behind
bootverbose, since the older register_intr() code didn't print out
  anything, and the laptop support will cause lots of these un-necessary
  messages.
1997-10-06 04:27:32 +00:00
John Dyson e7b0208f61 Relax the vnode locking for read only operations. 1997-10-06 02:38:30 +00:00
John Dyson 42c0de4926 It is possible that MB's with really broken bios's not set up more of
the mtrr registers.  This just fills in more of the registers.
1997-10-06 02:11:32 +00:00
John Dyson c63ba9f5ae Make sure that the memory type registers are the same for each CPU
in a P6 SMP system.  Some MB bios'es don't set the registers up correctly
for the AP's.  Additionally, set the memory between 0xa0000 and 0xbffff
as write combining.
1997-10-05 03:19:29 +00:00
Poul-Henning Kamp eabecea346 While booting diskless we have no proc pointer. 1997-10-04 18:21:15 +00:00
Poul-Henning Kamp ad324c8891 Fix handling of nested mountpoints in __getcwd()
Detected by:	Simon Shapiro <Shimon@i-Connect.Net>
1997-09-28 06:37:02 +00:00
Joerg Wunsch 91f7577b37 Hide the `no magic' babble behind bootverbose, since it has proven to
be too much magic for 99.9 % of the users.
1997-09-27 15:34:34 +00:00
KATO Takenori 81bca6ddae Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW
   bits of the mnt_flag.  The sysctl variables, vfs.foo.doclusterread
   and vfs.foo.doclusterwrite are deleted.  Only mount option can
   control clustered I/O from userland.
2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR
   and D_CLUSTERW bits of the d_flags member in the block device switch
   table.  If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR /
   MNT_NOCLUSTERW bits will be set.  In this case, MNT_NOCLUSTERR and
   MNT_NOCLUSTERW cannot be cleared from userland.
3. Vnode driver disables both clustered read and write.
4. Union filesystem disables clutered write.

Reviewed by:	bde
1997-09-27 13:40:20 +00:00
Poul-Henning Kamp d047b580c6 I lost a bit of my change in the last commit, this is more like it.
Noticed by:	bde
1997-09-26 08:08:58 +00:00
Poul-Henning Kamp 87b1940afa Reduce the target number of vnodes on the freelist from desiredvnodes
(usually a couple of thousand) to 25.  The measured impact on cache-hits
doesn't justify spending memory this way:

Target number of free vnodes versus namecache hit rate in % during a
make world:
          10    98.5316
         200    98.5479
         500    98.5546
        1000    98.5709
        3000    98.6006
        4000    98.6126
1997-09-25 16:17:57 +00:00
Justin T. Gibbs 453276111e Store an absolute tick value in callout entries so that a subtraction on
hash chain traversal isn't needed.  This also allows untimeout to recompute
the hash to find the bucket that the entry to remove is stored in so
that each callout entry no longer needs to store that information.

Reviewed by:	 Nate Williams <nate@mt.sri.com>
1997-09-24 16:39:27 +00:00
Poul-Henning Kamp 46c320bab8 Add one more counter so we can truly find out how good our name cache
is.  If we don't find something and don't what to have found something,
it's actually a success.
1997-09-24 15:54:10 +00:00
Poul-Henning Kamp 0054419366 A couple of handles to tweak, more statistics. 1997-09-24 07:46:54 +00:00
Julian Elischer e29b30aa7d urk, fix spelling error in comment I just fixed. 1997-09-21 22:20:12 +00:00
Julian Elischer 4010d6d962 Fix a comment. 1997-09-21 22:14:54 +00:00
Justin T. Gibbs 14d9217731 Convert tqdisksort to bufqdisksort. Honor the B_ORDERED buffer flag
so that meta-data writes go out to the device in the right order.
1997-09-21 22:10:49 +00:00
Justin T. Gibbs ab36c06737 init_main.c subr_autoconf.c:
Add support for "interrupt driven configuration hooks".
	A component of the kernel can register a hook, most likely
	during auto-configuration, and receive a callback once
	interrupt services are available.  This callback will occur before
	the root and dump devices are configured, so the configuration
	task can affect the selection of those two devices or complete
	any tasks that need to be performed prior to launching init.
	System boot is posponed so long as a hook is registered.  The
	hook owner is responsible for removing the hook once their task
	is complete or the system boot can continue.

kern_acct.c kern_clock.c kern_exit.c kern_synch.c kern_time.c:
	Change the interface and implementation for the kernel callout
	service.  The new implemntaion is based on the work of
	Adam M. Costello and George Varghese, published in a technical
	report entitled "Redesigning the BSD Callout and Timer Facilities".
	The interface used in FreeBSD is a little different than the one
	outlined in the paper.  The new function prototypes are:

	struct callout_handle timeout(void (*func)(void *),
				      void *arg, int ticks);

	void untimeout(void (*func)(void *), void *arg,
		       struct callout_handle handle);

	If a client wishes to remove a timeout, it must store the
	callout_handle returned by timeout and pass it to untimeout.

	The new implementation gives 0(1) insert and removal of callouts
	making this interface scale well even for applications that
	keep 100s of callouts outstanding.

	See the updated timeout.9 man page for more details.
1997-09-21 22:00:25 +00:00
Justin T. Gibbs 919429034e autoconf.c:
Add cpu_rootconf and cpu_dumpconf so that configuring these
	two devices can be better controlled by the MI configuration
	code.

machdep.c:
	MD initialization code for the new callout interface.

trap.c:
	Add support for printing out whether cam interrupts are masked
	during a panic.
1997-09-21 21:38:05 +00:00
Peter Wemm dfd5aef3a8 Implement the parts needed for VM86 under SMP. 1997-09-21 15:03:59 +00:00
John Dyson a65247e12c Add support for more than 1 page of idle process stack on SMP systems. 1997-09-21 05:50:02 +00:00
John Dyson 804cd17e21 Re-institute a bugfix in allocation of anonymous buffer memory. 1997-09-21 04:49:30 +00:00
John Dyson 99448ed11d Change the M_NAMEI allocations to use the zone allocator. This change
plus the previous changes to use the zone allocator decrease the useage
of malloc by half.  The Zone allocator will be upgradeable to be able
to use per CPU-pools, and has more intelligent usage of SPLs.  Additionally,
it has reasonable stats gathering capabilities, while making most calls
inline.
1997-09-21 04:24:27 +00:00
Peter Wemm 1560a9d538 We were (I think) missing a vrele() on the vnode for the object loaded
via PT_INTERP (usually /usr/libexec/ld-elf.so.1).
1997-09-21 03:13:21 +00:00
Bruce Evans 043a2f3b8b Fixed staticization. buckets[] was staticized but was still declared
extern in <sys/malloc.h> and it should not have been staticized for
the !(KMEMSTATS || DIAGNOSTIC) case.

Fixed the !(KMEMSTATS || DIAGNOSTIC) case.  The MALLOC() and FREE()
macros are evil, but code generally doesn't allow for this and some code
involving else clauses did not compile.

Finished staticization.
1997-09-16 13:52:04 +00:00
Bruce Evans 514ede0953 Fixed gratuitous ANSIisms. 1997-09-16 11:44:05 +00:00
Bruce Evans 0e6021ad31 Reject attempts to set an in-core label which says that the "disk"
or a partition is larger than the slice.

Now `disklabel -Brw sdX auto' should fail properly on sliced disks
without partition of type 165, e.g., on zip disks with the factory
default formatting.  Previously it set a bogus in-core label for
the compatibility slice and used this to corrupt the MBR (the slice
has offset 0 and size 0, but setting the label in effect corrupted
its size to nonzero).

`disklabel -Brw sdX auto' already failed properly on normally (not
dangerously dedicated) sliced disks _with_ partition of type 165,
because the compatibility slice has a nonzero offset so the MBR
remained inaccessible when the size was corrupted.

This bug only affected in-core labels.  On-disk labels are checked
carefully when they read and written.
1997-09-16 10:11:49 +00:00
Poul-Henning Kamp 044839fb8b Don't leak memory, from sef.
Stylistic nits and a blunder, from bde.
1997-09-16 08:05:09 +00:00
Poul-Henning Kamp 7874d7a3bb Solve race-condition, return path in normal order.
A couple of stylistic nits from Bruce.

If your libc contains version 1.11 or 1.12 of getcwd.c, (ie: if
you recompiled libc one of the last couple of days):
>>> Recompile LIBC before you boot a new kernel <<<
A new libc will deal with both old and new kernels.
1997-09-15 19:11:07 +00:00
Poul-Henning Kamp d56f6402d5 Deal more correctly with mountpoints. 1997-09-15 08:25:43 +00:00
Peter Wemm 921af254ca Regenerate _after_ the commit to syscalls.master 1997-09-15 02:03:45 +00:00
Poul-Henning Kamp 7822f1c624 Add a __getcwd() syscall. This is intentionally undocumented, but all
it does is to try to figure the pwd out from the vfs namecache, and
return a reversed string to it.  libc:getcwd() is responsible for
flipping it back.
1997-09-14 16:51:31 +00:00
Peter Wemm 35b8b2ddab Update select -> poll in drivers. 1997-09-14 03:19:42 +00:00
Peter Wemm 51338ea83c Various select -> poll changes 1997-09-14 02:52:18 +00:00
Peter Wemm a2f9bc72c1 vn_select -> vn_poll 1997-09-14 02:51:16 +00:00
Peter Wemm d87652c3de Zap nxselect and noselect. 1997-09-14 02:50:28 +00:00
Peter Wemm 7fab77996c Provide a 'return true' poll vnode op rather than duplicating the
'do nothing' case all over the various filesystems.
1997-09-14 02:49:06 +00:00
Peter Wemm 1514b90f2d Extend select hook to support poll 1997-09-14 02:46:44 +00:00
Peter Wemm d080b0b0be Implement the poll backend for the pipe file type. 1997-09-14 02:43:25 +00:00
Peter Wemm 659ffb486a Convert select handler to poll style 1997-09-14 02:42:03 +00:00
Peter Wemm 6183953301 Extend to use poll backend. If memory serves correctly, most of this was
adapted from NetBSD..  However, there are some differences in the tty
system that are big enough to cause their code to not fit comfortably.

Obtained from:  NetBSD (I think)
1997-09-14 02:40:46 +00:00
Peter Wemm 6b8e64f55f Change VOP_SELECT to VOP_POLL 1997-09-14 02:35:25 +00:00
Peter Wemm e25aa68e0c Extend select backend for sockets to work with a poll interface (more
detail is passed back and forwards).  This mostly came from NetBSD, except
that our interfaces have changed a lot and this funciton is in a different
part of the kernel.

Obtained from: NetBSD
1997-09-14 02:34:14 +00:00
Peter Wemm 42d1175732 Implement poll(2). This is mostly taken from the NetBSD implementation
(from some time ago) but with a few tweaks along the way.

Obtained from: NetBSD
1997-09-14 02:30:32 +00:00
Peter Wemm 818661c8f6 Regenerate (added poll etc) 1997-09-14 02:23:46 +00:00
Peter Wemm 8cb0553a7c Activate poll(2) syscall 1997-09-14 02:22:05 +00:00
Joerg Wunsch 245f17d43c Implement SA_NOCLDWAIT.
The implementation is done (unlike what i've originally been
contemplating) by reparenting kids of processes that have the
appropriate bit set to PID 1, and let PID 1 handle the zombie.  This
is far less problematical than what would seem to be ``doing it
right'', for a number of reasons.

Of our currently shipping PID-1-intended programs, 50 % fail the above
assumption. ;-)  (Read this: sysinstall doesn't do it right.  This is
no problem as long as no program called by sysinstall actually uses
SA_NOCLDWAIT.)

ToDo:		. clarify the correct SA_* flag inheritance, compared
		  to other systems,
		. decide whether the compat cruft (osigvec(9)) should
		  deal with new system additions or not,
		. merge OpenBSD's SA_SIGINFO implementation. ;)
Reviewed by:	bde
1997-09-13 19:42:29 +00:00
Peter Wemm 557fe2c5e1 print correct function name in a panic (vop_nolock -> vop_sharedlock) 1997-09-13 15:02:28 +00:00
Poul-Henning Kamp bf1d104a34 3 lines of code and updates to a number of comments.
Reviewed by:	phk
Submitted by:	 Terry Lambert <tlambert@primenet.com>
1997-09-10 20:11:02 +00:00
Poul-Henning Kamp c1f95f1378 The patch is needed in order to not throw away unmodified
local filesystem metadata at the first brelse call when the
block device vnode has v_tag set to VT_NFS.

Reviewed by:	phk
Submitted by:	Tor Egge <tegge@idi.ntnu.no>
1997-09-10 20:09:22 +00:00
Steve Passe 20233f27f4 General cleanup of the lock pushdown code. They are grouped and enabled
from machine/smptests.h:

#define PUSHDOWN_LEVEL_1
#define PUSHDOWN_LEVEL_2
#define PUSHDOWN_LEVEL_3
#define PUSHDOWN_LEVEL_4_NOT
1997-09-07 22:04:09 +00:00
Bruce Evans 2d85d0df17 Some staticized variables were still declared to be extern. 1997-09-07 16:56:34 +00:00
Bruce Evans 2931901b1d Removed trailing semicolons from the definitions of the sysctl
declaration macros so that a semicolon can be added when the macros
are invoked without giving a (pedantic) syntax error.  Invocations
need to be followed by a semicolon so that programs like indent and
gtags don't get confused.

Fixed the one invocation that wasn't followed by a trailing semicolon.
1997-09-07 16:53:52 +00:00
Bruce Evans 41fadeeb28 Removed yet more vestiges of config-time swap configuration and/or
cleaned up nearby cruft.
1997-09-07 16:21:11 +00:00
Bruce Evans a910e75cdc Removed vestiges of config-time "argument processing" configuration. 1997-09-07 13:49:56 +00:00
Bruce Evans bea0f0be7b Some staticized variables were still declared to be extern. 1997-09-07 05:27:26 +00:00
Peter Wemm 279a69322c Cosmetic adjustment for the trap/double fault/panic cpu id listing.
It now prints the apic id in hex rather than decimal.
1997-09-05 08:54:55 +00:00
Tor Egge 882e68c8a9 sonewconn no longer passes curproc to the protocol attach method
since that might cause in_pcballoc to call MALLOC with M_WAITOK during
a software interrupt.
Reviewed by:	Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
1997-09-04 17:39:16 +00:00
Poul-Henning Kamp 4d1122bdd6 Revert to the previous hashing, double the hashtable size instead. 1997-09-04 08:24:44 +00:00
Poul-Henning Kamp fd9d9ff13e Hmm, this is hopefully better. 1997-09-03 13:29:41 +00:00
Poul-Henning Kamp 119b6f4cf2 Use 2^N hash sizes rather than primesize, this replaces a division
with an and. (Submitted by davidg)

Preemptively record ".." values.

Reviewed by:	phk
1997-09-03 09:20:17 +00:00
Poul-Henning Kamp 7cb22688e9 Revert the v_usecount handling in relation to VOP_INACTIVE. 1997-09-03 09:18:48 +00:00
Bruce Evans e4ba6a82b0 Removed unused #includes. 1997-09-02 20:06:59 +00:00
Bruce Evans 4d1d4912ae Added used #include - don't depend on <sys/mbuf.h> including
<sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags).
1997-09-02 01:19:47 +00:00
Steve Passe 7245dff0f1 Cleanup. 1997-09-01 07:31:54 +00:00
Bruce Evans e28b96049b Move closer to supporting VM86 under SMP.
LINT now compiles but doesn't link.  Other link-time breakage for LINT
is now visible (SMP is incompatible with SIMPLELOCK_DEBUG).
Submitted by:	jlemon
1997-09-01 01:54:52 +00:00
Bruce Evans 6d58e6cbc4 Fixed options SHOW_BUSYBUFS and PANIC_REBOOT_WAIT_TIME which were broken
by incomplete cutting and pasting from machdep.c to kern_shutdown.c.

PR:		3953
1997-08-31 23:08:38 +00:00
Poul-Henning Kamp a051452ae2 Change the 0xdeadb hack to a flag called VDOOMED.
Introduce VFREE which indicates that vnode is on freelist.
Rename vholdrele() to vdrop().
Create vfree() and vbusy() to add/delete vnode from freelist.
Add vfree()/vbusy() to keep (v_holdcnt != 0 || v_usecount != 0)
  vnodes off the freelist.
Generalize vhold()/v_holdcnt to mean "do not recycle".
Fix reassignbuf()s lack of use of vhold().
Use vhold() instead of checking v_cache_src list.
Remove vtouch(), the vnodes are always vget'ed soon enough
  after for it to have any measuable effect.
Add sysctl debug.freevnodes to keep track of things.
Move cache_purge() up in getnewvnodes to avoid race.
Decrement v_usecount after VOP_INACTIVE(), put a vhold() on
  it during VOP_INACTIVE()
Unmacroize vhold()/vdrop()
Print out VDOOMED and VFREE flags (XXX: should use %b)

Reviewed by:		dyson
1997-08-31 07:32:39 +00:00
Steve Passe 2645264a72 Debug version of simple_lock. This will store the CPU id of the
holding CPU along with the lock.  When a CPU fails to get the lock
it compares its own id to the holder id.  If they are the same it
panic()s, as simple locks are binary, and this would cause a deadlock.

Controlled by smptests.h: SL_DEBUG, ON by default.

Some minor cleanup.
1997-08-31 03:17:48 +00:00
Steve Passe 78292efeef Another round of lock pushdown.
Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel.
UP kernel expects that this is enough to guarantee exclusive access to
regions of code bracketed by these 2 functions.
Add a simplelock to bracket clock accesses in clock.c: clock_lock.

Help from:	Bruce Evans <bde@zeta.org.au>
1997-08-30 08:08:10 +00:00
KATO Takenori 662f9a6987 Move MACHINE_ARCH definition from <machine/param.h> to <machine/cpu.h>.
Submitted by:	Bruce Evans <bde@zeta.org.au>
1997-08-30 02:52:04 +00:00
KATO Takenori 664f85174a Added a sysctl arg, hw.machine_arch. The hw.machine_arch is "ibm-pc"
on IBM-PC box and is "pc-98" on NEC PC-98 box.  Userland program can
distinguish architecture on which the program runs.
1997-08-29 09:03:40 +00:00
Jonathan Lemon 5f07393373 Remove the vm86 support as an LKM, and link it directly into the kernel
if 'options "VM86"' is in the config file.  The LKM was really for
development, and has probably outlived its usefulness.
1997-08-28 14:36:56 +00:00
Peter Wemm 90bcb528a8 Correct some things I forgot about until it was too late with smp_active.
smp_active = 1 used to indicate that the system had frozen previously
started AP's, while smp_active = 0 was "AP's not yet started".  I have split
this into smp_started (which is set when the AP's come online), and
smp_active is left for turning on/off AP scheduling.
1997-08-26 18:36:15 +00:00
Peter Wemm 9a3b3e8bce Clean up the SMP AP bootstrap and eliminate the wretched idle procs.
- We now have enough per-cpu idle context, the real idle loop has been
revived (cpu's halt now with nothing to do).
- Some preliminary support for running some operations outside the
global lock (eg: zeroing "free but not yet zeroed pages") is present
but appears to cause problems.  Off by default.
- the smp_active sysctl now behaves differently. It's merely a 'true/false'
option.  Setting smp_active to zero causes the AP's to halt in the idle
loop and stop scheduling processes.
- bootstrap is a lot safer.  Instead of sharing a statically compiled in
stack a number of times (which has caused lots of problems) and then
abandoning it, we use the idle context to boot the AP's directly.  This
should help >2 cpu support since the bootlock stuff was in doubt.
- print physical apic id in traps.. helps identify private pages getting
out of sync.  (You don't want to know how much hair I tore out with this!)

More cleanup to follow, this is more of a checkpoint than a
'finished' thing.
1997-08-26 18:10:38 +00:00
Bruce Evans d3114049c1 Restored rev.1.92 which was clobbered by the previous commit. 1997-08-26 11:59:20 +00:00
Poul-Henning Kamp 0fa2443f0e Uncut&paste cache_lookup().
This unifies several times in theory indentical 50 lines of code.

The filesystems have a new method: vop_cachedlookup, which is the
meat of the lookup, and use vfs_cache_lookup() for their vop_lookup
method.  vfs_cache_lookup() will check the namecache and pass on
to the vop_cachedlookup method in case of a miss.

It's still the task of the individual filesystems to populate the
namecache with cache_enter().

Filesystems that do not use the namecache will just provide the
vop_lookup method as usual.
1997-08-26 07:32:51 +00:00
John Dyson a5db4bf475 Back out some incorrect changes that was worse than the original bug. 1997-08-26 04:36:27 +00:00
Bruce Evans 7d7fb492c5 Don't return EINVAL for negative timespecs in the nanosleep functions.
Negative timespecs are perfectly valid.  Just return 0 immediately
for them.  Also, return 0 immediately for zero timespecs.

Fixed some style bugs.
1997-08-26 00:40:04 +00:00
Bruce Evans 8a2d9f5076 Finished staticizing. 1997-08-26 00:31:04 +00:00
Bruce Evans 9a629c9302 Fixed some formatting and style bugs.
Fixed a gratuitous ANSIism.
1997-08-26 00:24:25 +00:00
Bruce Evans 1d9655ae4d Print more info in the "calcru: negative time" message. 1997-08-26 00:20:11 +00:00
Bruce Evans eb776aea19 Fixed some gratuitous ANSIisms. 1997-08-26 00:15:04 +00:00
Bruce Evans 32545fd108 Removed some stale comments.
Fixed a gratuitous ANSIism.
1997-08-26 00:09:44 +00:00
Bruce Evans 282ec22c77 Removed redundant test against MAXDSIZ (the rlimit test is stronger). 1997-08-26 00:02:24 +00:00
Bruce Evans 2a2968a896 Removed a bogus comment. 1997-08-25 21:28:08 +00:00
Poul-Henning Kamp c049f06469 Add a new vnode op (cachedlookup) so that filesystems can plug into
a global vfs_cache check.  The rest of this change will come when the
current zero size file problem is resolved.
1997-08-25 20:28:49 +00:00
Steve Passe 8ee0110a44 A clean fix for the spl "deadlock before smp_active" problem.
Added a new variable, 'bsp_apic_ready', which is set as soon as the bootstrap
CPU has initialized its local APIC.  Conditionalize the GENSPLR functions
to call ss_lock ONLY after bsp_apic_ready is TRUE;  This should prevent
any problems with races between the time the 1st AP becomes ready and the
time smp_active is set.
1997-08-24 20:33:32 +00:00
Peter Wemm e384a9801e Print a warning if an unsupported (under SMP) shared address space fork
is attempted rather than just failing with an errno.
1997-08-22 15:10:00 +00:00