diff options
author | mdf <mdf@FreeBSD.org> | 2011-01-27 00:34:12 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2011-01-27 00:34:12 +0000 |
commit | 7fc649fc41274dcd3ffbed0d354a418b71e65786 (patch) | |
tree | e4eadeb1ff33d6db2e7b3001b1b8a9e9c21e2a2f /sys/kern/kern_sysctl.c | |
parent | 886222db75f8a2f0e19f97934a5375f602e0987a (diff) | |
download | FreeBSD-src-7fc649fc41274dcd3ffbed0d354a418b71e65786.zip FreeBSD-src-7fc649fc41274dcd3ffbed0d354a418b71e65786.tar.gz |
Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9). This allows using an sbuf with a SYSCTL_OUT
drain for extremely large amounts of data where the caller knows that
appropriate references are held, and sleeping is not an issue.
Inspired by: rwatson
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r-- | sys/kern/kern_sysctl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 7769a6d..cde8a0c 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1591,7 +1591,8 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, } /* - * Drain into a sysctl struct. The user buffer must be wired. + * Drain into a sysctl struct. The user buffer should be wired if a page + * fault would cause issue. */ static int sbuf_sysctl_drain(void *arg, const char *data, int len) @@ -1609,9 +1610,6 @@ sbuf_new_for_sysctl(struct sbuf *s, char *buf, int length, struct sysctl_req *req) { - /* Wire the user buffer, so we can write without blocking. */ - sysctl_wire_old_buffer(req, 0); - s = sbuf_new(s, buf, length, SBUF_FIXEDLEN); sbuf_set_drain(s, sbuf_sysctl_drain, req); return (s); |