diff options
author | truckman <truckman@FreeBSD.org> | 2002-07-28 19:59:31 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2002-07-28 19:59:31 +0000 |
commit | b1555a27432152cc7817d0c592bbcebf95fdfd19 (patch) | |
tree | 6dda6f0898c9f15fca929e63e72b3882862e67e1 /sys | |
parent | 5bd1876975f34760da2eea4bfce9c738127d36ca (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/kern/kern_descrip.c | 1 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 1 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 1 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 1 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 3 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 3 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 3 | ||||
-rw-r--r-- | sys/netncp/ncp_conn.c | 1 | ||||
-rw-r--r-- | sys/netsmb/smb_conn.c | 1 |
9 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 43a7e44..06aca87 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2043,6 +2043,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) int error; struct file *fp; + sysctl_wire_old_buffer(req, 0); sx_slock(&filelist_lock); if (!req->oldptr) { /* diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 53b3eed..18644df 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -193,6 +193,7 @@ sysctl_kern_randompid(SYSCTL_HANDLER_ARGS) { int error, pid; + sysctl_wire_old_buffer(req, sizeof(int)); sx_xlock(&allproc_lock); pid = randompid; error = sysctl_handle_int(oidp, &pid, 0, req); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 3547196..6cf9fe9 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1023,6 +1023,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) if (error) return (error); } + sysctl_wire_old_buffer(req, 0); sx_slock(&allproc_lock); for (doingzomb=0 ; doingzomb < 2 ; doingzomb++) { if (!doingzomb) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4d87718..1684782 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2652,6 +2652,7 @@ sysctl_vnode(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, 0, (numvnodes + KINFO_VNODESLOP) * (VPTRSZ + VNODESZ))); + sysctl_wire_old_buffer(req, 0); mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { if (vfs_busy(mp, LK_NOWAIT, &mountlist_mtx, td)) { 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; diff --git a/sys/netncp/ncp_conn.c b/sys/netncp/ncp_conn.c index 85f4163..14b8d7b 100644 --- a/sys/netncp/ncp_conn.c +++ b/sys/netncp/ncp_conn.c @@ -633,6 +633,7 @@ ncp_sysctl_connstat(SYSCTL_HANDLER_ARGS) { /* struct ucred *cred = req->p->p_ucred;*/ error = 0; + sysctl_wire_old_buffer(req, 0); ncp_conn_locklist(LK_SHARED, req->p); error = SYSCTL_OUT(req, &ncp_conn_cnt, sizeof(ncp_conn_cnt)); SLIST_FOREACH(ncp, &conn_list, nc_next) { diff --git a/sys/netsmb/smb_conn.c b/sys/netsmb/smb_conn.c index 657c469..9c52571 100644 --- a/sys/netsmb/smb_conn.c +++ b/sys/netsmb/smb_conn.c @@ -834,6 +834,7 @@ smb_sysctl_treedump(SYSCTL_HANDLER_ARGS) int error, itype; smb_makescred(&scred, td, td->td_ucred); + sysctl_wire_old_buffer(req, 0); error = smb_sm_lockvclist(LK_SHARED, td); if (error) return error; |