Commit Graph

2807 Commits

Author SHA1 Message Date
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