| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_sysctl.c,v 1.237 2013/01/29 19:56:43 christos Exp $ */ | | 1 | /* $NetBSD: kern_sysctl.c,v 1.238 2013/01/29 23:00:31 para Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Brown. | | 8 | * by Andrew Brown. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -58,27 +58,27 @@ | | | @@ -58,27 +58,27 @@ |
58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
61 | * SUCH DAMAGE. | | 61 | * SUCH DAMAGE. |
62 | * | | 62 | * |
63 | * @(#)kern_sysctl.c 8.9 (Berkeley) 5/20/95 | | 63 | * @(#)kern_sysctl.c 8.9 (Berkeley) 5/20/95 |
64 | */ | | 64 | */ |
65 | | | 65 | |
66 | /* | | 66 | /* |
67 | * sysctl system call. | | 67 | * sysctl system call. |
68 | */ | | 68 | */ |
69 | | | 69 | |
70 | #include <sys/cdefs.h> | | 70 | #include <sys/cdefs.h> |
71 | __KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.237 2013/01/29 19:56:43 christos Exp $"); | | 71 | __KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.238 2013/01/29 23:00:31 para Exp $"); |
72 | | | 72 | |
73 | #include "opt_defcorename.h" | | 73 | #include "opt_defcorename.h" |
74 | #include "ksyms.h" | | 74 | #include "ksyms.h" |
75 | | | 75 | |
76 | #include <sys/param.h> | | 76 | #include <sys/param.h> |
77 | #define __COMPAT_SYSCTL | | 77 | #define __COMPAT_SYSCTL |
78 | #include <sys/sysctl.h> | | 78 | #include <sys/sysctl.h> |
79 | #include <sys/systm.h> | | 79 | #include <sys/systm.h> |
80 | #include <sys/buf.h> | | 80 | #include <sys/buf.h> |
81 | #include <sys/ksyms.h> | | 81 | #include <sys/ksyms.h> |
82 | #include <sys/malloc.h> | | 82 | #include <sys/malloc.h> |
83 | #include <sys/mount.h> | | 83 | #include <sys/mount.h> |
84 | #include <sys/syscallargs.h> | | 84 | #include <sys/syscallargs.h> |
| @@ -92,27 +92,27 @@ MALLOC_DEFINE(M_SYSCTLDATA, "sysctldata" | | | @@ -92,27 +92,27 @@ MALLOC_DEFINE(M_SYSCTLDATA, "sysctldata" |
92 | | | 92 | |
93 | static int sysctl_mmap(SYSCTLFN_PROTO); | | 93 | static int sysctl_mmap(SYSCTLFN_PROTO); |
94 | static int sysctl_alloc(struct sysctlnode *, int); | | 94 | static int sysctl_alloc(struct sysctlnode *, int); |
95 | static int sysctl_realloc(struct sysctlnode *); | | 95 | static int sysctl_realloc(struct sysctlnode *); |
96 | | | 96 | |
97 | static int sysctl_cvt_in(struct lwp *, int *, const void *, size_t, | | 97 | static int sysctl_cvt_in(struct lwp *, int *, const void *, size_t, |
98 | struct sysctlnode *); | | 98 | struct sysctlnode *); |
99 | static int sysctl_cvt_out(struct lwp *, int, const struct sysctlnode *, | | 99 | static int sysctl_cvt_out(struct lwp *, int, const struct sysctlnode *, |
100 | void *, size_t, size_t *); | | 100 | void *, size_t, size_t *); |
101 | | | 101 | |
102 | static int sysctl_log_add(struct sysctllog **, const struct sysctlnode *); | | 102 | static int sysctl_log_add(struct sysctllog **, const struct sysctlnode *); |
103 | static int sysctl_log_realloc(struct sysctllog *); | | 103 | static int sysctl_log_realloc(struct sysctllog *); |
104 | | | 104 | |
105 | typedef void (*sysctl_setup_func)(struct sysctllog **); | | 105 | typedef void sysctl_setup_func(struct sysctllog **); |
106 | | | 106 | |
107 | struct sysctllog { | | 107 | struct sysctllog { |
108 | const struct sysctlnode *log_root; | | 108 | const struct sysctlnode *log_root; |
109 | int *log_num; | | 109 | int *log_num; |
110 | int log_size, log_left; | | 110 | int log_size, log_left; |
111 | }; | | 111 | }; |
112 | | | 112 | |
113 | /* | | 113 | /* |
114 | * the "root" of the new sysctl tree | | 114 | * the "root" of the new sysctl tree |
115 | */ | | 115 | */ |
116 | struct sysctlnode sysctl_root = { | | 116 | struct sysctlnode sysctl_root = { |
117 | .sysctl_flags = SYSCTL_VERSION| | | 117 | .sysctl_flags = SYSCTL_VERSION| |
118 | CTLFLAG_ROOT|CTLFLAG_READWRITE| | | 118 | CTLFLAG_ROOT|CTLFLAG_READWRITE| |