diff options
author | John Baldwin <jhb@FreeBSD.org> | 2010-08-17 16:41:16 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2010-08-17 16:41:16 +0000 |
commit | c007b96a78972be20a2f1970e4a6f283b0e434b7 (patch) | |
tree | ac22d40e259520b3863696d63c529cccfd9def23 /sys/netinet/tcp_subr.c | |
parent | a122fea4ff5aef851b20383d0d5776c38e2422ff (diff) | |
download | src-c007b96a78972be20a2f1970e4a6f283b0e434b7.tar.gz src-c007b96a78972be20a2f1970e4a6f283b0e434b7.zip |
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).
Reviewed by: bz
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=211433
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index da478b3116ba..bfa3e663f005 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1022,8 +1022,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); } |