summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2002-07-28 19:59:31 +0000
committertruckman <truckman@FreeBSD.org>2002-07-28 19:59:31 +0000
commitb1555a27432152cc7817d0c592bbcebf95fdfd19 (patch)
tree6dda6f0898c9f15fca929e63e72b3882862e67e1 /sys/netinet
parent5bd1876975f34760da2eea4bfce9c738127d36ca (diff)
downloadFreeBSD-src-b1555a27432152cc7817d0c592bbcebf95fdfd19.zip
FreeBSD-src-b1555a27432152cc7817d0c592bbcebf95fdfd19.tar.gz
Wire the sysctl output buffer before grabbing any locks to prevent
SYSCTL_OUT() from blocking while locks are held. This should only be done when it would be inconvenient to make a temporary copy of the data and defer calling SYSCTL_OUT() until after the locks are released.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_subr.c3
-rw-r--r--sys/netinet/tcp_timewait.c3
-rw-r--r--sys/netinet/udp_usrreq.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index c2799d5..0c4b385 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -841,6 +841,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
INP_INFO_RUNLOCK(&tcbinfo);
splx(s);
+ sysctl_wire_old_buffer(req, 2 * (sizeof xig)
+ + n * sizeof(struct xtcpcb));
+
xig.xig_len = sizeof xig;
xig.xig_count = n;
xig.xig_gen = gencnt;
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index c2799d5..0c4b385 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -841,6 +841,9 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
INP_INFO_RUNLOCK(&tcbinfo);
splx(s);
+ sysctl_wire_old_buffer(req, 2 * (sizeof xig)
+ + n * sizeof(struct xtcpcb));
+
xig.xig_len = sizeof xig;
xig.xig_count = n;
xig.xig_gen = gencnt;
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 56bb1e1..b93e99e 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -598,6 +598,9 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
n = udbinfo.ipi_count;
splx(s);
+ sysctl_wire_old_buffer(req, 2 * (sizeof xig)
+ + n * sizeof(struct xinpcb));
+
xig.xig_len = sizeof xig;
xig.xig_count = n;
xig.xig_gen = gencnt;
OpenPOWER on IntegriCloud