Deleted Added
full compact
33c33
< __FBSDID("$FreeBSD: head/sys/kern/uipc_sockbuf.c 160875 2006-08-01 10:30:26Z rwatson $");
---
> __FBSDID("$FreeBSD: head/sys/kern/uipc_sockbuf.c 160915 2006-08-02 13:01:58Z rwatson $");
67,68c67,68
< static void sbdrop_internal(register struct sockbuf *sb, register int len);
< static void sbflush_internal(register struct sockbuf *sb);
---
> static void sbdrop_internal(struct sockbuf *sb, int len);
> static void sbflush_internal(struct sockbuf *sb);
72,78c72,78
< * Socantsendmore indicates that no more data will be sent on the
< * socket; it would normally be applied to a socket when the user
< * informs the system that no more data is to be sent, by the protocol
< * code (in case PRU_SHUTDOWN). Socantrcvmore indicates that no more data
< * will be received, and will normally be applied to the socket by a
< * protocol when it detects that the peer will send no more data.
< * Data queued for reading in the socket may yet be read.
---
> * Socantsendmore indicates that no more data will be sent on the socket; it
> * would normally be applied to a socket when the user informs the system
> * that no more data is to be sent, by the protocol code (in case
> * PRU_SHUTDOWN). Socantrcvmore indicates that no more data will be
> * received, and will normally be applied to the socket by a protocol when it
> * detects that the peer will send no more data. Data queued for reading in
> * the socket may yet be read.
81,82c81
< socantsendmore_locked(so)
< struct socket *so;
---
> socantsendmore_locked(struct socket *so)
93,94c92
< socantsendmore(so)
< struct socket *so;
---
> socantsendmore(struct socket *so)
103,104c101
< socantrcvmore_locked(so)
< struct socket *so;
---
> socantrcvmore_locked(struct socket *so)
115,116c112
< socantrcvmore(so)
< struct socket *so;
---
> socantrcvmore(struct socket *so)
128,129c124
< sbwait(sb)
< struct sockbuf *sb;
---
> sbwait(struct sockbuf *sb)
141,142c136,137
< * Lock a sockbuf already known to be locked;
< * return any error returned from sleep (EINTR).
---
> * Lock a sockbuf already known to be locked; return any error returned from
> * sleep (EINTR).
145,146c140
< sb_lock(sb)
< register struct sockbuf *sb;
---
> sb_lock(struct sockbuf *sb)
165,166c159,160
< * Wakeup processes waiting on a socket buffer. Do asynchronous
< * notification via SIGIO if the socket has the SS_ASYNC flag set.
---
> * Wakeup processes waiting on a socket buffer. Do asynchronous notification
> * via SIGIO if the socket has the SS_ASYNC flag set.
177,179c171
< sowakeup(so, sb)
< register struct socket *so;
< register struct sockbuf *sb;
---
> sowakeup(struct socket *so, struct sockbuf *sb)
204,208c196,200
< * Each socket contains two socket buffers: one for sending data and
< * one for receiving data. Each buffer contains a queue of mbufs,
< * information about the number of mbufs and amount of data in the
< * queue, and other fields allowing select() statements and notification
< * on data availability to be implemented.
---
> * Each socket contains two socket buffers: one for sending data and one for
> * receiving data. Each buffer contains a queue of mbufs, information about
> * the number of mbufs and amount of data in the queue, and other fields
> * allowing select() statements and notification on data availability to be
> * implemented.
210,214c202,206
< * Data stored in a socket buffer is maintained as a list of records.
< * Each record is a list of mbufs chained together with the m_next
< * field. Records are chained together with the m_nextpkt field. The upper
< * level routine soreceive() expects the following conventions to be
< * observed when placing information in the receive buffer:
---
> * Data stored in a socket buffer is maintained as a list of records. Each
> * record is a list of mbufs chained together with the m_next field. Records
> * are chained together with the m_nextpkt field. The upper level routine
> * soreceive() expects the following conventions to be observed when placing
> * information in the receive buffer:
216,224c208,216
< * 1. If the protocol requires each message be preceded by the sender's
< * name, then a record containing that name must be present before
< * any associated data (mbuf's must be of type MT_SONAME).
< * 2. If the protocol supports the exchange of ``access rights'' (really
< * just additional data associated with the message), and there are
< * ``rights'' to be received, then a record containing this data
< * should be present (mbuf's must be of type MT_RIGHTS).
< * 3. If a name or rights record exists, then it must be followed by
< * a data record, perhaps of zero length.
---
> * 1. If the protocol requires each message be preceded by the sender's name,
> * then a record containing that name must be present before any
> * associated data (mbuf's must be of type MT_SONAME).
> * 2. If the protocol supports the exchange of ``access rights'' (really just
> * additional data associated with the message), and there are ``rights''
> * to be received, then a record containing this data should be present
> * (mbuf's must be of type MT_RIGHTS).
> * 3. If a name or rights record exists, then it must be followed by a data
> * record, perhaps of zero length.
229,230c221,222
< * socket (currently, it does nothing but enforce limits). The space
< * should be released by calling sbrelease() when the socket is destroyed.
---
> * socket (currently, it does nothing but enforce limits). The space should
> * be released by calling sbrelease() when the socket is destroyed.
232d223
<
234,236c225
< soreserve(so, sndcc, rcvcc)
< register struct socket *so;
< u_long sndcc, rcvcc;
---
> soreserve(struct socket *so, u_long sndcc, u_long rcvcc)
284,286c273,274
< * Allot mbufs to a sockbuf.
< * Attempt to scale mbmax so that mbcnt doesn't become limiting
< * if buffering efficiency is near the normal case.
---
> * Allot mbufs to a sockbuf. Attempt to scale mbmax so that mbcnt doesn't
> * become limiting if buffering efficiency is near the normal case.
289,293c277,278
< sbreserve_locked(sb, cc, so, td)
< struct sockbuf *sb;
< u_long cc;
< struct socket *so;
< struct thread *td;
---
> sbreserve_locked(struct sockbuf *sb, u_long cc, struct socket *so,
> struct thread *td)
300,301c285,288
< * td will only be NULL when we're in an interrupt
< * (e.g. in tcp_input())
---
> * td will only be NULL when we're in an interrupt (e.g. in
> * tcp_input()).
> *
> * XXXRW: This comment needs updating, as might the code.
321,325c308,309
< sbreserve(sb, cc, so, td)
< struct sockbuf *sb;
< u_long cc;
< struct socket *so;
< struct thread *td;
---
> sbreserve(struct sockbuf *sb, u_long cc, struct socket *so,
> struct thread *td)
339,341c323
< sbrelease_internal(sb, so)
< struct sockbuf *sb;
< struct socket *so;
---
> sbrelease_internal(struct sockbuf *sb, struct socket *so)
351,353c333
< sbrelease_locked(sb, so)
< struct sockbuf *sb;
< struct socket *so;
---
> sbrelease_locked(struct sockbuf *sb, struct socket *so)
362,364c342
< sbrelease(sb, so)
< struct sockbuf *sb;
< struct socket *so;
---
> sbrelease(struct sockbuf *sb, struct socket *so)
373,375c351
< sbdestroy(sb, so)
< struct sockbuf *sb;
< struct socket *so;
---
> sbdestroy(struct sockbuf *sb, struct socket *so)
383,384c359
< * Routines to add and remove
< * data from an mbuf queue.
---
> * Routines to add and remove data from an mbuf queue.
386,398c361,372
< * The routines sbappend() or sbappendrecord() are normally called to
< * append new mbufs to a socket buffer, after checking that adequate
< * space is available, comparing the function sbspace() with the amount
< * of data to be added. sbappendrecord() differs from sbappend() in
< * that data supplied is treated as the beginning of a new record.
< * To place a sender's address, optional access rights, and data in a
< * socket receive buffer, sbappendaddr() should be used. To place
< * access rights and data in a socket receive buffer, sbappendrights()
< * should be used. In either case, the new data begins a new record.
< * Note that unlike sbappend() and sbappendrecord(), these routines check
< * for the caller that there will be enough space to store the data.
< * Each fails if there is not enough space, or if it cannot find mbufs
< * to store additional information in.
---
> * The routines sbappend() or sbappendrecord() are normally called to append
> * new mbufs to a socket buffer, after checking that adequate space is
> * available, comparing the function sbspace() with the amount of data to be
> * added. sbappendrecord() differs from sbappend() in that data supplied is
> * treated as the beginning of a new record. To place a sender's address,
> * optional access rights, and data in a socket receive buffer,
> * sbappendaddr() should be used. To place access rights and data in a
> * socket receive buffer, sbappendrights() should be used. In either case,
> * the new data begins a new record. Note that unlike sbappend() and
> * sbappendrecord(), these routines check for the caller that there will be
> * enough space to store the data. Each fails if there is not enough space,
> * or if it cannot find mbufs to store additional information in.
400,404c374,378
< * Reliable protocols may use the socket send buffer to hold data
< * awaiting acknowledgement. Data is normally copied from a socket
< * send buffer in a protocol with m_copy for output to a peer,
< * and then removing the data from the socket buffer with sbdrop()
< * or sbdroprecord() when the data is acknowledged by the peer.
---
> * Reliable protocols may use the socket send buffer to hold data awaiting
> * acknowledgement. Data is normally copied from a socket send buffer in a
> * protocol with m_copy for output to a peer, and then removing the data from
> * the socket buffer with sbdrop() or sbdroprecord() when the data is
> * acknowledged by the peer.
406d379
<
467,470c440,442
< * Append mbuf chain m to the last record in the
< * socket buffer sb. The additional space associated
< * the mbuf chain is recorded in sb. Empty mbufs are
< * discarded and mbufs are compacted where possible.
---
> * Append mbuf chain m to the last record in the socket buffer sb. The
> * additional space associated the mbuf chain is recorded in sb. Empty mbufs
> * are discarded and mbufs are compacted where possible.
473,475c445
< sbappend_locked(sb, m)
< struct sockbuf *sb;
< struct mbuf *m;
---
> sbappend_locked(struct sockbuf *sb, struct mbuf *m)
477c447
< register struct mbuf *n;
---
> struct mbuf *n;
521,524c491,493
< * Append mbuf chain m to the last record in the
< * socket buffer sb. The additional space associated
< * the mbuf chain is recorded in sb. Empty mbufs are
< * discarded and mbufs are compacted where possible.
---
> * Append mbuf chain m to the last record in the socket buffer sb. The
> * additional space associated the mbuf chain is recorded in sb. Empty mbufs
> * are discarded and mbufs are compacted where possible.
527,529c496
< sbappend(sb, m)
< struct sockbuf *sb;
< struct mbuf *m;
---
> sbappend(struct sockbuf *sb, struct mbuf *m)
538,540c505,507
< * This version of sbappend() should only be used when the caller
< * absolutely knows that there will never be more than one record
< * in the socket buffer, that is, a stream protocol (such as TCP).
---
> * This version of sbappend() should only be used when the caller absolutely
> * knows that there will never be more than one record in the socket buffer,
> * that is, a stream protocol (such as TCP).
559,561c526,528
< * This version of sbappend() should only be used when the caller
< * absolutely knows that there will never be more than one record
< * in the socket buffer, that is, a stream protocol (such as TCP).
---
> * This version of sbappend() should only be used when the caller absolutely
> * knows that there will never be more than one record in the socket buffer,
> * that is, a stream protocol (such as TCP).
574,575c541
< sbcheck(sb)
< struct sockbuf *sb;
---
> sbcheck(struct sockbuf *sb)
601,602c567
< * As above, except the mbuf chain
< * begins a new record.
---
> * As above, except the mbuf chain begins a new record.
605,607c570
< sbappendrecord_locked(sb, m0)
< register struct sockbuf *sb;
< register struct mbuf *m0;
---
> sbappendrecord_locked(struct sockbuf *sb, struct mbuf *m0)
609c572
< register struct mbuf *m;
---
> struct mbuf *m;
620,621c583,584
< * Put the first mbuf on the queue.
< * Note this permits zero length records.
---
> * Put the first mbuf on the queue. Note this permits zero length
> * records.
640,641c603
< * As above, except the mbuf chain
< * begins a new record.
---
> * As above, except the mbuf chain begins a new record.
644,646c606
< sbappendrecord(sb, m0)
< register struct sockbuf *sb;
< register struct mbuf *m0;
---
> sbappendrecord(struct sockbuf *sb, struct mbuf *m0)
655,658c615,618
< * Append address and data, and optionally, control (ancillary) data
< * to the receive queue of a socket. If present,
< * m0 must include a packet header with total length.
< * Returns 0 if no space in sockbuf or insufficient mbufs.
---
> * Append address and data, and optionally, control (ancillary) data to the
> * receive queue of a socket. If present, m0 must include a packet header
> * with total length. Returns 0 if no space in sockbuf or insufficient
> * mbufs.
661,664c621,622
< sbappendaddr_locked(sb, asa, m0, control)
< struct sockbuf *sb;
< const struct sockaddr *asa;
< struct mbuf *m0, *control;
---
> sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,
> struct mbuf *m0, struct mbuf *control)
707,710c665,668
< * Append address and data, and optionally, control (ancillary) data
< * to the receive queue of a socket. If present,
< * m0 must include a packet header with total length.
< * Returns 0 if no space in sockbuf or insufficient mbufs.
---
> * Append address and data, and optionally, control (ancillary) data to the
> * receive queue of a socket. If present, m0 must include a packet header
> * with total length. Returns 0 if no space in sockbuf or insufficient
> * mbufs.
713,716c671,672
< sbappendaddr(sb, asa, m0, control)
< struct sockbuf *sb;
< const struct sockaddr *asa;
< struct mbuf *m0, *control;
---
> sbappendaddr(struct sockbuf *sb, const struct sockaddr *asa,
> struct mbuf *m0, struct mbuf *control)
727,729c683,684
< sbappendcontrol_locked(sb, m0, control)
< struct sockbuf *sb;
< struct mbuf *control, *m0;
---
> sbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0,
> struct mbuf *control)
760,762c715
< sbappendcontrol(sb, m0, control)
< struct sockbuf *sb;
< struct mbuf *control, *m0;
---
> sbappendcontrol(struct sockbuf *sb, struct mbuf *m0, struct mbuf *control)
793,795c746
< sbcompress(sb, m, n)
< register struct sockbuf *sb;
< register struct mbuf *m, *n;
---
> sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
797,798c748,749
< register int eor = 0;
< register struct mbuf *o;
---
> int eor = 0;
> struct mbuf *o;
847,848c798
< * Free all mbufs in a sockbuf.
< * Check that all resources are reclaimed.
---
> * Free all mbufs in a sockbuf. Check that all resources are reclaimed.
851,852c801
< sbflush_internal(sb)
< register struct sockbuf *sb;
---
> sbflush_internal(struct sockbuf *sb)
856c805
< panic("sbflush_locked: locked");
---
> panic("sbflush_internal: locked");
867c816,817
< panic("sbflush_locked: cc %u || mb %p || mbcnt %u", sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt);
---
> panic("sbflush_internal: cc %u || mb %p || mbcnt %u",
> sb->sb_cc, (void *)sb->sb_mb, sb->sb_mbcnt);
871,872c821
< sbflush_locked(sb)
< register struct sockbuf *sb;
---
> sbflush_locked(struct sockbuf *sb)
880,881c829
< sbflush(sb)
< register struct sockbuf *sb;
---
> sbflush(struct sockbuf *sb)
893,895c841
< sbdrop_internal(sb, len)
< register struct sockbuf *sb;
< register int len;
---
> sbdrop_internal(struct sockbuf *sb, int len)
897c843
< register struct mbuf *m;
---
> struct mbuf *m;
931,933c877,878
< * First part is an inline SB_EMPTY_FIXUP(). Second part
< * makes sure sb_lastrecord is up-to-date if we dropped
< * part of the last record.
---
> * First part is an inline SB_EMPTY_FIXUP(). Second part makes sure
> * sb_lastrecord is up-to-date if we dropped part of the last record.
948,950c893
< sbdrop_locked(sb, len)
< register struct sockbuf *sb;
< register int len;
---
> sbdrop_locked(struct sockbuf *sb, int len)
959,961c902
< sbdrop(sb, len)
< register struct sockbuf *sb;
< register int len;
---
> sbdrop(struct sockbuf *sb, int len)
970,971c911,912
< * Drop a record off the front of a sockbuf
< * and move the next record to the front.
---
> * Drop a record off the front of a sockbuf and move the next record to the
> * front.
974,975c915
< sbdroprecord_locked(sb)
< register struct sockbuf *sb;
---
> sbdroprecord_locked(struct sockbuf *sb)
977c917
< register struct mbuf *m;
---
> struct mbuf *m;
993,994c933,934
< * Drop a record off the front of a sockbuf
< * and move the next record to the front.
---
> * Drop a record off the front of a sockbuf and move the next record to the
> * front.
997,998c937
< sbdroprecord(sb)
< register struct sockbuf *sb;
---
> sbdroprecord(struct sockbuf *sb)