summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_syscalls.c
Commit message (Collapse)AuthorAgeFilesLines
* Add three new VOPs: VOP_CREATEVOBJECT, VOP_DESTROYVOBJECT and VOP_GETVOBJECT.bp2000-09-121-2/+1
| | | | | | | They will be used by nullfs and other stacked filesystems to support full cache coherency. Reviewed in general by: mckusick, dillon
* Replace the mbuf external reference counting code with somethingdwmalone2000-08-191-43/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that should be better. The old code counted references to mbuf clusters by using the offset of the cluster from the start of memory allocated for mbufs and clusters as an index into an array of chars, which did the reference counting. If the external storage was not a cluster then reference counting had to be done by the code using that external storage. NetBSD's system of linked lists of mbufs was cosidered, but Alfred felt it would have locking issues when the kernel was made more SMP friendly. The system implimented uses a pool of unions to track external storage. The union contains an int for counting the references and a pointer for forming a free list. The reference counts are incremented and decremented atomically and so should be SMP friendly. This system can track reference counts for any sort of external storage. Access to the reference counting stuff is now through macros defined in mbuf.h, so it should be easier to make changes to the system in the future. The possibility of storing the reference count in one of the referencing mbufs was considered, but was rejected 'cos it would often leave extra mbufs allocated. Storing the reference count in the cluster was also considered, but because the external storage may not be a cluster this isn't an option. The size of the pool of reference counters is available in the stats provided by "netstat -m". PR: 19866 Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: alfred (glanced at by others on -net)
* Modify ktrace's general I/O tracing, ktrgenio(), to use a struct uio *green2000-07-021-6/+14
| | | | | | | | | | | | | instead of a struct iovec * array and int len. Get rid of stupidly trying to allocate all of the memory and copyin()ing the entire iovec[], and instead just do the proper VOP_WRITE() in ktrwrite() using a copy of the struct uio that the syscall originally used. This solves the DoS which could easily be performed; to work around the DoS, one could also remove "options KTRACE" from the kernel. This is a very strong MFC candidate for 4.1. Found by: art@OpenBSD.org
* unstatic getfp() so that other subsystems can use it.alfred2000-06-121-3/+2
| | | | | | make sendfile() use it. Approved by: dg
* Back out the previous change to the queue(3) interface.jake2000-05-261-1/+1
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-1/+1
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Introduce kqueue() and kevent(), a kernel event notification facility.jlemon2000-04-161-0/+4
|
* This is Bosko Milekic's mbuf allocation waiting code. Basically, thisgreen1999-12-121-0/+4
| | | | | | | | means that running out of mbuf space isn't a panic anymore, and code which runs out of network memory will sleep to wait for it. Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: green, wollman
* General clean-up of socket.h and associated sources to synchronise upphk1999-11-241-1/+1
| | | | | | | | | | | | with NetBSD and the Single Unix Specification v2. This updates some structures with other, almost equivalent types and effort is under way to get the whole more consistent. Also removes a double definition of INET6 and some other clean-ups. Reviewed by: green, bde, phk Some part obtained from: NetBSD, SUSv2 specification
* This is a partial commit of the patch from PR 14914:phk1999-11-161-3/+3
| | | | | | | | | | | | | Alot of the code in sys/kern directly accesses the *Q_HEAD and *Q_ENTRY structures for list operations. This patch makes all list operations in sys/kern use the queue(3) macros, rather than directly accessing the *Q_{HEAD,ENTRY} structures. This batch of changes compile to the same object files. Reviewed by: phk Submitted by: Jake Burkholder <jake@checker.org> PR: 14914
* 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.
* Add a missing spl lowering.green1999-10-141-0/+1
| | | | Submitted by: Ville-Pertti Keinonen <will@iki.fi>
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-2/+0
| | | | Submitted by: phk
* Plug a potential filedescriptor leak. This will probably almostguido1999-09-301-1/+6
| | | | | | never be triggered. Reviewed by: David Greenman
* This is what was "fdfix2.patch," a fix for fd sharing. It's prettygreen1999-09-191-0/+4
| | | | | | | | | | | | | | | | | 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-14/+11
| | | | | | | | | | | | 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
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-3/+3
| | | | kernel compile
* Don't free the socket address if soaccept() / pru_accept() doesn'tfenner1999-01-251-2/+3
| | | | return one.
* Addendum: The original code that the last commit 'fixed' actually diddillon1999-01-241-1/+1
| | | | | not have a bug in it, but the last commit did make it more readable so we are keeping it.
* There was a situation where sendfile() might attempt to initiate I/Odillon1999-01-241-32/+35
| | | | on a PG_BUSY page, due to a bug in its sequencing of a conditional.
* Fixed a potential bug ( but maybe not ), where sendfile() clears PG_BUSYdillon1999-01-211-1/+1
| | | | | on a page without testing for waiters. Also collapsed busy wait into new vm_page_sleep_busy() inline ( see vm/vm_page.h )
* This is a rather large commit that encompasses the new swapper,dillon1999-01-211-16/+13
| | | | | | | | | | changes to the VM system to support the new swapper, VM bug fixes, several VM optimizations, and some additional revamping of the VM code. The specific bug fixes will be documented with additional forced commits. This commit is somewhat rough in regards to code cleanup issues. Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com>
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-2/+2
| | | | and local variables, goto labels, and functions declared but not defined.
* Fixed broken code in sendfile(2) when using file offsets.dg1998-12-031-5/+7
|
* We can't call fsetown() from sonewconn() because sonewconn() is be calledtruckman1998-11-231-1/+3
| | | | | | | | | | | | | | | | | | | from an interrupt context and fsetown() wants to peek at curproc, call malloc(..., M_WAITOK), and fiddle with various unprotected data structures. The fix is to move the code that duplicates the F_SETOWN/FIOSETOWN state of the original socket to the new socket from sonewconn() to accept1(), since accept1() runs in the correct context. Deferring this until the process calls accept() is harmless since the process can't do anything useful with SIGIO on the new socket until it has the descriptor for that socket. One could make the case for not bothering to duplicate the F_SETOWN/FIOSETOWN state and requiring the process to explicitly make the fcntl() or ioctl() call on the new socket, but this would be incompatible with the previous implementation and might break programs which rely on the old semantics. This bug was discovered by Andrew Gallatin <gallatin@cs.duke.edu>.
* Closed a very narrow and rare race condition that involved net interrupts,dg1998-11-181-1/+4
| | | | | | bio interrupts, and a truncated file that along with the precise alignment of the planets could result in a page being freed multiple times or a just-freed page being put onto the inactive queue.
* In sendfile(2), check against sb_lowat when filling the socket buffer,dg1998-11-151-2/+2
| | | | rather than 0.
* Fixed a couple of nits in sendfile(2): clear PG_ZERO before unbusyingdg1998-11-141-3/+3
| | | | the page, and use passed-in "p" rather than curproc in uio struct.
* Added support for non-blocking sockets to sendfile(2).dg1998-11-061-1/+20
|
* Implemented zero-copy TCP/IP extensions via sendfile(2) - send adg1998-11-051-1/+403
| | | | | | | | | | | file to a stream socket. sendfile(2) is similar to implementations in HP-UX, Linux, and other systems, but the API is more extensive and addresses many of the complaints that the Apache Group and others have had with those other implementations. Thanks to Marc Slemko of the Apache Group for helping me work out the best API for this. Anyway, this has the "net" result of speeding up sends of files over TCP/IP sockets by about 10X (that is to say, uses 1/10th of the CPU cycles) when compared to a traditional read/write loop.
* Yow! Completely change the way socket options are handled, eliminatingwollman1998-08-231-44/+34
| | | | | | another specialized mbuf type in the process. Also clean up some of the cruft surrounding IPFW, multicast routing, RSVP, and other ill-explored corners.
* 64bit fixes: don't cast p->p_retval to an int*.dfr1998-06-101-3/+5
|
* Fix a minor mbuf leak created by the previous change.phk1998-04-141-2/+4
| | | | | Reviewed by: phk Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
* setsockopt() transports user option data in an mbuf. if the userphk1998-04-111-2/+7
| | | | | | | | | data is greater than MLEN, setsockopt is unable to pass it onto the protocol handler. Allocate a cluster in such case. PR: 2575 Reviewed by: phk Submitted by: Julian Assange proff@iq.org
* Moved some #includes from <sys/param.h> nearer to where they are actuallybde1998-03-281-1/+2
| | | | used.
* Staticize.eivind1998-02-091-5/+5
|
* Make COMPAT_43 and COMPAT_SUNOS new-style options.eivind1997-12-161-1/+2
|
* Consult sa_len before trampling it with MSG_COMPAT set.msmith1997-12-151-3/+4
| | | | | PR: kern/5291 Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
* As described by the submitter:msmith1997-12-141-5/+6
| | | | | | | | | | ... fix a bug with orecvfrom() or recvfrom() called with the MSG_COMPAT flag on kernels compiled with the COMPAT_43 option. The symptom is that the fromaddr is not correctly returned. This affects the Linux emulator. Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-88/+55
| | | | | | | | | | | | 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.
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.phk1997-10-121-2/+2
| | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde
* Removed unused #includes.bde1997-09-021-4/+1
|
* Delete a bit of debugging code that mistakenly crept in, and as a consequencewollman1997-08-171-7/+0
| | | | revert rev. 1.28's header file additions which are no longer needed.
* Use KERNBASE, not 0xf0000000.tegge1997-08-171-2/+6
|
* Fix all areas of the system (or at least all those in LINT) to avoid storingwollman1997-08-161-58/+100
| | | | | | | | socket addresses in mbufs. (Socket buffers are the one exception.) A number of kernel APIs needed to get fixed in order to make this happen. Also, fix three protocol families which kept PCBs in mbufs to not malloc them instead. Delete some old compatibility cruft while we're at it, and add some new routines in the in_cksum family.
* The long-awaited mega-massive-network-code- cleanup. Part I.wollman1997-04-271-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out.
* Removed support for OLD_PIPE. <sys/stat.h> is now missing the hack thatbde1997-04-091-55/+1
| | | | | supported nameless pipes being indistinguishable from fifos. We're not going back.
* In accept1(), falloc() is called after the process has awoken, but priordg1997-03-311-6/+22
| | | | | | | | | | | to removing the connection from the queue. The problem here is that falloc() may block and this would allow another process to accept the connection instead. If this happens to leave the queue empty, then the system will panic with an "accept: nothing queued". Also changed a wakeup() to a wakeup_one() to avoid the "thundering herd" problem on new connections in Apache (or any other application that has multiple processes blocked in accept() for the same socket).
* 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.
OpenPOWER on IntegriCloud