Commit Graph

54 Commits

Author SHA1 Message Date
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Brian Feldman
e32c66c539 Fix fd race conditions (during shared fd table usage.) Badfileops is
now used in f_ops in place of NULL, and modifications to the files
are more carefully ordered. f_ops should also be set to &badfileops
upon "close" of a file.

This does not fix other problems mentioned in this PR than the first
one.

PR:		11629
Reviewed by:	peter
1999-08-04 18:53:50 +00:00
Alan Cox
3d41489171 Restructure pipe_read in order to eliminate several race conditions.
Submitted by:	Matthew Dillon <dillon@apollo.backplane.com> and myself
1999-06-05 03:53:57 +00:00
Dmitrij Tejblum
8fe387ab84 Add standard padding argument to pread and pwrite syscall. That should make them
NetBSD compatible.

Add parameter to fo_read and fo_write. (The only flag FOF_OFFSET mean that
the offset is set in the struct uio).

Factor out some common code from read/pread/write/pwrite syscalls.
1999-04-04 21:41:28 +00:00
Matthew Dillon
e198079da2 Fix race in pipe read code whereby a blocked lock can allow another
process to sneak in and write to or close the pipe.  The read code
    enters a 'piperd' state after doing the lock operation without
    checking to see if the state changed, which can cause the process
    to wait forever.

    The code has also been documented more.
1999-02-04 23:50:49 +00:00
Matthew Dillon
8aef171243 Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile
1999-01-28 00:57:57 +00:00
Matthew Dillon
d254af07a1 Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile
1999-01-27 21:50:00 +00:00
Bruce Evans
dc34e67676 Include <sys/select.h> -- don't depend on pollution in <sys/proc.h>. 1999-01-27 10:10:03 +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
Don Lewis
831d27a9f5 Installed the second patch attached to kern/7899 with some changes suggested
by bde, a few other tweaks to get the patch to apply cleanly again and
some improvements to the comments.

This change closes some fairly minor security holes associated with
F_SETOWN, fixes a few bugs, and removes some limitations that F_SETOWN
had on tty devices.  For more details, see the description on the PR.

Because this patch increases the size of the proc and pgrp structures,
it is necessary to re-install the includes and recompile libkvm,
the vinum lkm, fstat, gcore, gdb, ipfilter, ps, top, and w.

PR:		kern/7899
Reviewed by:	bde, elvind
1998-11-11 10:04:13 +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
David Greenman
6cde7a165f Fixed two potentially serious classes of bugs:
1) The vnode pager wasn't properly tracking the file size due to
   "size" being page rounded in some cases and not in others.
   This sometimes resulted in corrupted files. First noticed by
   Terry Lambert.
   Fixed by changing the "size" pager_alloc parameter to be a 64bit
   byte value (as opposed to a 32bit page index) and changing the
   pagers and their callers to deal with this properly.
2) Fixed a bogus type cast in round_page() and trunc_page() that
   caused some 64bit offsets and sizes to be scrambled. Removing
   the cast required adding casts at a few dozen callers.
   There may be problems with other bogus casts in close-by
   macros. A quick check seemed to indicate that those were okay,
   however.
1998-10-13 08:24:45 +00:00
Doug Rabson
ecbb00a262 This commit fixes various 64bit portability problems required for
FreeBSD/alpha.  The most significant item is to change the command
argument to ioctl functions from int to u_long.  This change brings us
inline with various other BSD versions.  Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
1998-06-07 17:13:14 +00:00
Bruce Evans
08637435f2 Moved some #includes from <sys/param.h> nearer to where they are actually
used.
1998-03-28 10:33:27 +00:00
Poul-Henning Kamp
a0502b19d4 Add two new functions, get{micro|nano}time.
They are atomic, but return in essence what is in the "time" variable.
gettime() is now a macro front for getmicrotime().

Various patches to use the two new functions instead of the various
hacks used in their absence.

Some puntuation and grammer patches from Bruce.

A couple of XXX comments.
1998-03-26 20:54:05 +00:00
Eivind Eklund
303b270b0a Staticize. 1998-02-09 06:11:36 +00:00
Eivind Eklund
0b08f5f737 Back out DIAGNOSTIC changes. 1998-02-06 12:14:30 +00:00
Eivind Eklund
47cfdb166d Turn DIAGNOSTIC into a new-style option. 1998-02-04 22:34:03 +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
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
Peter Wemm
d080b0b0be Implement the poll backend for the pipe file type. 1997-09-14 02:43:25 +00:00
Bruce Evans
e4ba6a82b0 Removed unused #includes. 1997-09-02 20:06:59 +00:00
John Dyson
0d65e566b9 Another attempt at cleaning up the new memory allocator. 1997-08-05 22:24:31 +00:00
John Dyson
e258d33a51 Fix up come cruft that I left on a previous commit. 1997-08-05 00:05:00 +00:00
John Dyson
3075778b63 Get rid of the ad-hoc memory allocator for vm_map_entries, in lieu of
a simple, clean zone type allocator.  This new allocator will also be
used for machine dependent pmap PV entries.
1997-08-05 00:02:08 +00:00
Bruce Evans
9dd8309d56 Removed support for OLD_PIPE. <sys/stat.h> is now missing the hack that
supported nameless pipes being indistinguishable from fifos.  We're not
going back.
1997-04-09 16:53:45 +00:00
Bruce Evans
2098241054 Don't include <sys/ioctl.h> in the kernel. Stage 4: include
<sys/ttycom.h> and sometimes <sys/filio.h> instead of <sys/ioctl.h>
in miscellaneous files.  Most of these files have nothing to do
with ttys but need to include <sys/ttycom.h> to get the definitions
of TIOC[SG]PGRP which are (ab)used to convert F[SG]ETOWN fcntls into
ioctls.
1997-03-24 11:52:29 +00:00
Bruce Evans
3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Bruce Evans
3c81694426 Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'.  Use a new function gettime().  The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
1997-03-22 06:53:45 +00:00
Peter Wemm
6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
John Dyson
996c772f58 This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>
1997-02-10 02:22:35 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
John Dyson
f2c832d788 Mostly some fixes from bde to start support for ASYNC I/O (SIGIO).
Submitted by:	bde
1996-10-11 02:27:30 +00:00
John Dyson
d1a5be1064 A few minor mods (improvements) to support more efficient pipe
operations for large transfers.  There are essentially no differences
for small transfers, but big transfers should perform about 20%
better.
1996-07-13 22:52:50 +00:00
Bruce Evans
3be8cc7800 Staticized some variables.
Fixed initialization of pipe_pgid - don't default to pid 0 (swapper) for
SIGIO.

Added comments about other implicit initializations, mostly for struct
stat.

Fixed initialization of st_mode.  S_IFSOCK was for when pipes were sockets.
It is probably safe to fix the bogus S_ISFIFO() now that pipes can be
distinguished from sockets in all cases.

Don't return ENOSYS for inappropriate ioctls.
1996-07-12 08:14:58 +00:00
John Dyson
c44013cde6 Get rid of PIPE_NBIO, cleaning up the code a bit.
Reviewed by:	bde
1996-07-04 04:36:56 +00:00
John Dyson
23fd45be00 Disable direct writes for non-blocking output. 1996-06-17 05:15:01 +00:00
Gary Palmer
c23670e294 Clean up -Wunused warnings.
Reviewed by:		bde
1996-06-12 05:11:41 +00:00
John Dyson
d73ce5bd92 Various pipe error return fixes, and a significant typeo fix. From
Bruce Evans (of course :-)).
Submitted by:	bde
1996-03-25 01:48:28 +00:00
John Dyson
7fe9c39bea Yet another fix from BDE for the new pipe code. This fixes a potential
deadlock due to mismanagement of busy counters.

Reviewed by: dyson
Submitted by: bde
1996-03-17 04:52:10 +00:00
John Dyson
6e20683c9d Fix a problem that select did not work with direct writes. Make
wakeup channels more consistant also.
1996-02-22 03:33:52 +00:00
Peter Wemm
add3bbdaef Add missing prototype for pipeselwakeup (a recently added function) - gcc
bitches about it..
1996-02-17 14:47:16 +00:00
John Dyson
f3e79aa705 Add ifdefs for non-freebsd system usage. Add missing select wakeups,
and make the select wakup code a little neater.
1996-02-11 22:09:50 +00:00
John Dyson
5af564b4f4 Add some missing requests for the read-side to wakeup the write-side. Also
add some missing wakeups by the write side to the read side.
1996-02-09 04:36:36 +00:00
John Dyson
26d2f00960 Apparent fix for a pipe hang problem. 1996-02-07 06:41:56 +00:00
John Dyson
f29e1bd629 More fixes from bde.
Only modify times on success.
	splhigh() around time variable usage.
	Make atomic writes more posix compliant.
	Spelling errors.
Submitted by:	bde
1996-02-05 05:50:34 +00:00
John Dyson
96cc6b1011 Kva space allocated for direct buffer wasn't quite big enough. The
system can panic easily without this patch.
1996-02-05 05:17:15 +00:00
John Dyson
dca5129987 Changed vm_fault_quick in vm_machdep.c to be global. Needed for
new pipe code.
1996-02-04 22:09:12 +00:00
John Dyson
2834ceec7c Improve the performance for pipe(2) again. Also include some
fixes for previous version of new pipes from Bruce Evans.  This
new version:

Supports more properly the semantics of select (BDE).
Supports "OLD_PIPE" correctly (kern_descrip.c, BDE).
Eliminates incorrect EPIPE returns (bash 'pipe broken' messages.)
Much faster yet, currently tuned relatively conservatively -- but now
	gives approx 50% more perf than the new pipes code did originally.
	(That was about 50% more perf than the original BSD pipe code.)

Known bugs outstanding:
	No support for async io (SIGIO).  Will be included soon.

Next to do:
	Merge support for FIFOs.

Submitted by: bde
1996-02-04 19:56:35 +00:00