From owner-svn-src-all@FreeBSD.ORG Fri Aug 27 18:50:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C9BE106566B; Fri, 27 Aug 2010 18:50:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 705558FC14; Fri, 27 Aug 2010 18:50:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7RIoCW5003705; Fri, 27 Aug 2010 18:50:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7RIoCnl003700; Fri, 27 Aug 2010 18:50:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008271850.o7RIoCnl003700@svn.freebsd.org> From: John Baldwin Date: Fri, 27 Aug 2010 18:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211889 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2010 18:50:12 -0000 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); }