1
2
3
4
5
6
7 #include <linux/lists.h>
8
9 #ifndef _LINUX_SYSCTL_H
10 #define _LINUX_SYSCTL_H
11
12 #define CTL_MAXNAME 10
13
14 struct __sysctl_args {
15 int *name;
16 int nlen;
17 void *oldval;
18 size_t *oldlenp;
19 void *newval;
20 size_t newlen;
21 unsigned long __unused[4];
22 };
23
24
25
26
27
28
29 #ifdef __KERNEL__
30 #define CTL_ANY -1
31 #define CTL_NONE 0
32 #endif
33
34 #define CTL_KERN 1
35 #define CTL_VM 2
36 #define CTL_NET 3
37 #define CTL_PROC 4
38 #define CTL_FS 5
39 #define CTL_DEBUG 6
40 #define CTL_DEV 7
41 #define CTL_MAXID 8
42
43
44 #define KERN_OSTYPE 1
45 #define KERN_OSRELEASE 2
46 #define KERN_OSREV 3
47 #define KERN_VERSION 4
48 #define KERN_SECUREMASK 5
49 #define KERN_PROF 6
50 #define KERN_NODENAME 7
51 #define KERN_DOMAINNAME 8
52 #define KERN_NRINODE 9
53 #define KERN_MAXINODE 10
54 #define KERN_NRFILE 11
55 #define KERN_MAXFILE 12
56 #define KERN_MAXID 13
57 #define KERN_SECURELVL 14
58 #define KERN_PANIC 15
59 #define KERN_REALROOTDEV 16
60 #define KERN_NFSRNAME 17
61 #define KERN_NFSRADDRS 18
62
63
64 #define VM_SWAPCTL 1
65 #define VM_KSWAPD 2
66 #define VM_FREEPG 3
67 #define VM_BDFLUSH 4
68 #define VM_MAXID 5
69
70
71
72
73 #define NET_CORE 0x01000000
74
75
76 #define NET_ETHER 0x02000000
77
78
79 #define NET_802 0x03000000
80
81
82 #define NET_UNIX 0x04000000
83
84
85 #define NET_IPV4 0x05000000
86
87
88 #define NET_IPX 0x06000000
89
90
91 #define NET_ATALK 0x07000000
92
93
94 #define NET_NETROM 0x08000000
95
96
97 #define NET_AX25 0x09000000
98
99
100
101
102
103
104
105
106
107 #ifdef __KERNEL__
108
109 extern asmlinkage int sys_sysctl(struct __sysctl_args *);
110 extern void init_sysctl(void);
111
112 typedef struct ctl_table ctl_table;
113
114 typedef int ctl_handler (ctl_table *table, int *name, int nlen,
115 void *oldval, size_t *oldlenp,
116 void *newval, size_t newlen,
117 void **context);
118
119 typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
120 void *buffer, size_t *lenp);
121
122 extern int proc_dostring(ctl_table *, int, struct file *,
123 void *, size_t *);
124 extern int proc_dointvec(ctl_table *, int, struct file *,
125 void *, size_t *);
126 extern int proc_dointvec_minmax(ctl_table *, int, struct file *,
127 void *, size_t *);
128
129 extern int do_sysctl (int *name, int nlen,
130 void *oldval, size_t *oldlenp,
131 void *newval, size_t newlen);
132
133 extern int do_sysctl_strategy (ctl_table *table,
134 int *name, int nlen,
135 void *oldval, size_t *oldlenp,
136 void *newval, size_t newlen, void ** context);
137
138 extern ctl_handler sysctl_string;
139 extern ctl_handler sysctl_intvec;
140
141 extern int do_string (
142 void *oldval, size_t *oldlenp, void *newval, size_t newlen,
143 int rdwr, char *data, size_t max);
144 extern int do_int (
145 void *oldval, size_t *oldlenp, void *newval, size_t newlen,
146 int rdwr, int *data);
147 extern int do_struct (
148 void *oldval, size_t *oldlenp, void *newval, size_t newlen,
149 int rdwr, void *data, size_t len);
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190 struct ctl_table
191 {
192 int ctl_name;
193 const char *procname;
194 void *data;
195 int maxlen;
196 mode_t mode;
197 ctl_table *child;
198 proc_handler *proc_handler;
199 ctl_handler *strategy;
200 struct proc_dir_entry *de;
201 void *extra1;
202 void *extra2;
203 };
204
205
206
207 struct ctl_table_header
208 {
209 ctl_table *ctl_table;
210 DLNODE(struct ctl_table_header) ctl_entry;
211 };
212
213 struct ctl_table_header * register_sysctl_table(ctl_table * table,
214 int insert_at_head);
215 void unregister_sysctl_table(struct ctl_table_header * table);
216
217 #else
218
219 #endif
220
221 #endif