1: /*
2: * sysconfig -- Program to auto configure a kernel to the devices which
3: * are present. Needs the ucall() system call and special kernel to work.
4: *
5: * Michael Toy -- Italy 1983
6: *
7: * added internal, user-level probe facilities,
8: * Michael Karels -- Berkeley 1983
9: */
10:
11: #include <stdio.h>
12: #include <sys/autoconfig.h>
13: #include "args.h"
14:
15: char *dtab_name = "/etc/dtab";
16: char *nlist_name = "/unix";
17: char *kmem_name = "/dev/kmem";
18: int kmem;
19: int verbose;
20: int debug;
21: int complain;
22: FILE *dtab_fp;
23: FILE *fopen();
24:
25: main(argc, argv)
26: int argc;
27: char **argv;
28: {
29: setbuf(stdout, NULL);
30:
31: parse_args(argc, argv, "cdvP", "ink");
32:
33: /* -c -- Complain about bad vectors */
34: complain = bools('c');
35:
36: /* -v -- Verbose output */
37: verbose = bools('v');
38:
39: /* -d -- Debugging run */
40: debug = bools('d');
41:
42: /* -i file -- Read in file instead of "dtab" */
43: if (strings('i'))
44: dtab_name = strings('i');
45: if ((dtab_fp = fopen(dtab_name, "r")) == NULL) {
46: perror(dtab_name);
47: exit(AC_SETUP);
48: }
49:
50: /* -k file -- use file instead of "/dev/kmem" */
51: if (! debug) {
52: if (strings('k'))
53: kmem_name = strings('k');
54: if ((kmem = open(kmem_name, 2)) < 0) {
55: perror(kmem_name);
56: exit(AC_SETUP);
57: }
58: }
59:
60: /* -n file -- Namelist is in file instead of /unix */
61: if (strings('n'))
62: nlist_name = strings('n');
63:
64: /* Read the dtab into internal tables so we can play with it */
65: read_dtab();
66:
67: /* Now set up for and call nlist so we can get kernel symbols */
68: read_nlist();
69:
70: /* And at last change the kernel to suit ourselves */
71: auto_config();
72:
73: /* All done go bye bye now */
74: exit(AC_OK);
75: }
76:
77: char *strsave(cp)
78: {
79: return strcpy(malloc(strlen(cp) + 1), cp);
80: }
Defined functions
main
defined in line
25;
never used
Defined variables
debug
defined in line
20; used 16 times
- in line 40,
51
- in /usr/src/sys/autoconfig/attach.c line
40,
168
- in /usr/src/sys/autoconfig/do_config.c line
24,
41,
94,
107,
128,
137,
182,
236,
253,
284
- in /usr/src/sys/autoconfig/read_nlist.c line
71,
82
kmem
defined in line
18; used 7 times