kern_sysctl.c (16282) | kern_sysctl.c (17971) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 |
40 * $Id: kern_sysctl.c,v 1.63 1996/06/06 17:17:54 phk Exp $ | 40 * $Id: kern_sysctl.c,v 1.64 1996/06/10 16:23:30 nate Exp $ |
41 */ 42 43#include <sys/param.h> 44#include <sys/kernel.h> 45#include <sys/sysctl.h> 46#include <sys/malloc.h> 47#include <sys/proc.h> 48#include <sys/systm.h> --- 514 unchanged lines hidden (view full) --- 563static int 564sysctl_old_kernel(struct sysctl_req *req, const void *p, int l) 565{ 566 int i = 0; 567 568 if (req->oldptr) { 569 i = min(req->oldlen - req->oldidx, l); 570 if (i > 0) | 41 */ 42 43#include <sys/param.h> 44#include <sys/kernel.h> 45#include <sys/sysctl.h> 46#include <sys/malloc.h> 47#include <sys/proc.h> 48#include <sys/systm.h> --- 514 unchanged lines hidden (view full) --- 563static int 564sysctl_old_kernel(struct sysctl_req *req, const void *p, int l) 565{ 566 int i = 0; 567 568 if (req->oldptr) { 569 i = min(req->oldlen - req->oldidx, l); 570 if (i > 0) |
571 bcopy(p, req->oldptr + req->oldidx, i); | 571 bcopy(p, (char *)req->oldptr + req->oldidx, i); |
572 } 573 req->oldidx += l; 574 if (req->oldptr && i != l) 575 return (ENOMEM); 576 return (0); 577} 578 579static int 580sysctl_new_kernel(struct sysctl_req *req, void *p, int l) 581{ 582 if (!req->newptr) 583 return 0; 584 if (req->newlen - req->newidx < l) 585 return (EINVAL); | 572 } 573 req->oldidx += l; 574 if (req->oldptr && i != l) 575 return (ENOMEM); 576 return (0); 577} 578 579static int 580sysctl_new_kernel(struct sysctl_req *req, void *p, int l) 581{ 582 if (!req->newptr) 583 return 0; 584 if (req->newlen - req->newidx < l) 585 return (EINVAL); |
586 bcopy(req->newptr + req->newidx, p, l); | 586 bcopy((char *)req->newptr + req->newidx, p, l); |
587 req->newidx += l; 588 return (0); 589} 590 591int 592kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, int *retval) 593{ 594 int error = 0; --- 62 unchanged lines hidden (view full) --- 657 658 if (req->lock == 1 && req->oldptr) { 659 vslock(req->oldptr, req->oldlen); 660 req->lock = 2; 661 } 662 if (req->oldptr) { 663 i = min(req->oldlen - req->oldidx, l); 664 if (i > 0) | 587 req->newidx += l; 588 return (0); 589} 590 591int 592kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, int *retval) 593{ 594 int error = 0; --- 62 unchanged lines hidden (view full) --- 657 658 if (req->lock == 1 && req->oldptr) { 659 vslock(req->oldptr, req->oldlen); 660 req->lock = 2; 661 } 662 if (req->oldptr) { 663 i = min(req->oldlen - req->oldidx, l); 664 if (i > 0) |
665 error = copyout(p, req->oldptr + req->oldidx, i); | 665 error = copyout(p, (char *)req->oldptr + req->oldidx, 666 i); |
666 } 667 req->oldidx += l; 668 if (error) 669 return (error); 670 if (req->oldptr && i < l) 671 return (ENOMEM); 672 return (0); 673} 674 675static int 676sysctl_new_user(struct sysctl_req *req, void *p, int l) 677{ 678 int error; 679 680 if (!req->newptr) 681 return 0; 682 if (req->newlen - req->newidx < l) 683 return (EINVAL); | 667 } 668 req->oldidx += l; 669 if (error) 670 return (error); 671 if (req->oldptr && i < l) 672 return (ENOMEM); 673 return (0); 674} 675 676static int 677sysctl_new_user(struct sysctl_req *req, void *p, int l) 678{ 679 int error; 680 681 if (!req->newptr) 682 return 0; 683 if (req->newlen - req->newidx < l) 684 return (EINVAL); |
684 error = copyin(req->newptr + req->newidx, p, l); | 685 error = copyin((char *)req->newptr + req->newidx, p, l); |
685 req->newidx += l; 686 return (error); 687} 688 689/* 690 * Traverse our tree, and find the right node, execute whatever it points 691 * at, and return the resulting error code. 692 */ --- 383 unchanged lines hidden --- | 686 req->newidx += l; 687 return (error); 688} 689 690/* 691 * Traverse our tree, and find the right node, execute whatever it points 692 * at, and return the resulting error code. 693 */ --- 383 unchanged lines hidden --- |