This source file includes following definitions.
- ddb_sysctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include <sys/param.h>
28 #include <sys/types.h>
29 #include <sys/kernel.h>
30 #include <sys/proc.h>
31 #include <uvm/uvm_extern.h>
32 #include <sys/sysctl.h>
33
34 #include <ddb/db_var.h>
35
36 int db_log = 1;
37
38 int
39 ddb_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
40 size_t newlen, struct proc *p)
41 {
42 int error, ctlval;
43
44
45 if (namelen != 1)
46 return (ENOTDIR);
47
48 switch (name[0]) {
49
50 case DBCTL_RADIX:
51 return sysctl_int(oldp, oldlenp, newp, newlen, &db_radix);
52 case DBCTL_MAXWIDTH:
53 return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_width);
54 case DBCTL_TABSTOP:
55 return sysctl_int(oldp, oldlenp, newp, newlen, &db_tab_stop_width);
56 case DBCTL_MAXLINE:
57 return sysctl_int(oldp, oldlenp, newp, newlen, &db_max_line);
58 case DBCTL_PANIC:
59 if (securelevel > 0)
60 return (sysctl_int_lower(oldp, oldlenp, newp, newlen,
61 &db_panic));
62 else {
63 ctlval = db_panic;
64 if ((error = sysctl_int(oldp, oldlenp, newp, newlen,
65 &ctlval)) || newp == NULL)
66 return (error);
67 if (ctlval != 1 && ctlval != 0)
68 return (EINVAL);
69 db_panic = ctlval;
70 return (0);
71 }
72 break;
73 case DBCTL_CONSOLE:
74 if (securelevel > 0)
75 return (sysctl_int_lower(oldp, oldlenp, newp, newlen,
76 &db_console));
77 else {
78 ctlval = db_console;
79 if ((error = sysctl_int(oldp, oldlenp, newp, newlen,
80 &ctlval)) || newp == NULL)
81 return (error);
82 if (ctlval != 1 && ctlval != 0)
83 return (EINVAL);
84 db_console = ctlval;
85 return (0);
86 }
87 break;
88 case DBCTL_LOG:
89 return (sysctl_int(oldp, oldlenp, newp, newlen, &db_log));
90 default:
91 return (EOPNOTSUPP);
92 }
93
94 }