Commit Graph

2872 Commits

Author SHA1 Message Date
Poul-Henning Kamp
91266b96c4 Isolate the Timecounter internals in their own two files.
Make the public interface more systematically named.

Remove the alternate method, it doesn't do any good, only ruins performance.

Add counters to profile the usage of the 8 access functions.

Apply the beer-ware to my code.

The weird +/- counts are caused by two repocopies behind the scenes:
	kern/kern_clock.c -> kern/kern_tc.c
	sys/time.h -> sys/timetc.h
(thanks peter!)
2000-03-20 14:09:06 +00:00
Poul-Henning Kamp
ce6acbb664 diff, patch and cvs didn't like these three last time around, try again. 2000-03-20 12:34:21 +00:00
Poul-Henning Kamp
b99c307a21 Rename the existing BUF_STRATEGY() to DEV_STRATEGY()
substitute BUF_WRITE(foo) for VOP_BWRITE(foo->b_vp, foo)

substitute BUF_STRATEGY(foo) for VOP_STRATEGY(foo->b_vp, foo)

This patch is machine generated except for the ccd.c and buf.h parts.
2000-03-20 11:29:10 +00:00
Poul-Henning Kamp
21144e3bf1 Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd.  The b_iocmd is enforced to have
exactly one bit set.

B_WRITE was bogusly defined as zero giving rise to obvious coding
mistakes.

Also eliminate the redundant struct buf flag B_CALL, it can just
as efficiently be done by comparing b_iodone to NULL.

Should you get a panic or drop into the debugger, complaining about
"b_iocmd", don't continue.  It is likely to write on your disk
where it should have been reading.

This change is a step in the direction towards a stackable BIO capability.

A lot of this patch were machine generated (Thanks to style(9) compliance!)

Vinum users:  Greg has not had time to test this yet, be careful.
2000-03-20 10:44:49 +00:00
Bill Fenner
95b2b777b5 Make sure to free the socket in soabort() if the protocol couldn't
free it (this could happen if the protocol already freed its part
 and we just kept the socket around to make sure accept(2) didn't block)
2000-03-18 08:56:56 +00:00
Chris Costello
b081a64afb In vn_isdisk(), check whether vp->v_rdev is NULL. If it is, then
return ENXIO (Device not configured).  Without this, vn_isdisk()
could (and did in the case of lstat() under fdesc) pass a NULL pointer
to devsw(), which caused a page fault.

Reviewed by:	alfred
2000-03-18 01:27:44 +00:00
Nick Hibma
846664235c Instead of using the next unit available, use the first unit available.
This avoids the unit number from going up indefinitely when
diconnecting and connecting 2 devices alternately.

Noticed by: nsayer (quite a while ago)

And stop calling DEVICE_NOMATCH at probe repeatedly. This stops the
message on the PCI VGA board from being printed when loading a PCI driver.
2000-03-16 09:32:59 +00:00
Poul-Henning Kamp
db5f635acc Eliminate the undocumented, experimental, non-delivering and highly
dangerous MAX_PERF option.
2000-03-16 08:51:55 +00:00
Jun Kuriyama
dc76063419 Print "previous type" correctly when INVARIANTS is defined.
Reviewed by:	current@FreeBSD.org
2000-03-14 14:58:04 +00:00
Bruce Evans
05ecdd7037 Don't try so hard to make the lower 16 bits of fsids unique. It tended
to recycle full fsids after only 16 mount/unmount's.  This is probably
too often for exported fsids.  Now we recycle the full fsids only
after 2^16 mount/ umount's and only ensure uniqueness in the lower 16
bits if there have been <= 256 calls to vfs_getnewfsid() since the
system started.
2000-03-14 14:19:49 +00:00
Brian S. Dean
56fc73ff9b In 'ipcperm()', only call 'suser()' if it is actually required.
Previously, it was being called whether it was needed or not and the
ASU flag was being set (as a side affect of calling 'suser()') in
cases where superuser privileges were not actually needed.  This was
all pointed out to me by Bruce Evans.

Reviewed by:	bde
2000-03-13 23:00:08 +00:00
Poul-Henning Kamp
7de472559c Remove unused 3rd argument from vsunlock() which abused B_WRITE. 2000-03-13 10:47:24 +00:00
Bruce Evans
61214975da Try harder to make the lower 16 bits of fsids unique. The vfs type
number was packed very wastefully, giving perfect non-uniqeness in
the lower 16 bits of fsids for filesystems with the same vfs type.
This made linux_stat() return perfectly non-unique (broken) 16-bit
st_dev's for nfs mount points, and effectively reduced mntid_base to
8 bits so that the vfs_getnewfsid() looped endlessly when there are
already 256 mounted filesystems with the required vfs type.

Approved by:	jkh
2000-03-12 14:23:21 +00:00
Alan Cox
af25d10c91 shmat: If VM_PROT_READ_IS_EXEC is defined and prot includes VM_PROT_READ,
VM_PROT_EXECUTE must be added to prot before calling vm_map_find.

Without this change, an mprotect on a shmat'ed region fails (when
it shouldn't).  This bug was reported Feb 28 by Brooks Davis
<brooks@one-eyed-alien.net> on -hackers.

Reviewed by:	bde
Approved by:	jkh
2000-03-10 09:11:24 +00:00
Yoshinobu Inoue
8692c02553 Enable SCM_RIGHTS on alpha. Allocate necessary buffer as conversion between
int and struct file *.

Approved by: jkh

Submitted by: brian
Reviewed by: bde, brian, peter
2000-03-09 15:15:27 +00:00
Bruce Evans
a4fcac54a1 Fixed a null pointer panic for dumpon(8) on a nonexistent device whose
driver uses the new disk layer.

Reviewed by:	phk
Approved by:	jkh
2000-03-09 12:40:41 +00:00
Yoshinobu Inoue
7d0d8dc306 CMSG_XXX macros alignment fixes to follow RFC2292.
Approved by: jkh

Submitted by: Partly from tech@openbsd
Reviewed by: itojun
2000-03-03 11:13:12 +00:00
Peter Dufault
6d9a8d3e8f I applied the wrong patch set. Back out anything associated
with the known bogus currtpriority.  This undoes the previous changes to
sys/i386/i386/trap.c, sys/alpha/alpha/trap.c, sys/sys/systm.h

Now we have the patch set approved by bde.

Approved by:	bde
2000-03-02 22:03:49 +00:00
Peter Dufault
383774c417 Patches that eliminate extra context switches in FIFO case.
Fixes p1003_1b regression test in the simple case of no RR and
FIFO processes competing.

Reviewed by:	jkh, bde
2000-03-02 16:20:07 +00:00
Brian S. Dean
e777d9c31a Fix a superuser credential check.
Reviewed by:	phk
Approved by:	jkh
2000-02-29 22:58:59 +00:00
Doug Rabson
1d9a6ae08b If a driver probe fails, unset it from the device. This fixes a problem
with certain multiport cards.

Approved by: jkh
2000-02-29 09:36:25 +00:00
Paul Saab
77ac690c97 Update a comment in elf_coredump to reflect that if you madvise
with MADV_NOCORE, its address space is also excluded from a core
file.

Pointed out by:	alc
2000-02-28 06:36:45 +00:00
Paul Saab
9730a5daab Add MAP_NOCORE to mmap(2), and MADV_NOCORE and MADV_CORE to madvise(2).
This
This feature allows you to specify if mmap'd data is included in
an application's corefile.

Change the type of eflags in struct vm_map_entry from u_char to
vm_eflags_t (an unsigned int).

Reviewed by:	dillon,jdp,alfred
Approved by:	jkh
2000-02-28 04:10:35 +00:00
Jordan K. Hubbard
8d0bf3d6f8 Add new oid, debug.boothowto. This allows userland apps to see
how the kernel was booted and perhaps do conditional things
based upon it (sysinstall, for example, will now turn Debug mode
on automatically if boot -v was done).

Submitted by:	msmith
Suggested by:	ulf
2000-02-25 11:43:08 +00:00
Yoshinobu Inoue
0b97e97cd2 Add length check to sbcreatecontrol().
Now this check is necessary because IPv6 source routing might use
  control data bigger than MLEN. (e.g. 16bytes IPv6 addr x 23 hops)
  Actually mbuf cluster should be used in uipc_socket.c:sbcreatecontrol()
  and uipc_syscalls.c:sockargs() when data size is bigger then MLEN,
  and such patches were already in KAME environment and have been
  confirmed to work well. I just forgot to merge them into 4.0, sorry.

  For safety, I'll postpone such patches until after 4.0 release.
  The effect of postponement is followings.
    -Ping6 source routing hops are limitted to around 6 or so.
    -If some apps do setsockopt IPV6_RTHDR and try to receive
     incoming IPv6 source routing info, it can't receive more
     than 6 hops source routing info.
     (But currently, no apps seems to be doing it.)

Approved by: jkh
2000-02-24 19:21:26 +00:00
Jason Evans
dd85920a4f Add the VFS_AIO config option and leave it off by default. Unless the
VFS_AIO option is specified, all aio-related syscalls return ENOSYS.

The aio code is very fragile right now, and is unsuitable for default
inclusion in a production shell box.

Approved by:	jkh
2000-02-23 07:44:25 +00:00
Brian S. Dean
de8050f9b8 Don't forget to reset the hardware debug registers when a process that
was using them exits.

Don't allow a user process to cause the kernel to take a TRCTRAP on a
user space address.

Reviewed by:	jlemon, sef
Approved by:	jkh
2000-02-20 20:51:23 +00:00
Peter Wemm
f082218c18 Fix select(2) for the Alpha. (!!) It was never returning true for
fd's in the range of 32-63, 96-127 etc.  The first problem was the
FD_*() macros were shifting a 32 bit integer "1" left by more than
32 bits.  The same problem happened in selscan().  ffs() also takes
an int argument and causes failure.  For cases where int == long
(ie: the usual case for x86, but not always as gcc can have long
being a 64 bit quantity) ffs() could be used.

Reported by:	Marian Stagarescu <marian@bile.skycache.com>
Reviewed by:	dfr, gallatin (sys/types.h only)
Approved by:	jkh
2000-02-20 13:36:26 +00:00
Søren Schmidt
a6e23e28c1 Hide the "devclass_alloc_unit: %s%d already exists, using next available..."
behind bootverbose

Approved by: jkh
2000-02-20 10:07:28 +00:00
Søren Schmidt
47351d2774 Update the ata driver to take more advantage of newbus, this
was needed to make attach/detach of devices work, which is
needed for the PCCARD support.
(PCCARD support is still not working though, more to come on that)

Support the CMD646 chip which is used on many alphas, sadly only
in WDMA2 mode, as the silicon is broken beyond belief for UDMA modes.

Lots of cosmetic fixes here and there.

Sorry for the size of this megapatchfromhell but it was not
possible otherwise...

newbus patches based on work from: dfr (Doug Rabson)
2000-02-18 20:57:33 +00:00
Mike Smith
bb328b87c1 Change the mountroot prompt to something that doesn't look at all like a
firmware prompt.  Several sleepy folk mistook the '>>>' for the SRM
prompt, which was never the desired idea.

Submitted by:	Andrew Gallatin <gallatin@cs.duke.edu>
Approved by:	jkh
2000-02-17 23:32:08 +00:00
Matthew Dillon
1f6889a1eb Fix null-pointer dereference crash when the system is intentionally
run out of KVM through a mmap()/fork() bomb that allocates hundreds
    of thousands of vm_map_entry structures.

    Add panic to make null-pointer dereference crash a little more verbose.

    Add a new sysctl, vm.max_proc_mmap, which specifies the maximum number
    of mmap()'d spaces (discrete vm_map_entry's in the process).  The value
    defaults to around 9000 for a 128MB machine.  The test is scaled for the
    number of processes sharing a vmspace (aka linux threads).  Setting
    the value to 0 disables the feature.

PR: kern/16573
Approved by: jkh
2000-02-16 21:11:33 +00:00
Joerg Wunsch
2c6610f343 Hide the boring `not probed (disabled)'' messages behind bootverbose'.
This unspams the boot messages, concentrating on the drivers that have
actually been probed.

This basically resurrects revision 1.106 from old /sys/i386/isa/isa.c.

Reviewed by:	jkh, dfr
2000-02-15 19:23:34 +00:00
Poul-Henning Kamp
693e27d473 Don't try to account for the partial quantum unless the process is
curproc.  This only makes any difference on SMP, where we used a
(potentially very bogus) switchtime from our own CPU to calculate
resource usage on another CPU.

This should remove some if not all calcru() related warnings on SMP.

Approved by:		jkh
2000-02-15 09:02:07 +00:00
Martin Cracauer
30de91e8b8 Allow comments in interpreter specification lines as in
#! /bin/sh # -*- perl -*-

This is simply "delete everything after the next '#', not counting the
first char in the line". No effort has been made to allow quoting,
backslash escaping or '#' in interpreter names.

The complies to POSIX 1003.2 in that Posix says the implementation is
free to choose whatever it likes.

PR:		bin/16393
2000-02-15 08:49:57 +00:00
Peter Wemm
194a0b6c97 Avoid a panic in __getcwd(2) when combined with umount -f. 2000-02-14 06:09:01 +00:00
Poul-Henning Kamp
f1220da49c Fix sign reversal in adjtime(2).
Approved by:	jkh
2000-02-13 10:56:32 +00:00
Robert Watson
83f1e257e0 Yet-another-update: rename ``kern.prison'' to a new sysctl root entry,
``jail'', and move the set_hostname_allowed sysctl there, as well as
fixing a bug in the sysctl that resulted in jails being over-limited
(preventing them from reading as well as writing the hostname).  Also,
correct some formatting issues, courtesy bde :-).

Reviewed by:	phk
Approved by:	jkh
2000-02-12 13:41:56 +00:00
Robert Watson
5bdee2c5d5 Fix sysctl namespace for jail: move the kern.jailcansethostname to
kern.prison.set_hostname_allowed, off of the kern.prison node.  Future
jail twiddles should be placed in this namespace.
2000-02-10 18:51:58 +00:00
Robert Watson
6c144e7521 Introduce a new sysctl, kern.jailcansethostname, which determines whether
or not a process in a jail, with privilege, may set the jail's hostname.
Defaults to 1, which permits this.  May be set to 0 by a process with
appropriate privilege outside of jail.  Preventing hostname renaming
from within a jail is currently required to make jails manageable, as they
a currently identifiable only by hostname using /proc, which may be
modified without this sysctl being set to 0.  This will be documented
in upcoming man commits.

Authorized by:	jkh, the ever-patient
2000-02-10 05:32:03 +00:00
Robert Watson
35a0a88fda Correct an oversight in jail() that allowed processes in jail to access
ptys in ways that might be unethical, especially towards processes not in
jail, or in other jails.

Submitted by:	phk
Reviewed by:	rwatson
Approved by:	jkh
2000-02-09 03:32:11 +00:00
Poul-Henning Kamp
9b6d9dba20 Also allow non-rot processes to setproctitle()
Submitted by:	Paul Saab <paul@mu.org>
Approved by:	jkh
2000-02-08 19:54:15 +00:00
Søren Schmidt
e8359a57de Do refcounting of open devices (more) correctly.
count_dev funtion by phk.
2000-02-07 23:05:40 +00:00
Robert Watson
b7a5f3ca1b Remove static qualifier from vgonel, as it is needed by the Arla folk
outside of vfs_subr.c.

Submitted by:	Assar Westerlund <assar@sics.se>
Reviewed by:	rwatson
Approved by:	jkh
2000-02-02 07:07:17 +00:00
Peter Wemm
d2b4236a60 Don't refer to TABLDISC in the comments here.
Submitted by:	bde
Approved by:	jkh
2000-01-30 10:14:13 +00:00
Peter Wemm
f7b79efbc1 Remove sys/tablet.h and kern/tty_tb.c (the old RS232 CAD-style tablet
support code).  It hasn't worked since at least October 1995, and probably
has never worked in the FreeBSD 2.0+ tree.  Obviously it's not a priority
to many folks.

Reviewed by:	phk, sos
2000-01-29 16:34:46 +00:00
Robert Watson
9a2b8fca80 This patch fixes a locking bug that can result in deadlock if
the codepath is followed.

From the PR:

  vclean calls vrele leading to deadlock (if usecount > 0)

  vclean() calls vrele() if v_usecount of the node was higher than one.
  But before calling it, it sets the VXLOCK flag, which will make
  vn_lock called from vrele dead-lock.

PR:		kern/15117
Submitted by:	Assar Westerlund <assar@stacken.kth.se>
Reviewed by:	rwatson
Obtained from:	NetBSD
2000-01-29 15:22:58 +00:00
Poul-Henning Kamp
1edde29e97 rename disk_delete() to disk_destroy(). 2000-01-28 20:49:43 +00:00
Brian Feldman
8950d24456 Fix a bug that could crash the system if you press ^T while a slower
system is slowed down and in the right spot (a race condition in fork()).

The "previous time" fields have moved from pstat to proc.  Anything which
uses KVM needs to be recompiled with a new libkvm/headers.

A couple wacky u_quad_t's in struct proc are now u_int64_t (the same, but
according to lack of 'quad's in proc.h and usage in kern_resource.c).
This will have no effect on code.

This has been make-world-and-installed-new-kernel-which-works-fine-tested.

Reviewed by:	bde (previous version)
2000-01-28 20:40:29 +00:00
Archie Cobbs
ee51b2c45f Back out previous commit; it was premature. 2000-01-28 17:11:07 +00:00