summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
Commit message (Collapse)AuthorAgeFilesLines
* Use vfs_timestamp() instead of getnanotime() to set timestamps. Thisbde1999-12-261-3/+4
| | | | | | | 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).
* Fix two problems with pipe_write():tegge1999-12-131-23/+64
| | | | | | | | | | | | | | | | | | | | | 1. Data written beyond end of pipe buffer, causing kernel memory corruption. - Check that space is still valid after obtaining the pipe lock. - Defer the calculation of transfer size until the pipe lock has been obtained. - Update the pipe buffer pointers while holding the pipe lock. 2. Writes of size <= PIPE_BUF not always atomic. - Allow an internal write to span two contiguous segments, so writes of size <= PIPE_BUF can be kept atomic when wrapping around from the end to the start of the pipe buffer. PR: 15235 Reviewed by: Matt Dillon <dillon@FreeBSD.org>
* Update pipe code for fo_stat() entry point - pipe_stat() is now no longerpeter1999-11-081-5/+9
| | | | used outside the pipe code.
* useracc() the prequel:phk1999-10-291-1/+0
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* Fix bug in pipe code relating to writes of mmap'd but illegal addressdillon1999-09-201-3/+2
| | | | | | | | | spaces which cross a segment boundry in the page table. pmap_kextract() is not designed for access to the user space portion of the page table and cannot handle the null-page-directory-entry case. The fix is to have vm_fault_quick() return a success or failure which is then used to avoid calling pmap_kextract().
* This is what was "fdfix2.patch," a fix for fd sharing. It's prettygreen1999-09-191-4/+6
| | | | | | | | | | | | | | | | | far-reaching in fd-land, so you'll want to consult the code for changes. The biggest change is that now, you don't use fp->f_ops->fo_foo(fp, bar) but instead fo_foo(fp, bar), which increments and decrements the fp refcount upon entry and exit. Two new calls, fhold() and fdrop(), are provided. Each does what it seems like it should, and if fdrop() brings the refcount to zero, the fd is freed as well. Thanks to peter ("to hell with it, it looks ok to me.") for his review. Thanks to msmith for keeping me from putting locks everywhere :) Reviewed by: peter
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Fix fd race conditions (during shared fd table usage.) Badfileops isgreen1999-08-041-5/+6
| | | | | | | | | | | | 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
* Restructure pipe_read in order to eliminate several race conditions.alc1999-06-051-68/+46
| | | | Submitted by: Matthew Dillon <dillon@apollo.backplane.com> and myself
* Add standard padding argument to pread and pwrite syscall. That should make themdt1999-04-041-5/+7
| | | | | | | | | 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.
* Fix race in pipe read code whereby a blocked lock can allow anotherdillon1999-02-041-20/+39
| | | | | | | | | 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.
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-3/+3
| | | | kernel compile
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-6/+6
| | | | kernel compile
* Include <sys/select.h> -- don't depend on pollution in <sys/proc.h>.bde1999-01-271-1/+2
|
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-3/+1
| | | | and local variables, goto labels, and functions declared but not defined.
* Installed the second patch attached to kern/7899 with some changes suggestedtruckman1998-11-111-11/+15
| | | | | | | | | | | | | | | | 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
* Added a second argument, "activate" to the vm_page_unwire() call so thatdg1998-10-281-3/+3
| | | | the caller can select either inactive or active queue to put the page on.
* Fixed two potentially serious classes of bugs:dg1998-10-131-3/+3
| | | | | | | | | | | | | | | | 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.
* This commit fixes various 64bit portability problems required fordfr1998-06-071-3/+3
| | | | | | | | | | 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.
* Moved some #includes from <sys/param.h> nearer to where they are actuallybde1998-03-281-1/+2
| | | | used.
* Add two new functions, get{micro|nano}time.phk1998-03-261-7/+7
| | | | | | | | | | | | 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.
* Staticize.eivind1998-02-091-3/+3
|
* Back out DIAGNOSTIC changes.eivind1998-02-061-3/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+3
|
* Remove a bunch of variables which were unused both in GENERIC and LINT.phk1997-11-071-2/+1
| | | | Found by: -Wunused
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-6/+5
| | | | | | | | | | | | 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.
* Ack! Fix excessive cut/paste blunder during poll mods. Who had thepeter1997-10-061-3/+3
| | | | | | | | | | | 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>
* Implement the poll backend for the pipe file type.peter1997-09-141-39/+38
|
* Removed unused #includes.bde1997-09-021-9/+1
|
* Another attempt at cleaning up the new memory allocator.dyson1997-08-051-3/+2
|
* Fix up come cruft that I left on a previous commit.dyson1997-08-051-10/+1
|
* Get rid of the ad-hoc memory allocator for vm_map_entries, in lieu ofdyson1997-08-051-1/+17
| | | | | a simple, clean zone type allocator. This new allocator will also be used for machine dependent pmap PV entries.
* Removed support for OLD_PIPE. <sys/stat.h> is now missing the hack thatbde1997-04-091-4/+1
| | | | | supported nameless pipes being indistinguishable from fifos. We're not going back.
* Don't include <sys/ioctl.h> in the kernel. Stage 4: includebde1997-03-241-2/+3
| | | | | | | | <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.
* Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.bde1997-03-231-1/+2
| | | | | Fixed everything that depended on getting fcntl.h stuff from the wrong place. Most things don't depend on file.h stuff at all.
* Fixed some invalid (non-atomic) accesses to `time', mostly ones of thebde1997-03-221-16/+9
| | | | | | 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.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-1/+1
| | | | | | | | | | | | | | | 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>
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | 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.
* Mostly some fixes from bde to start support for ASYNC I/O (SIGIO).dyson1996-10-111-11/+19
| | | | Submitted by: bde
* A few minor mods (improvements) to support more efficient pipedyson1996-07-131-32/+73
| | | | | | operations for large transfers. There are essentially no differences for small transfers, but big transfers should perform about 20% better.
* Staticized some variables.bde1996-07-121-5/+12
| | | | | | | | | | | | | | 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.
* Get rid of PIPE_NBIO, cleaning up the code a bit.dyson1996-07-041-27/+15
| | | | Reviewed by: bde
* Disable direct writes for non-blocking output.dyson1996-06-171-2/+5
|
* Clean up -Wunused warnings.gpalmer1996-06-121-4/+2
| | | | Reviewed by: bde
* Various pipe error return fixes, and a significant typeo fix. Fromdyson1996-03-251-9/+15
| | | | | Bruce Evans (of course :-)). Submitted by: bde
* Yet another fix from BDE for the new pipe code. This fixes a potentialdyson1996-03-171-6/+5
| | | | | | | deadlock due to mismanagement of busy counters. Reviewed by: dyson Submitted by: bde
* Fix a problem that select did not work with direct writes. Makedyson1996-02-221-8/+15
| | | | wakeup channels more consistant also.
* Add missing prototype for pipeselwakeup (a recently added function) - gccpeter1996-02-171-1/+2
| | | | bitches about it..
* Add ifdefs for non-freebsd system usage. Add missing select wakeups,dyson1996-02-111-27/+63
| | | | and make the select wakup code a little neater.
OpenPOWER on IntegriCloud