svn commit: r211889 - stable/8/sys/netinet

John Baldwin jhb at FreeBSD.org
Fri Aug 27 18:50:12 UTC 2010


Author: jhb
Date: Fri Aug 27 18:50:12 2010
New Revision: 211889
URL: http://svn.freebsd.org/changeset/base/211889

Log:
  MFC 211433:
  Ensure a minimum "slop" of 10 extra pcb structures when providing a
  memory size estimate to userland for pcb list sysctls.  The previous
  behavior of a "slop" of n/8 does not work well for small values of n
  (e.g. no slop at all if you have less than 8 open UDP connections).

Modified:
  stable/8/sys/netinet/ip_divert.c
  stable/8/sys/netinet/raw_ip.c
  stable/8/sys/netinet/tcp_subr.c
  stable/8/sys/netinet/udp_usrreq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/ip_divert.c
==============================================================================
--- stable/8/sys/netinet/ip_divert.c	Fri Aug 27 18:17:46 2010	(r211888)
+++ stable/8/sys/netinet/ip_divert.c	Fri Aug 27 18:50:12 2010	(r211889)
@@ -614,8 +614,8 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 	 */
 	if (req->oldptr == 0) {
 		n = V_divcbinfo.ipi_count;
-		req->oldidx = 2 * (sizeof xig)
-			+ (n + n/8) * sizeof(struct xinpcb);
+		n += imax(n / 8, 10);
+		req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb);
 		return 0;
 	}
 

Modified: stable/8/sys/netinet/raw_ip.c
==============================================================================
--- stable/8/sys/netinet/raw_ip.c	Fri Aug 27 18:17:46 2010	(r211888)
+++ stable/8/sys/netinet/raw_ip.c	Fri Aug 27 18:50:12 2010	(r211889)
@@ -1007,8 +1007,8 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
 	 */
 	if (req->oldptr == 0) {
 		n = V_ripcbinfo.ipi_count;
-		req->oldidx = 2 * (sizeof xig)
-		    + (n + n/8) * sizeof(struct xinpcb);
+		n += imax(n / 8, 10);
+		req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb);
 		return (0);
 	}
 

Modified: stable/8/sys/netinet/tcp_subr.c
==============================================================================
--- stable/8/sys/netinet/tcp_subr.c	Fri Aug 27 18:17:46 2010	(r211888)
+++ stable/8/sys/netinet/tcp_subr.c	Fri Aug 27 18:50:12 2010	(r211889)
@@ -1018,8 +1018,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 	if (req->oldptr == NULL) {
 		m = syncache_pcbcount();
 		n = V_tcbinfo.ipi_count;
-		req->oldidx = 2 * (sizeof xig)
-			+ ((m + n) + n/8) * sizeof(struct xtcpcb);
+		n += imax(n / 8, 10);
+		req->oldidx = 2 * (sizeof xig) +
+		    (m + n) * sizeof(struct xtcpcb);
 		return (0);
 	}
 

Modified: stable/8/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/udp_usrreq.c	Fri Aug 27 18:17:46 2010	(r211888)
+++ stable/8/sys/netinet/udp_usrreq.c	Fri Aug 27 18:50:12 2010	(r211889)
@@ -727,8 +727,8 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 	 */
 	if (req->oldptr == 0) {
 		n = V_udbinfo.ipi_count;
-		req->oldidx = 2 * (sizeof xig)
-			+ (n + n/8) * sizeof(struct xinpcb);
+		n += imax(n / 8, 10);
+		req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb);
 		return (0);
 	}
 


More information about the svn-src-stable-8 mailing list