[Differential] [Updated, 12 lines] D4129: Bug 204438 - setsockopt() handling of kern.ipc.maxsockbuf limit

cameronsparr_gmail.com (Cameron Sparr) phabric-noreply at FreeBSD.org
Wed Nov 11 23:39:48 UTC 2015


cameronsparr_gmail.com removed rS FreeBSD src repository as the repository for this revision.
cameronsparr_gmail.com updated this revision to Diff 10121.
cameronsparr_gmail.com added a comment.


  spaces to tabs

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D4129?vs=10120&id=10121

REVISION DETAIL
  https://reviews.freebsd.org/D4129

AFFECTED FILES
  sys/kern/uipc_sockbuf.c

CHANGE DETAILS
  diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
  --- a/sys/kern/uipc_sockbuf.c
  +++ b/sys/kern/uipc_sockbuf.c
  @@ -397,7 +397,7 @@
   	sb_max_adj = (u_quad_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES);
   	return (0);
   }
  -	
  +
   /*
    * Allot mbufs to a sockbuf.  Attempt to scale mbmax so that mbcnt doesn't
    * become limiting if buffering efficiency is near the normal case.
  @@ -417,8 +417,12 @@
   	 * appropriate thread resource limits are available.  In that case,
   	 * we don't apply a process limit.
   	 */
  -	if (cc > sb_max_adj)
  +	if (cc > sb_max)
   		return (0);
  +
  +	if (cc > sb_max_adj)
  +		cc = sb_max_adj;
  +
   	if (td != NULL) {
   		sbsize_limit = lim_cur(td, RLIMIT_SBSIZE);
   	} else
  @@ -433,7 +437,7 @@
   }
   
   int
  -sbreserve(struct sockbuf *sb, u_long cc, struct socket *so, 
  +sbreserve(struct sockbuf *sb, u_long cc, struct socket *so,
       struct thread *td)
   {
   	int error;
  @@ -1297,7 +1301,7 @@
   	xsb->sb_cc = sb->sb_ccc;
   	xsb->sb_hiwat = sb->sb_hiwat;
   	xsb->sb_mbcnt = sb->sb_mbcnt;
  -	xsb->sb_mcnt = sb->sb_mcnt;	
  +	xsb->sb_mcnt = sb->sb_mcnt;
   	xsb->sb_ccnt = sb->sb_ccnt;
   	xsb->sb_mbmax = sb->sb_mbmax;
   	xsb->sb_lowat = sb->sb_lowat;

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: cameronsparr_gmail.com, Contributor Reviewers, network
Cc: freebsd-net-list, imp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4129.10121.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20151111/d60b163c/attachment.bin>


More information about the freebsd-net mailing list