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
This commit is contained in:
parent
a122fea4ff
commit
c007b96a78
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211433
@ -592,8 +592,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;
|
||||
}
|
||||
|
||||
|
@ -993,8 +993,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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -707,8 +707,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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user