Commit graph

2098 commits

Author SHA1 Message Date
Bruce Evans 289bdf33d3 Ifdefed conditionally used simplock variables. 1999-01-02 11:34:57 +00:00
Bruce Evans 9fe425981b Fixed bitrot in a comment. Fixed some style bugs. 1999-01-01 14:41:51 +00:00
Peter Wemm a13ddfb633 When loading something that has undefined symbols, it would be helpful to
know what they were..
1998-12-31 09:17:20 +00:00
Doug Rabson 9c0fed3dcf Various changes to support OSF1 emulation:
* Move the user stack from VM_MAXUSER_ADDRESS to a place below the 32bit
  boundary (needed to support 32bit OSF programs).  This should also save
  one pagetable per process.
* Add cvtqlsv to the set of instructions handled by the floating point
  software completion code.
* Disable all floating point exceptions by default.
* A minor change to execve to allow the OSF1 image activator to support
  dynamic loading.
1998-12-30 10:38:59 +00:00
Mike Smith 9959b1a882 Improved DDB_UNATTENDED behaviour. From the submitter:
There's something that's been bugging me for a while, so I decided to fix it.
FreeBSD now will DTRT WRT DDB and DDB_UNATTENDED (!debugger_on_panic), at least
in my opinion. The behavior change is such that:

	1. Nothing changes when debugger_on_panic != 0.
	2. When DDB_UNATTENDED (!debugger_on_panic), if a panic occurs, the
		machine will reboot. Also, if a trap occurs, the machine will
		panic and reboot, unlike how it broke to DDB before. HOWEVER,
		a trap inside DDB will not cause a panic, allowing full use
		of DDB without having to worry about the machine being stuck
		at a DDB prompt if something goes wrong during the day.
		Patches for this behavior follow my signature, and it would
		be a boon to anyone (like me) who uses DDB_UNATTENDED, but
		actually wants the machine to panic on a trap (otherwise,
		what's the use, if the machine causes a fatal trap rather than
		a true panic, of debugger_on_panic?). The changes cause no
		adverse behavior, but do involve two symbols becoming global

Submitted by:	Brian Feldman <green@unixhelp.org>
1998-12-28 23:03:00 +00:00
Doug Rabson 486bddb033 Fix some 64bit truncation problems which crept into SYSCTL_LONG() with the
last cleanup.  Since the oid_arg2 field of struct sysctl_oid is not wide
enough to hold a long, the SYSCTL_LONG() macro has been modified to only
support exporting long variables by pointer instead of by value.

Reviewed by: bde
1998-12-27 18:03:29 +00:00
Doug Rabson dae6345236 Tweak ptrace(PT_READ_U) so that the last alpha register can be read. 1998-12-26 17:14:37 +00:00
Bruce Evans 4d94881342 Restored rev.1.31 which was clobbered by rev.1.69 (the big Lite2
merge).  This fixes at least hanging in revoke(2) when a somewhat
active slave pty is revoked.  The hang made the window for the
null pointer bug in ufsspec_{read,write} much larger.

There are many other bugs in this area (revoke of an active fifo
at best leaks memory...).
1998-12-24 12:07:16 +00:00
Matthew Dillon e6ee8e16e0 Adjust some comments to prevent future confusion on the implementation.
Also add a reference to the buf(9) manual page.
1998-12-22 18:57:30 +00:00
Luoqi Chen 1a551e9808 Correctly handle misaligned VMIO buffer (whose start or end offset in the VM
object are not page aligned). This should fix the mount_msdos panic after a
failed attemp to mount as ffs.

Reviewed By:	Matthew Dillon	<dillon@apollo.backplane.com>
		Archie Cobbs	<archie@whistle.com>
		Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
1998-12-22 14:43:58 +00:00
Eivind Eklund 29c98cd8bf Check return value of tsleep(). I've checked of all call points -
there does not seem to be a problem with this.

PR:		kern/8732
Analysis by:	David G Andersen <danderse@cs.utah.edu>
Tested by:	Alfred Perlstein <bright@hotjobs.com>
1998-12-22 00:44:11 +00:00
Eivind Eklund db878ba480 Staticize. 1998-12-21 23:38:33 +00:00
Matthew Dillon a1d6c3ec87 Add asleep() and await() support. Currently highly experimental. A
small support structure had to be added to the proc structure, and
    a few minor conditional panics no longer apply.
1998-12-21 07:41:51 +00:00
Julian Elischer 39fb8e6b3e Fix two bogons created by 'patch(1)' in my last commit. 1998-12-19 08:23:31 +00:00
Julian Elischer 6626c6045c Reviewed by: Luoqi Chen, Jordan Hubbard
Submitted by:	 "Richard Seaman, Jr." <lists@tar.com>
Obtained from:	linux :-)

Code to allow Linux Threads to run under FreeBSD.

By default not enabled
This code is dependent on the conditional
COMPAT_LINUX_THREADS (suggested by Garret)
This is not yet a 'real' option but will be within some number of hours.
1998-12-19 02:55:34 +00:00
Bruce Evans 4c56fcdead Removed the cast to a pointer in the definition of PS_STRINGS and
adjusted related casts to match (only in the kernel in this commit).
The pointer was only wanted in one place in kern_exec.c.  Applications
should use the kern.ps_strings sysctl instead of PS_STRINGS, so they
shouldn't notice this change.
1998-12-16 16:28:58 +00:00
Bruce Evans 2caecceeb5 Removed all traces of SYSCTL_INTPTR(). Pointers can't really be passed
across the kernel -> application interface, and for the one sysctl where
they were passed and actually used (kern.ps_strings), the applications
want addresses represented as u_longs anyway (the other sysctl that
passed them, kern.usrstack, has never been used).

Agreed to by:	dfr, phk
1998-12-16 16:06:29 +00:00
Bruce Evans 4f2129fa86 Removed bogus casts of USRSTACK and/or the other operand in binary
expressions involving USRSTACK.
1998-12-16 15:21:51 +00:00
Dag-Erling Smørgrav e3b3ba2d79 Wrap two macros into do { ... } while (0), and fix the way they're used
in the kernel.

Reviewed by: bde
1998-12-15 17:38:33 +00:00
Matthew Dillon fe523aa107 fix intermediate overflow in 'quad = int * int' situation by casting
the arguments to the multiply to a quad equivalent.  In this case,
    vm_ooffset_t.

Reviewed by:	Archie Cobbs <archie@whistle.com>
1998-12-14 21:17:37 +00:00
Matthew Dillon 3ea57f9da2 Fixed problems with kernel config file overrides of sysv semaphore
parameters.  Prior to this fix a kernel config override would effect
only some of the kernel files, resulting in panics.

PR:	kern/9068
1998-12-14 08:34:55 +00:00
Matthew Dillon f7bb75c92a Fix -Wuninitialized warning regarding zero-length var-args ctl element.
( this isn't really an error, but I think it is important to fix the
    warning ).
1998-12-14 05:37:37 +00:00
Don Lewis 2b648ac0a1 Add a generic flag, CTLFLAG_SECURE, which can be used to mark a sysctl
variable unwriteable when securelevel > 0.
Reviewed by: jdp, eivind
1998-12-13 07:19:13 +00:00
Don Lewis 65de0c7a93 getpgid() and getsid() were doing a comparision rather than an assignment,
which is fortunate, because otherwise another bug would allow them to be
used to stomp on the syscall return value of another process.
1998-12-13 07:07:51 +00:00
Matthew Dillon 4c01697599 PR: kern/8965
Obtained from: Stephen Clawson <sclawson@cs.utah.edu>

    Wakeup anyone waiting on a mount point prior to returning from umount,
    whether an error occurs or not.  Fixes a stat/NFS-umount race and other
    potential future problems.  Fix taken from bug/pr which also indicated
    that the same fix has already been applied to OpenBSD and NetBSD.
1998-12-12 21:07:09 +00:00
Nick Hibma b3f65f42c0 When no driver was found for a device, the message 'not probed' appeared
This is odd, especially in the case of USB where the driver is found
in several tries: vendor specific, class specific, interface specific.
The mouse driver is found at the interface specific level...
Reviewed by:	Doug Rabson (dfr@freebsd.org)
1998-12-12 11:30:04 +00:00
Eivind Eklund 2ae353f9a7 Rename one of the two devfs_link's to devfs_makelink. 1998-12-10 19:57:01 +00:00
Jordan K. Hubbard 337c96916f poll(2) sets POLLNVAL for descriptors passed in that are less than
0.  This makes it difficult to do efficient manipulation of the
struct pollfd since you can't leave a slot empty.

PR:		8599
Submitted-by:	Marc Slemko <marcs@znep.com>
1998-12-10 01:53:26 +00:00
Robert V. Baron efb73e5aca In ktrwrite, use uio_procp = curproc vs 0 1998-12-10 01:47:41 +00:00
Eivind Eklund d51523c6c9 Get rid of CTLTYPE_OPAQUE in a SYSCTL_OPAQUE - it is added my the
SYSCTL_OPAQUE macro.
1998-12-09 02:26:45 +00:00
Bruce Evans e1501bb6eb Backed out the FIOASYNC fix in rev.1.108. fcntl(fd, F_SETFL, flags)
depends on the bug.  It does an FIOASYNC ioctl to sync the setting
of the O_ASYNC "file" flag with drivers even if the setting hasn't
changed.

PR:		9003
1998-12-08 10:22:07 +00:00
Archie Cobbs f1d19042b0 The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.
1998-12-07 21:58:50 +00:00
Eivind Eklund 4979978b8d Fix grouping of statements. This remove a potential panic in the soft
updates code.  While I'm here, remove an unintended trigraph.

Reviewed by:	Kirk McKusick <kirk@freebsd.org>
1998-12-07 17:23:45 +00:00
Andrey A. Chernov 8e3c23be56 Move stime declaration to main block, otherwise can left uninitialized
in rare cases.
Found by: Eivind Eklund <eivind@yes.no>
1998-12-07 07:59:20 +00:00
Archie Cobbs 2326715f79 Avoid compiler warning (printf arg type mismatch) when compiling #ifdef DEBUG 1998-12-06 00:03:30 +00:00
Kirk McKusick fcdfed00d5 Even the most recently allocated buffer may not have its b_blkno
field properly filled in, so we must do a VOP_BMAP on that buffer
as well if it is not resolved.
Submitted by: Luoqi Chen <luoqi@watermarkgroup.com>
1998-12-05 06:12:14 +00:00
Archie Cobbs 2127f26023 Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.

These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Mike Spengler <mks@networkcs.com>
1998-12-04 22:54:57 +00:00
David Greenman 911e8dbc2a Fixed broken code in sendfile(2) when using file offsets. 1998-12-03 12:35:47 +00:00
Archie Cobbs 8245f3f5b4 Add snprintf(3) and vsnprintf(3) capability to the kernel.
Reviewed by:	bde
1998-12-03 04:45:57 +00:00
KATO Takenori 9ad861edee - For some old Cyrix CPUs, %cr2 is clobbered by interrupts. This
problem is worked around by using an interrupt gate for the page
   fault handler.  This code was originally made for NetBSD/pc98 by
   Naofumi Honda <honda@kururu.math.sci.hokudai.ac.jp> and has already
   been in PC98 tree.  Because of this bug, trap_fatal cannot show
   correct page fault address if %cr2 is obtained in this function.
   Therefore, trap_fatal uses the value from trap() function.
-  The trap handler always enables interruption when buggy application
   or kernel code has disabled interrupts and then trapped.  This code
   was prepared by Bruce Evans <bde@FreeBSD.org>.

Submitted by:	Bruce Evans <bde@FreeBSD.org>
		Naofumi Honda <honda@kururu.math.sci.hokudai.ac.jp>
1998-12-02 08:15:17 +00:00
Eivind Eklund 0bfe299097 Check return value of malloc() in expand_name.
Reviewed by:	sef
1998-12-02 01:53:48 +00:00
Poul-Henning Kamp 510eb5b9db Make the previous behaviour the default, add a sysctl which you
can set if your hw/sw produces the "calcru negative..." message.

Setting the alternate method (sysctl -w kern.timecounter.method=1)
makes the the get{nano|micro}*() functions call the real thing at
resulting in a measurable but minor overhead.

I decided to NOT have the "calcru" change the method automatically
because you should be aware of this problem if you have it.

The problems currently seen, related to usleep and a few other corners
are fixed for both methods.
1998-11-29 20:31:02 +00:00
David Greenman f2b678d4cb Compare p_cpulimit with RLIM_INFINITY before comparing it with the process
runtime. p_runtime is unsigned while p_cpulimit is not, so this avoids the
nasty side effect of the process getting killed when the runtime comes up
"negative" due to other bugs.
1998-11-27 11:44:22 +00:00
Tor Egge 18830dba83 Don't forget to update the pmap associated with aio daemons when adding
new page directory entries for a growing kernel virtual address space.
1998-11-27 01:14:21 +00:00
Tor Egge f0ac792bec Attempt to handle interrupts delivered to all IO APICs by using the first
IO APIC with a sufficient number of pins.
1998-11-26 23:14:23 +00:00
Eivind Eklund 9fcdafaefc Staticize. 1998-11-26 18:50:24 +00:00
Bruce Evans e7414d1bfa Fixed the previous fix - stathz doesn't give the statclock frequency
when it is 0.

Submitted by:	mostly by Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
1998-11-26 16:49:55 +00:00
Bruce Evans 44f05f9c92 Oops, yet again back out some local changes that shouldn't have been
in the previous commit.
1998-11-26 14:05:58 +00:00
Bruce Evans e4d0e37b33 Fixed scaling of p_pctcpu. It was wrong by a factor of stathz/hz.
Until recently, this was half compensated for in at least ps and top
by multiplying by 100/stathz to get a better wrong factor of 100/hz.
1998-11-26 14:00:08 +00:00
Poul-Henning Kamp c2906d55d0 Make timecounters more resistant to badly behaved SW/HW which locks
out interrupts for too long.  If you still see the "calcru: negative
time..." message you can increase NTIMECOUNTER (see LINT).

Sideeffect is that a timecounter is required to not wrap around in
less than (1 + delta) seconds instead of the (1/hz + delta) required
until now.

Many thanks to: msmith, wpaul, wosch & bde
1998-11-23 09:59:02 +00:00