1 |
199 |
simons |
/*
|
2 |
|
|
* sysctl.h: General linux system control interface
|
3 |
|
|
*
|
4 |
|
|
* Begun 24 March 1995, Stephen Tweedie
|
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 |
|
|
/* Define sysctl names first */
|
25 |
|
|
|
26 |
|
|
/* Top-level names: */
|
27 |
|
|
|
28 |
|
|
/* For internal pattern-matching use only: */
|
29 |
|
|
#ifdef __KERNEL__
|
30 |
|
|
#define CTL_ANY -1 /* Matches any name */
|
31 |
|
|
#define CTL_NONE 0
|
32 |
|
|
#endif
|
33 |
|
|
|
34 |
|
|
#define CTL_KERN 1 /* General kernel info and control */
|
35 |
|
|
#define CTL_VM 2 /* VM management */
|
36 |
|
|
#define CTL_NET 3 /* Networking */
|
37 |
|
|
#define CTL_PROC 4 /* Process info */
|
38 |
|
|
#define CTL_FS 5 /* Filesystems */
|
39 |
|
|
#define CTL_DEBUG 6 /* Debugging */
|
40 |
|
|
#define CTL_DEV 7 /* Devices */
|
41 |
|
|
#define CTL_MAXID 8
|
42 |
|
|
|
43 |
|
|
/* CTL_KERN names: */
|
44 |
|
|
#define KERN_OSTYPE 1 /* string: system version */
|
45 |
|
|
#define KERN_OSRELEASE 2 /* string: system release */
|
46 |
|
|
#define KERN_OSREV 3 /* int: system revision */
|
47 |
|
|
#define KERN_VERSION 4 /* string: compile time info */
|
48 |
|
|
#define KERN_SECUREMASK 5 /* struct: maximum rights mask */
|
49 |
|
|
#define KERN_PROF 6 /* table: profiling information */
|
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 /* int: system security level */
|
58 |
|
|
#define KERN_PANIC 15 /* int: panic timeout */
|
59 |
|
|
#define KERN_REALROOTDEV 16 /* real root device to mount after initrd */
|
60 |
|
|
#define KERN_NFSRNAME 17 /* NFS root name */
|
61 |
|
|
#define KERN_NFSRADDRS 18 /* NFS root addresses */
|
62 |
|
|
#define KERN_JAVA_INTERPRETER 19 /* path to Java(tm) interpreter */
|
63 |
|
|
#define KERN_JAVA_APPLETVIEWER 20 /* path to Java(tm) appletviewer */
|
64 |
|
|
|
65 |
|
|
/* CTL_VM names: */
|
66 |
|
|
#define VM_SWAPCTL 1 /* struct: Set vm swapping control */
|
67 |
|
|
#define VM_KSWAPD 2 /* struct: control background pageout */
|
68 |
|
|
#define VM_FREEPG 3 /* struct: Set free page thresholds */
|
69 |
|
|
#define VM_BDFLUSH 4 /* struct: Control buffer cache flushing */
|
70 |
|
|
#define VM_MAXID 5
|
71 |
|
|
|
72 |
|
|
/* CTL_NET names: */
|
73 |
|
|
#define NET_CORE 1
|
74 |
|
|
#define NET_ETHER 2
|
75 |
|
|
#define NET_802 3
|
76 |
|
|
#define NET_UNIX 4
|
77 |
|
|
#define NET_IPV4 5
|
78 |
|
|
#define NET_IPX 6
|
79 |
|
|
#define NET_ATALK 7
|
80 |
|
|
#define NET_NETROM 8
|
81 |
|
|
#define NET_AX25 9
|
82 |
|
|
#define NET_BRIDGE 10
|
83 |
|
|
#define NET_ROSE 11
|
84 |
|
|
|
85 |
|
|
/* /proc/sys/net/core */
|
86 |
|
|
#define NET_CORE_NET_ALIAS_MAX 1
|
87 |
|
|
|
88 |
|
|
/* /proc/sys/net/ethernet */
|
89 |
|
|
|
90 |
|
|
/* /proc/sys/net/802 */
|
91 |
|
|
|
92 |
|
|
/* /proc/sys/net/unix */
|
93 |
|
|
|
94 |
|
|
/* /proc/sys/net/ipv4 */
|
95 |
|
|
#define NET_IPV4_ARP_RES_TIME 1
|
96 |
|
|
#define NET_IPV4_ARP_DEAD_RES_TIME 2
|
97 |
|
|
#define NET_IPV4_ARP_MAX_TRIES 3
|
98 |
|
|
#define NET_IPV4_ARP_TIMEOUT 4
|
99 |
|
|
#define NET_IPV4_ARP_CHECK_INTERVAL 5
|
100 |
|
|
#define NET_IPV4_ARP_CONFIRM_INTERVAL 6
|
101 |
|
|
#define NET_IPV4_ARP_CONFIRM_TIMEOUT 7
|
102 |
|
|
#define NET_IPV4_FORWARD 8
|
103 |
|
|
#define NET_IPV4_DYNADDR 9
|
104 |
|
|
|
105 |
|
|
/* /proc/sys/net/ipx */
|
106 |
|
|
|
107 |
|
|
/* /proc/sys/net/appletalk */
|
108 |
|
|
|
109 |
|
|
/* /proc/sys/net/netrom */
|
110 |
|
|
#define NET_NETROM_DEFAULT_PATH_QUALITY 1
|
111 |
|
|
#define NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER 2
|
112 |
|
|
#define NET_NETROM_NETWORK_TTL_INITIALISER 3
|
113 |
|
|
#define NET_NETROM_TRANSPORT_TIMEOUT 4
|
114 |
|
|
#define NET_NETROM_TRANSPORT_MAXIMUM_TRIES 5
|
115 |
|
|
#define NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY 6
|
116 |
|
|
#define NET_NETROM_TRANSPORT_BUSY_DELAY 7
|
117 |
|
|
#define NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE 8
|
118 |
|
|
#define NET_NETROM_ROUTING_CONTROL 9
|
119 |
|
|
#define NET_NETROM_LINK_FAILS_COUNT 10
|
120 |
|
|
|
121 |
|
|
/* /proc/sys/net/ax25 */
|
122 |
|
|
#define NET_AX25_IP_DEFAULT_MODE 1
|
123 |
|
|
#define NET_AX25_DEFAULT_MODE 2
|
124 |
|
|
#define NET_AX25_BACKOFF_TYPE 3
|
125 |
|
|
#define NET_AX25_CONNECT_MODE 4
|
126 |
|
|
#define NET_AX25_STANDARD_WINDOW 5
|
127 |
|
|
#define NET_AX25_EXTENDED_WINDOW 6
|
128 |
|
|
#define NET_AX25_T1_TIMEOUT 7
|
129 |
|
|
#define NET_AX25_T2_TIMEOUT 8
|
130 |
|
|
#define NET_AX25_T3_TIMEOUT 9
|
131 |
|
|
#define NET_AX25_IDLE_TIMEOUT 10
|
132 |
|
|
#define NET_AX25_N2 11
|
133 |
|
|
#define NET_AX25_PACLEN 12
|
134 |
|
|
|
135 |
|
|
/* /proc/sys/net/rose */
|
136 |
|
|
#define NET_ROSE_RESTART_REQUEST_TIMEOUT 1
|
137 |
|
|
#define NET_ROSE_CALL_REQUEST_TIMEOUT 2
|
138 |
|
|
#define NET_ROSE_RESET_REQUEST_TIMEOUT 3
|
139 |
|
|
#define NET_ROSE_CLEAR_REQUEST_TIMEOUT 4
|
140 |
|
|
#define NET_ROSE_ACK_HOLD_BACK_TIMEOUT 5
|
141 |
|
|
#define NET_ROSE_ROUTING_CONTROL 6
|
142 |
|
|
#define NET_ROSE_LINK_FAIL_TIMEOUT 7
|
143 |
|
|
#define NET_ROSE_MAX_VCS 8
|
144 |
|
|
#define NET_ROSE_WINDOW_SIZE 9
|
145 |
|
|
|
146 |
|
|
/* CTL_PROC names: */
|
147 |
|
|
|
148 |
|
|
/* CTL_FS names: */
|
149 |
|
|
|
150 |
|
|
/* CTL_DEBUG names: */
|
151 |
|
|
|
152 |
|
|
/* CTL_DEV names: */
|
153 |
|
|
|
154 |
|
|
#ifdef __KERNEL__
|
155 |
|
|
|
156 |
|
|
extern asmlinkage int sys_sysctl(struct __sysctl_args *);
|
157 |
|
|
extern void init_sysctl(void);
|
158 |
|
|
|
159 |
|
|
typedef struct ctl_table ctl_table;
|
160 |
|
|
|
161 |
|
|
typedef int ctl_handler (ctl_table *table, int *name, int nlen,
|
162 |
|
|
void *oldval, size_t *oldlenp,
|
163 |
|
|
void *newval, size_t newlen,
|
164 |
|
|
void **context);
|
165 |
|
|
|
166 |
|
|
typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
|
167 |
|
|
void *buffer, size_t *lenp);
|
168 |
|
|
|
169 |
|
|
extern int proc_dostring(ctl_table *, int, struct file *,
|
170 |
|
|
void *, size_t *);
|
171 |
|
|
extern int proc_dointvec(ctl_table *, int, struct file *,
|
172 |
|
|
void *, size_t *);
|
173 |
|
|
extern int proc_dointvec_minmax(ctl_table *, int, struct file *,
|
174 |
|
|
void *, size_t *);
|
175 |
|
|
|
176 |
|
|
extern int do_sysctl (int *name, int nlen,
|
177 |
|
|
void *oldval, size_t *oldlenp,
|
178 |
|
|
void *newval, size_t newlen);
|
179 |
|
|
|
180 |
|
|
extern int do_sysctl_strategy (ctl_table *table,
|
181 |
|
|
int *name, int nlen,
|
182 |
|
|
void *oldval, size_t *oldlenp,
|
183 |
|
|
void *newval, size_t newlen, void ** context);
|
184 |
|
|
|
185 |
|
|
extern ctl_handler sysctl_string;
|
186 |
|
|
extern ctl_handler sysctl_intvec;
|
187 |
|
|
|
188 |
|
|
extern int do_string (
|
189 |
|
|
void *oldval, size_t *oldlenp, void *newval, size_t newlen,
|
190 |
|
|
int rdwr, char *data, size_t max);
|
191 |
|
|
extern int do_int (
|
192 |
|
|
void *oldval, size_t *oldlenp, void *newval, size_t newlen,
|
193 |
|
|
int rdwr, int *data);
|
194 |
|
|
extern int do_struct (
|
195 |
|
|
void *oldval, size_t *oldlenp, void *newval, size_t newlen,
|
196 |
|
|
int rdwr, void *data, size_t len);
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
/*
|
200 |
|
|
* Register a set of sysctl names by calling register_sysctl_table
|
201 |
|
|
* with an initialised array of ctl_table's. An entry with zero
|
202 |
|
|
* ctl_name terminates the table. table->de will be set up by the
|
203 |
|
|
* registration and need not be initialised in advance.
|
204 |
|
|
*
|
205 |
|
|
* sysctl names can be mirrored automatically under /proc/sys. The
|
206 |
|
|
* procname supplied controls /proc naming.
|
207 |
|
|
*
|
208 |
|
|
* The table's mode will be honoured both for sys_sysctl(2) and
|
209 |
|
|
* proc-fs access.
|
210 |
|
|
*
|
211 |
|
|
* Leaf nodes in the sysctl tree will be represented by a single file
|
212 |
|
|
* under /proc; non-leaf nodes will be represented by directories. A
|
213 |
|
|
* null procname disables /proc mirroring at this node.
|
214 |
|
|
*
|
215 |
|
|
* sysctl(2) can automatically manage read and write requests through
|
216 |
|
|
* the sysctl table. The data and maxlen fields of the ctl_table
|
217 |
|
|
* struct enable minimal validation of the values being written to be
|
218 |
|
|
* performed, and the mode field allows minimal authentication.
|
219 |
|
|
*
|
220 |
|
|
* More sophisticated management can be enabled by the provision of a
|
221 |
|
|
* strategy routine with the table entry. This will be called before
|
222 |
|
|
* any automatic read or write of the data is performed.
|
223 |
|
|
*
|
224 |
|
|
* The strategy routine may return:
|
225 |
|
|
* <0: Error occurred (error is passed to user process)
|
226 |
|
|
* 0: OK - proceed with automatic read or write.
|
227 |
|
|
* >0: OK - read or write has been done by the strategy routine, so
|
228 |
|
|
* return immediately.
|
229 |
|
|
*
|
230 |
|
|
* There must be a proc_handler routine for any terminal nodes
|
231 |
|
|
* mirrored under /proc/sys (non-terminals are handled by a built-in
|
232 |
|
|
* directory handler). Several default handlers are available to
|
233 |
|
|
* cover common cases.
|
234 |
|
|
*/
|
235 |
|
|
|
236 |
|
|
/* A sysctl table is an array of struct ctl_table: */
|
237 |
|
|
struct ctl_table
|
238 |
|
|
{
|
239 |
|
|
int ctl_name; /* Binary ID */
|
240 |
|
|
const char *procname; /* Text ID for /proc/sys, or zero */
|
241 |
|
|
void *data;
|
242 |
|
|
int maxlen;
|
243 |
|
|
mode_t mode;
|
244 |
|
|
ctl_table *child;
|
245 |
|
|
proc_handler *proc_handler; /* Callback for text formatting */
|
246 |
|
|
ctl_handler *strategy; /* Callback function for all r/w */
|
247 |
|
|
struct proc_dir_entry *de; /* /proc control block */
|
248 |
|
|
void *extra1;
|
249 |
|
|
void *extra2;
|
250 |
|
|
};
|
251 |
|
|
|
252 |
|
|
/* struct ctl_table_header is used to maintain dynamic lists of
|
253 |
|
|
ctl_table trees. */
|
254 |
|
|
struct ctl_table_header
|
255 |
|
|
{
|
256 |
|
|
ctl_table *ctl_table;
|
257 |
|
|
DLNODE(struct ctl_table_header) ctl_entry;
|
258 |
|
|
};
|
259 |
|
|
|
260 |
|
|
struct ctl_table_header * register_sysctl_table(ctl_table * table,
|
261 |
|
|
int insert_at_head);
|
262 |
|
|
void unregister_sysctl_table(struct ctl_table_header * table);
|
263 |
|
|
|
264 |
|
|
#else /* __KERNEL__ */
|
265 |
|
|
|
266 |
|
|
#endif /* __KERNEL__ */
|
267 |
|
|
|
268 |
|
|
#endif /* _LINUX_SYSCTL_H */
|