|
|
1.1 ! root 1: .\" Copyright (c) 1986 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)sys.uipc.t 1.7 (Berkeley) 4/11/86 ! 6: .\" ! 7: .NH 2 ! 8: Changes in Interprocess Communication support ! 9: .XP uipc_domain.c ! 10: The skeletal support for the PUP-1 protocol has been removed. ! 11: A domain for Xerox NS is now in use. ! 12: The per-domain data structure allows a per-domain initialization routine ! 13: to be called at boot time. ! 14: .XP ! 15: The \fIpffindproto\fP routine, used in creating a socket to support ! 16: a specified protocol, ! 17: takes an additional argument, the type of the socket. ! 18: It checks both the protocol and type, useful when the same protocol ! 19: implements multiple socket types. ! 20: If the type is SOCK_RAW and no exact match is found, ! 21: a \fIprotosw\fP entry for raw support and a wildcard protocol (number zero) ! 22: will be used. ! 23: This allows for a generic raw socket that passes ! 24: through packets for any given protocol. ! 25: .XP ! 26: The second argument to \fIpfctlinput\fP, the generic error-reporting ! 27: routine, is now declared as a \fIsockaddr\fP pointer. ! 28: .XP uipc_mbuf.c ! 29: The mbuf support routines now use the \fIwait\fP flag passed to \fIm_get\fP ! 30: or MGET. ! 31: If M_WAIT is specified, the allocator may wait for free memory, ! 32: and the allocation is guaranteed to return an mbuf if it returns. ! 33: In order to prevent the system from slowly going to sleep after ! 34: exhausting the mbuf pool by losing the mbufs to a leak, ! 35: the allocator will panic after creating the maximum allocation of mbufs ! 36: (by default, 256K). ! 37: Redundant \fIspl\fP's have been removed; most internal routines must ! 38: be called at \fIsplimp\fP, the highest priority at which mbuf and memory ! 39: allocation occur. ! 40: .XP ! 41: When copying mbuf chains \fIm_copy\fP now preserves the type of each mbuf. ! 42: There were problems in \fIm_adj\fP, in particular assumptions ! 43: that there would be no zero-length mbufs within the chain; ! 44: this was corrected by changing its \fIn\fP-pass algorithm for trimming ! 45: from the tail of the chain ! 46: to either one- or two-pass, depending on whether the correction was entirely ! 47: within the last mbuf. ! 48: In order to avoid return business, \fIm_pullup\fP was changed ! 49: to pull additional data (MPULL_EXTRA, defined in \fImbuf.h\fP) ! 50: into the contiguous area in the first mbuf, if convenient. ! 51: \fIm_pullup\fP will use the first mbuf of the chain rather then a new one ! 52: if it can avoid copying. ! 53: .XP uipc_pipe.c ! 54: This ``temporary'' file has been removed; ! 55: pipe now uses \fIsocketpair\fP. ! 56: .XP uipc_proto.c ! 57: New entries in the protocol switch for externalization and disposal ! 58: of access rights are initialized for the Unix domain protocols. ! 59: .XP uipc_socket.c ! 60: The \fIsocreate\fP function uses the new interface to \fIpffindproto\fP ! 61: described above if the protocol is specified by the caller. ! 62: The \fIsoconnect\fP routine will now try to disconnect a connected socket ! 63: before reconnecting. ! 64: This is only allowed if the protocol itself is not connection oriented. ! 65: Datagram sockets may connect to specify ! 66: a default destination, then later connect to another destination ! 67: or to a null destination to disconnect. ! 68: The \fIsodisconnect\fP routine never used its second argument, and it has ! 69: been removed. ! 70: .XP ! 71: The \fIsosend\fP routine, which implements write and send on sockets, ! 72: has been restructured for clarity. ! 73: The old routine had the main loop upside down, first emptying and then filling ! 74: the buffers. ! 75: The new implementation also makes it possible to send zero-length datagrams. ! 76: The maximum length calculation was simplified to avoid problems ! 77: trying to account for both mbufs and characters of buffer space used. ! 78: Because of the large improvement in speed of data handling when large ! 79: buffers are used, \fIsosend\fP will use page clusters if it can use ! 80: at least half of the cluster. ! 81: Also, if not using nonblocking I/O, ! 82: it will wait for output to drain if it has enough data ! 83: to fill an mbuf cluster but not enough space in the output queue for one, ! 84: instead of fragmenting the write into small mbufs. ! 85: A bug allowing access rights to be sent more than once when using scatter-gather ! 86: I/O (\fIsendmsg\fP) was fixed. ! 87: A race that occurred when \fIuiomove\fP blocked during a page fault ! 88: was corrected by allowing the protocol send routines to report disconnection ! 89: errors; as with disconnection detected earlier, \fIsosend\fP returns ! 90: EPIPE and sends a SIGPIPE signal to the process. ! 91: .XP ! 92: The receive side of socket operations, \fIsoreceive\fP, has also been reworked. ! 93: The major changes are a reflection of the way that datagrams are now queued; ! 94: see uipc_socket2.c for further information. ! 95: The MSG_PEEK flag is passed to the protocol's \fIusrreq\fP routine ! 96: when requesting out-of-band data so that the protocol may know ! 97: when the out-of-band data has been consumed. ! 98: Another bug in access-rights passing was corrected here; the protocol ! 99: is not called to externalize the data when PEEKing. ! 100: .XP ! 101: The \fIsosetopt\fP and \fIsogetopt\fP functions have been expanded ! 102: considerably. ! 103: The options that existed in 4.2BSD all set some flag at the socket level. ! 104: The corresponding options in 4.3BSD use the value argument as a boolean, ! 105: turning the flag off or on as appropriate. ! 106: There are a number of additional options at the socket level. ! 107: Most importantly, it is possible to adjust the send or receive buffer ! 108: allocation so that higher throughput may be achieved, or that temporary ! 109: peaks in datagram arrival are less likely to result in datagram loss. ! 110: The linger option is now set with a structure including a boolean ! 111: (whether or not to linger) and a time to linger if the boolean is true. ! 112: Other options have been added to determine the type of a socket ! 113: (eg, SOCK_STREAM, SOCK_DGRAM), and to collect any outstanding error status. ! 114: If an option is not destined for the socket level itself, ! 115: the option is passed to the protocol using the \fIctloutput\fP entry. ! 116: \fIGetopt\fP's last argument was changed from \fImbuf *\fP to \fImbuf **\fP ! 117: for consistency with \fIsetopt\fP and the ! 118: new \fIctloutput\fP calling convention. ! 119: .XP ! 120: \fISelect\fP for exceptional conditions on sockets is now possible, ! 121: and this returns true when out-of-band data is pending. ! 122: This is true from the time that the socket layer is notified ! 123: that the OOB data is on its way until the OOB data has been consumed. ! 124: The interpretation of socket process groups in 4.2BSD was inconsistent ! 125: with that of ttys and with the \fIfcntl\fP documentation. ! 126: This was corrected; positive numbers refer to processes, negative numbers ! 127: to process groups. ! 128: The socket process group is used when posting a SIGURG to notify ! 129: processes of pending out-of-band data. ! 130: .XP uipc_socket2.c ! 131: Signal-driven I/O now works with sockets as well as with ttys; ! 132: \fIsorwakeup\fP and \fIsowwakeup\fP call the new routine \fIsowakeup\fP ! 133: which calls \fIsbwakeup\fP as before and also sends SIGIO as appropriate. ! 134: Process groups are interpreted in the same manner as for SIGURG. ! 135: .XP ! 136: Larger socket buffers may be used with 4.3BSD than with 4.2BSD; ! 137: socket buffers (\fIsockbuf\fPs) have been modified to use unsigned short ! 138: rather than short integers for character counts and mbuf counts. ! 139: This increases the maximum buffer size to 64K\-1. These fields ! 140: should really be unsigned longs, but a socket would no longer fit ! 141: in an mbuf. ! 142: So that as much as possible of the allotment may be used, ! 143: \fIsbreserve\fP allows the high-water mark for data to be set as high as 80% ! 144: of the maximum value (64K), and sets the high-water mark on mbuf allocation ! 145: to the smaller of twice the character limit and 64K. ! 146: .XP ! 147: In 4.2BSD, datagrams queued in sockbufs were linked through the mbuf ! 148: \fIm_next\fP field, with \fIm_act\fP set to 1 in the last mbuf ! 149: of each datagram. ! 150: Also, each datagram was required to have one mbuf to contain an address, ! 151: another to contain access rights, and at least one additional mbuf of data. ! 152: In 4.3BSD, the mbufs comprising a datagram are linked through \fIm_next\fP, ! 153: and different datagrams are linked through the \fIm_act\fP field of the first ! 154: mbuf in each. ! 155: No mbuf is used to represent missing components of a datagram, ! 156: but the ordering of the mbufs remains important. ! 157: The components are distinguished by the mbuf type. ! 158: Any address must be in the first mbuf. ! 159: Access rights follow the address if present, otherwise they may be first. ! 160: Data mbufs follow; at least one data buffer will be present ! 161: if there is no address or access rights. ! 162: The routines \fIsbappend\fP, \fIsbappendaddr\fP, \fIsbappendrights\fP ! 163: and \fIsbappendrecord\fP are used to add new data to a sockbuf. ! 164: The first of these appends to an existing record, and is commonly ! 165: used for stream sockets. ! 166: The other three begin new records with address, optional rights, and data ! 167: (\fIsbappendaddr\fP), with rights and data (\fIsbappendrights\fP), ! 168: or data only (\fIsbappendrecord\fP). ! 169: A new internal routine, \fIsbcompress\fP, is used by these functions ! 170: to compress and append data mbufs to a record. ! 171: These changes improve the functionality of this layer ! 172: and in addition make it faster to find the end of a queue. ! 173: .XP ! 174: An occasional ``panic: sbdrop'' was due to zero-length mbufs at the end ! 175: of a chain. ! 176: Although these should no longer be found in a sockbuf queue, ! 177: \fIsbdrop\fP was fixed to free empty buffers at the end of the last ! 178: record. ! 179: Similarly, \fIsbfree\fP continues to empty a sockbuf as long as mbufs ! 180: remain, as zero-length packets might be present. ! 181: \fISbdroprecord\fP was added to free exactly one record from the front ! 182: of a sockbuf queue. ! 183: .XP uipc_syscalls.c ! 184: Errors reported during an \fIaccept\fP call are cleared so that ! 185: subsequent \fIaccept\fP calls may succeed. ! 186: A failed attempt to \fIconnect\fP returns the error once only, ! 187: and SOISCONNECTING is cleared, ! 188: so that additional connect calls may be attempted. ! 189: (Lower level protocols may or may not allow this, depending ! 190: on the nature of the failure.) ! 191: The \fIsocketpair\fP system call has been fixed to work ! 192: with datagram sockets as well as with streams, ! 193: and to clean up properly upon failure. ! 194: Pipes are now created using \fIconnect2\fP. ! 195: An additional argument, the type of the data to be fetched, ! 196: is passed to \fIsockargs\fP. ! 197: .XP uipc_usrreq.c ! 198: The binding and connection of Unix domain sockets has ! 199: been cleaned up so that \fIrecvfrom\fP and \fIaccept\fP get the address ! 200: of the peer (if bound) rather than their own. ! 201: The Unix-domain connection block records the bound address of a socket, ! 202: not the address of the socket to which it is connected. ! 203: For stream sockets, back pressure to implement flow control ! 204: is now handled by adjusting the limits in the send buffer ! 205: without overloading the normal count fields; the flow control ! 206: information was moved to the connection block. ! 207: Access rights are checked now when connecting; the connected-to socket ! 208: must be writable by the caller, or the connection request is denied. ! 209: In order to test one previously unused ! 210: routine, the Unix domain stream support was modified ! 211: to support the passage of access rights. ! 212: Problems with access-rights garbage collection were also noted and fixed, ! 213: and a count is kept of rights outstanding so that garbage collection ! 214: is done only when needed. ! 215: Garbage collection is triggered by socket shutdown now ! 216: rather than file close; in 4.2BSD, it happened prematurely. ! 217: The PRU_SENSE \fIusrreq\fP entry, used by \fIstat\fP, has been added. ! 218: It returns the write buffer size as the ``blocksize,'' and generates ! 219: a fake inode number and device for the benefit of those programs ! 220: that use \fIfstat\fP information to determine whether file descriptors refer ! 221: to the same file. ! 222: Unimplemented requests have been carefully checked to see that they properly ! 223: free mbufs when required and never otherwise. ! 224: Larger buffers are allocated for both stream and datagram sockets. ! 225: A number of minor bugs have been corrected: the back pointer from an inode ! 226: to a socket needed to be cleared before release of the inode when detaching; ! 227: sockets can only be bound once, rather than losing inodes; datagram ! 228: sockets are correctly marked as connected and disconnected; several mbuf ! 229: leaks were plugged. ! 230: A serious problem was corrected in \fIunp_drop\fP: it did not properly ! 231: abort pending connections, with the result that closing a socket with ! 232: unaccepted connections would cause an infinite loop trying to drop them.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.