summaryrefslogtreecommitdiffstats
path: root/sys/netncp/ncp_conn.c
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2004-02-26 00:27:04 +0000
committertruckman <truckman@FreeBSD.org>2004-02-26 00:27:04 +0000
commit1de257deb3229812024de5861eb0aaa41e471448 (patch)
treed1174aae4c9e291961c623eba11458d6d2058f11 /sys/netncp/ncp_conn.c
parent50cda1680380cd332bc897ddc8f54d65ddf9aa9d (diff)
downloadFreeBSD-src-1de257deb3229812024de5861eb0aaa41e471448.zip
FreeBSD-src-1de257deb3229812024de5861eb0aaa41e471448.tar.gz
Split the mlock() kernel code into two parts, mlock(), which unpacks
the syscall arguments and does the suser() permission check, and kern_mlock(), which does the resource limit checking and calls vm_map_wire(). Split munlock() in a similar way. Enable the RLIMIT_MEMLOCK checking code in kern_mlock(). Replace calls to vslock() and vsunlock() in the sysctl code with calls to kern_mlock() and kern_munlock() so that the sysctl code will obey the wired memory limits. Nuke the vslock() and vsunlock() implementations, which are no longer used. Add a member to struct sysctl_req to track the amount of memory that is wired to handle the request. Modify sysctl_wire_old_buffer() to return an error if its call to kern_mlock() fails. Only wire the minimum of the length specified in the sysctl request and the length specified in its argument list. It is recommended that sysctl handlers that use sysctl_wire_old_buffer() should specify reasonable estimates for the amount of data they want to return so that only the minimum amount of memory is wired no matter what length has been specified by the request. Modify the callers of sysctl_wire_old_buffer() to look for the error return. Modify sysctl_old_user to obey the wired buffer length and clean up its implementation. Reviewed by: bms
Diffstat (limited to 'sys/netncp/ncp_conn.c')
-rw-r--r--sys/netncp/ncp_conn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netncp/ncp_conn.c b/sys/netncp/ncp_conn.c
index 00e0fa4..41a01ec 100644
--- a/sys/netncp/ncp_conn.c
+++ b/sys/netncp/ncp_conn.c
@@ -647,8 +647,9 @@ ncp_sysctl_connstat(SYSCTL_HANDLER_ARGS)
struct ncp_conn *ncp;
/* struct ucred *cred = req->td->td_ucred;*/
- error = 0;
- sysctl_wire_old_buffer(req, 0);
+ error = sysctl_wire_old_buffer(req, 0);
+ if (error != 0)
+ return (error);
ncp_conn_locklist(LK_SHARED, req->td);
error = SYSCTL_OUT(req, &ncp_conn_cnt, sizeof(ncp_conn_cnt));
SLIST_FOREACH(ncp, &conn_list, nc_next) {
OpenPOWER on IntegriCloud