File: sysklog.patch

package info (click to toggle)
lg-issue11 2-4
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 836 kB
  • ctags: 44
  • sloc: makefile: 30; sh: 3
file content (2547 lines) | stat: -rw-r--r-- 73,687 bytes parent folder | download | duplicates (4)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547

From greg@wind.rmcc.com Mon Sep  9 15:50:23 1996
Date: Mon, 09 Sep 1996 07:14:37 -0500 (CDT)
From: "G.W. Wettstein" <greg@wind.rmcc.com>
To: "John M. Fisk" <fiskjm@ctrvax.Vanderbilt.Edu>
Subject: Re: sysklogd fix/patch

On Sep 7,  2:11pm, "John M. Fisk" wrote:
} Subject: sysklogd fix/patch

> Greg,

Good morning John, thanks for the ntoe.

> Sorry to bother you but I've been unsuccessful finding an answer to a
> problem I've been having (and apparently quite a few others as well) with
> syslogd and Slackware '96.
> 
> I just read a post to comp.os.linux.setup that stated that the sysklogd
> devel team had issued an updated version or patch that corrected a problem
> with syslogd which caused it to dump core -- the problem having something
> to do with the networking setup used by Slackware.
> 
> Could you point me to where I could FTP the updated sources or pick up a
> patch for the current sources?

Even better the fixes are enclosed below... :-)

The following set of patches are what I just announced last Friday.
Give them a try and let me know if the problems are fixed.

> Thanks so much!
> 
> Best Wishes,

No problem, hopefully they will make things better.  Have a pleasant
remainder of the week.

> ____________________________________________________________John M. Fisk

Greg

Cut here to begin separating patch 1. -------------------------------------
diff -u --new-file --recursive v1.3/sysklogd-1.3/Makefile sysklogd-1.3/Makefile
--- v1.3/sysklogd-1.3/Makefile	Mon Feb 19 15:18:23 1996
+++ sysklogd-1.3/Makefile	Sun Mar 31 06:11:04 1996
@@ -3,11 +3,10 @@
 CC= gcc
 #CFLAGS= -g -DSYSV -Wall
 #LDFLAGS= -g
-CFLAGS= -O6 -DSYSV -fomit-frame-pointer -Wall
-LDFLAGS= -s -N
+CFLAGS= -O2 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
+LDFLAGS= -s
 
-# Look where your install program is
-#
+# Look where your install program is.
 INSTALL = /usr/bin/install
 BINDIR = /usr/sbin
 MANDIR = /usr/man
@@ -17,6 +16,13 @@
 # to try uncommenting the following define.
 # LIBS = /usr/lib/libresolv.a
 
+# A patch was forwarded which provided support for sysklogd under
+# the ALPHA.  This patch included a reference to a library which may be
+# specific to the ALPHA.  If you are attempting to build this package under
+# an ALPHA and linking fails with unresolved references please try
+# uncommenting the following define.
+# LIBS = ${LIBS} -linux
+
 # Define the following to impart start-up delay in klogd.  This is
 # useful if klogd is started simultaneously or in close-proximity to syslogd.
 # KLOGD_START_DELAY = -DKLOGD_DELAY=5
@@ -54,7 +60,7 @@
 	${CC} ${LDFLAGS} -o syslogd syslogd.o pidfile.o ${LIBS}
 
 klogd:	klogd.o syslog.o pidfile.o ksym.o
-	${CC} ${LDFLAGS} -o klogd klogd.o syslog.o pidfile.o ksym.o
+	${CC} ${LDFLAGS} -o klogd klogd.o syslog.o pidfile.o ksym.o ${LIBS}
 
 syslog_tst: syslog_tst.o
 	${CC} ${LDFLAGS} -o syslog_tst syslog_tst.o
@@ -75,17 +81,17 @@
 	${CC} ${CFLAGS} -c syslog_tst.c
 
 clean:
-	rm -f *.o *.log *~ *.orig;
+	rm -f *.o *.log *~ *.orig
 
 clobber: clean
-	rm -f syslogd klogd syslog_tst TAGS;
+	rm -f syslogd klogd syslog_tst TAGS
 
 install_exec: syslogd klogd
-	${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd;
-	${INSTALL} -m 500 -s klogd ${BINDIR}/klogd;
+	${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd
+	${INSTALL} -m 500 -s klogd ${BINDIR}/klogd
 
 install_man:
 	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8
 	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8
 	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
-	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/MAN8/klogd.8
+	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8
diff -u --new-file --recursive v1.3/sysklogd-1.3/NEWS sysklogd-1.3/NEWS
--- v1.3/sysklogd-1.3/NEWS	Fri Dec 15 15:06:25 1995
+++ sysklogd-1.3/NEWS	Sun Mar 31 06:21:14 1996
@@ -1,3 +1,35 @@
+Version 1.3 Patch Level 1
+
+General. ------------------------------------------------------------------
+Cleanups in the Makefile.
+
+Patches to support compilation in the ALPHA environment.  I have not
+been able to test these personally so if anyone has any feedback I
+would be interested in hearing from the Linux ALPHA community.
+
+Spelling and grammar corrections in the man pages.
+
+
+syslogd ------------------------------------------------------------------
+Patch to fix parsing of hostnames in syslogd.c.
+
+The return value of gethostbyname is now properly checked.  This should
+fix the problems with core dumps when name resolution failed.
+
+Bounds error fixed when setting the file descriptors for UNIX domain
+sockets.
+
+
+klogd ---------------------------------------------------------------------
+Error checking and reporting enhanced.  I have a couple of reports
+that klogd is experiencing errors when reading the /proc filesystem.
+Any additional information would be appreciated.
+
+The sys_syslog function has been renamed to ksyslog.  This was in a
+set patches for ALPHA support so I am assuming that this is necessary
+for that environment
+
+
 Version 1.3 
 
 Numerous changes, performance enhancements, code cleanups and bug fixes.
diff -u --new-file --recursive v1.3/sysklogd-1.3/klogd.c sysklogd-1.3/klogd.c
--- v1.3/sysklogd-1.3/klogd.c	Sat Feb 17 14:02:54 1996
+++ sysklogd-1.3/klogd.c	Tue Mar 19 11:50:43 1996
@@ -159,8 +159,10 @@
 
 #define __LIBRARY__
 #include <linux/unistd.h>
-#define __NR_sys_syslog __NR_syslog
-_syscall3(int,sys_syslog,int, type, char *, buf, int, len);
+#ifndef __alpha__
+# define __NR_ksyslog __NR_syslog
+_syscall3(int,ksyslog,int, type, char *, buf, int, len);
+#endif
 
 #define LOG_BUFFER_SIZE 4096
 #define LOG_LINE_LENGTH 1024
@@ -191,7 +193,7 @@
 
 
 /* Function prototypes. */
-extern int sys_syslog(int type, char *buf, int len);
+extern int ksyslog(int type, char *buf, int len);
 static void CloseLogSrc(void);
 extern void restart(int sig);
 extern void stop_logging(int sig);
@@ -209,14 +211,14 @@
 
 {
 	/* Turn on logging of messages to console. */
-  	sys_syslog(7, NULL, 0);
+  	ksyslog(7, NULL, 0);
   
         /* Shutdown the log sources. */
 	switch ( logsrc )
 	{
 	    case kernel:
-		sys_syslog(0, 0, 0);
-		Syslog(LOG_INFO, "Kernel logging (sys_syslog) stopped.");
+		ksyslog(0, 0, 0);
+		Syslog(LOG_INFO, "Kernel logging (ksyslog) stopped.");
 		break;
             case proc:
 		close(kmsg);
@@ -326,7 +328,7 @@
 
 
 	/* Set level of kernel console messaging.. */
-	if ( (sys_syslog(8, NULL, console_log_level) < 0) && \
+	if ( (ksyslog(8, NULL, console_log_level) < 0) && \
 	     (errno == EINVAL) )
 	{
 		/*
@@ -337,7 +339,7 @@
 		 */
 		Syslog(LOG_WARNING, "Cannot set console log level - disabling "
 			      "console output.");
-		sys_syslog(6, NULL, 0);
+		ksyslog(6, NULL, 0);
 	}
 	
 
@@ -349,16 +351,17 @@
 	    ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT)) )
 	{
 	  	/* Initialize kernel logging. */
-	  	sys_syslog(1, NULL, 0);
-		Syslog(LOG_INFO, "klogd %s-%s, log source = sys_syslog "
+	  	ksyslog(1, NULL, 0);
+		Syslog(LOG_INFO, "klogd %s-%s, log source = ksyslog "
 		       "started.", VERSION, PATCHLEVEL);
 		return(kernel);
 	}
 	
 	if ( (kmsg = open(_PATH_KLOG, O_RDONLY)) < 0 )
 	{
-		fputs("klogd: Cannot open proc file system.", stderr);
-		sys_syslog(7, NULL, 0);
+		fprintf(stderr, "klogd: Cannot open proc file system, " \
+			"%d - %s.\n", errno, strerror(errno));
+		ksyslog(7, NULL, 0);
 		exit(1);
 	}
 
@@ -517,12 +520,12 @@
 	 * messages into this fresh buffer.
 	 */
 	memset(log_buffer, '\0', sizeof(log_buffer));
-	if ( (rdcnt = sys_syslog(2, log_buffer, sizeof(log_buffer))) < 0 )
+	if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer))) < 0 )
 	{
 		if ( errno == EINTR )
 			return;
-		fprintf(stderr, "Error return from sys_sycall: %d - %s\n", \
-			errno, strerror(errno));
+		fprintf(stderr, "klogd: Error return from sys_sycall: " \
+			"%d - %s\n", errno, strerror(errno));
 	}
 	
 	LogLine(log_buffer, rdcnt);
@@ -546,7 +549,8 @@
 	{
 		if ( errno == EINTR )
 			return;
-		Syslog(LOG_ERR, "Cannot read proc file system.");
+		Syslog(LOG_ERR, "Cannot read proc file system: %d - %s.", \
+		       errno, strerror(errno));
 	}
 	
 	LogLine(log_buffer, rdcnt);
@@ -687,8 +691,8 @@
 			output_file = stdout;
 		else if ( (output_file = fopen(output, "w")) == (FILE *) 0 )
 		{
-			fprintf(stderr, "klogd: Cannot open output file %s - "\
-				"%s\n", output, strerror(errno));
+			fprintf(stderr, "klogd: Cannot open output file " \
+				"%s - %s\n", output, strerror(errno));
 			return(1);
 		}
 	}
diff -u --new-file --recursive v1.3/sysklogd-1.3/sysklogd.8 sysklogd-1.3/sysklogd.8
--- v1.3/sysklogd-1.3/sysklogd.8	Sat Feb 17 14:02:54 1996
+++ sysklogd-1.3/sysklogd.8	Tue Mar  5 12:52:59 1996
@@ -39,7 +39,7 @@
 .BR syslogd (8)
 derived from the
 stock BSD sources.  Support for kernel logging is provided by the
-.BR syslogd (8)
+.BR klogd (8)
 utility which allows kernel logging to be conducted in either a
 standalone fashion or as a client of syslogd.
 
@@ -91,7 +91,7 @@
 .TP
 .BI "\-l " "hostlist"
 Specify a hostname that should be logged only with its simple hostname
-and not the the fqdn. Multiple hosts may be specified using the colon
+and not the fqdn. Multiple hosts may be specified using the colon
 (``:'') separator.
 .TP
 .BI "\-m " "interval"
@@ -195,8 +195,8 @@
 .PP
 Under the new scheme this behavior remains the same.  The difference
 is the addition of four new specifiers, the asterisk (\fB*\fR)
-wildcard the equation sign (\fB=\fR), the exclamation mark
-(\fB!\fR) and the minus sign (\fB-\fR).
+wildcard, the equation sign (\fB=\fR), the exclamation mark
+(\fB!\fR), and the minus sign (\fB-\fR).
 
 The \fB*\fR specifies that all messages for the
 specified facility are to be directed to the destination.  Note that
@@ -215,7 +215,7 @@
 .IP
 .nf
 	# Sample syslog.conf
-	daemon.=debug			/usr/adm/debug
+	*.=debug			/usr/adm/debug
 .fi
 .PP
 .\" The \fB!\fR as the first character of a priority inverts the above
@@ -456,11 +456,11 @@
 .SH DEBUGGING
 When debugging is turned on using
 .B "\-d"
-option the
+option then
 .B syslogd
-will very verbose by writing much of what it does on stdout. Whenever
+will be very verbose by writing much of what it does on stdout. Whenever
 the configuration file is reread and re-parsed you'll see a tabular,
-corresponding on the internal data structure. This tabular consists of
+corresponding to the internal data structure. This tabular consists of
 four fields:
 .TP
 .I number
@@ -489,7 +489,7 @@
 This field shows additional arguments to the actions in the last
 field. For file-logging this is the filename for the logfile; for
 user-logging this is a list of users; for remote logging this is the
-the hostname of the machine to log to; for console-logging this is the
+hostname of the machine to log to; for console-logging this is the
 used console; for tty-logging this is the specified tty; wall has no
 additional arguments.
 .SH FILES
diff -u --new-file --recursive v1.3/sysklogd-1.3/syslogd.c sysklogd-1.3/syslogd.c
--- v1.3/sysklogd-1.3/syslogd.c	Mon Feb 19 09:24:33 1996
+++ sysklogd-1.3/syslogd.c	Fri Mar  8 11:19:25 1996
@@ -715,9 +715,15 @@
 		 * should return the simple hostname or the fqdn. A
 		 * good piece of software should be aware of both and
 		 * we want to distribute good software.  Joey
+		 *
+		 * Good software also always checks its return values...
+		 * If syslogd starts up before DNS is up & /etc/hosts
+		 * doesn't have LocalHostName listed, gethostbyname will
+		 * return NULL. 
 		 */
 		hent = gethostbyname(LocalHostName);
-		sprintf(LocalHostName, "%s", hent->h_name);
+		if ( hent )
+			sprintf(LocalHostName, "%s", hent->h_name);
 		if ( (p = index(LocalHostName, '.')) )
 		{
 			*p++ = '\0';
@@ -890,7 +896,7 @@
 					dprintf("%d ", nfds);
 			dprintf("\n");
 		}
-		for (fd= 0; fd <= FD_SETSIZE; ++fd)
+		for (fd= 0; fd < FD_SETSIZE; ++fd)
 		  if ( FD_ISSET(fd, &readfds) && FD_ISSET(fd, &unixm) ) {
 			dprintf("Message from UNIX socket #%d.\n", fd);
 			memset(line, '\0', sizeof(line));
@@ -979,9 +985,8 @@
 crunch_list(list)
 	char *list;
 {
-	int count;
-	int i;
-	char *p;
+	int count, i;
+	char *p, *q;
 	char **result = NULL;
 
 	p = list;
@@ -1012,15 +1017,15 @@
 	 * so we don't have to care about this.
 	 */
 	count = 0;
-	while ((i=(int)index(p, LIST_DELIMITER))) {
-		if ((result[count] = \
-		     (char *)malloc(sizeof(char) * i - (int)p +1)) == NULL) {
+	while ((q=index(p, LIST_DELIMITER))) {
+		result[count] = (char *) malloc((q - p + 1) * sizeof(char));
+		if (result[count] == NULL) {
 			printf ("Sorry, can't get enough memory, exiting.\n");
 			exit(0);
 		}
-		strncpy(result[count],p, i - (int)p);
-		result[count][i - (int)p] = '\0';
-		p = (char *)i;p++;
+		strncpy(result[count], p, q - p);
+		result[count][q - p] = '\0';
+		p = q; p++;
 		count++;
 	}
 	if ((result[count] = \
diff -u --new-file --recursive v1.3/sysklogd-1.3/version.h sysklogd-1.3/version.h
--- v1.3/sysklogd-1.3/version.h	Tue Feb 27 15:48:42 1996
+++ sysklogd-1.3/version.h	Sun Mar 31 05:58:48 1996
@@ -1,2 +1,2 @@
 #define VERSION "1.3"
-#define PATCHLEVEL "0"
+#define PATCHLEVEL "1"
Cut here to complete separating patch 1. ----------------------------------

Cut here to begin separating patch 2. -------------------------------------
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/MANIFEST sysklogd-1.3/MANIFEST
--- v1.3-1/sysklogd-1.3/MANIFEST	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/MANIFEST	Thu May  2 15:21:49 1996
@@ -17,6 +17,9 @@
 ksym.c:		Source module for the kernel log daemon which implements
 		kernel numeric address to symbol translations.
 
+ksym_mod.c:	Source module which contains functions which allow ksym.c
+		to resolve symbols found in loadable kernel modules.	
+
 syslogd.c:	Source code for the system log daemon.
 
 syslog.c:	A slightly modified version of the syslog.c file found in
@@ -46,3 +49,10 @@
 
 kernel.patch:	A source code patch which modifies the linux kernel to
 		delimit addresses for symbolic translation by klogd.
+
+oops.c:		C source for a loadable kernel module which can be used
+		to generate a kernel protection fault.  This is used to
+		test the address resolution capabilities of klogd.
+
+oops_test.c:	A small driver program used in conjunction with the oops
+		module to generate a kernel protection fault.
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/Makefile sysklogd-1.3/Makefile
--- v1.3-1/sysklogd-1.3/Makefile	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/Makefile	Thu May  2 15:19:07 1996
@@ -52,15 +52,18 @@
 .c.o:
 	${CC} ${CFLAGS} -c $*.c
 
-all:	syslogd	klogd syslog_tst
+all: syslogd klogd
+
+test: syslog_tst ksym oops_test
 
 install: install_man install_exec
 
 syslogd: syslogd.o pidfile.o
 	${CC} ${LDFLAGS} -o syslogd syslogd.o pidfile.o ${LIBS}
 
-klogd:	klogd.o syslog.o pidfile.o ksym.o
-	${CC} ${LDFLAGS} -o klogd klogd.o syslog.o pidfile.o ksym.o ${LIBS}
+klogd:	klogd.o syslog.o pidfile.o ksym.o ksym_mod.o
+	${CC} ${LDFLAGS} -o klogd klogd.o syslog.o pidfile.o ksym.o \
+		ksym_mod.o ${LIBS}
 
 syslog_tst: syslog_tst.o
 	${CC} ${LDFLAGS} -o syslog_tst syslog_tst.o
@@ -77,14 +80,29 @@
 ksym.o: ksym.c klogd.h
 	${CC} ${CFLAGS} ${KLOGD_FLAGS} -c ksym.c
 
+ksym_mod.o: ksym_mod.c klogd.h
+	${CC} ${CFLAGS} ${KLOGD_FLAGS} -c ksym_mod.c
+
 syslog_tst.o: syslog_tst.c
 	${CC} ${CFLAGS} -c syslog_tst.c
 
+oops_test: oops.o
+	${CC} ${CFLAGS} -o oops_test oops_test.c
+
+oops.o: oops.c
+	${CC} ${CFLAGS} -D__KERNEL__ -DMODULE -c oops.c
+
+ksym: ksym_test.o ksym_mod.o
+	${CC} ${LDFLAGS} -o ksym ksym_test.o ksym_mod.o
+
+ksym_test.o: ksym.c
+	${CC} ${CFLAGS} -DTEST -o ksym_test.o -c ksym.c
+
 clean:
 	rm -f *.o *.log *~ *.orig
 
 clobber: clean
-	rm -f syslogd klogd syslog_tst TAGS
+	rm -f syslogd klogd ksym syslog_tst oops_test TAGS
 
 install_exec: syslogd klogd
 	${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/klogd.c sysklogd-1.3/klogd.c
--- v1.3-1/sysklogd-1.3/klogd.c	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/klogd.c	Wed Apr 17 13:42:58 1996
@@ -380,7 +380,7 @@
 	{
 		fputs("Logging line:\n", stderr);
 		fprintf(stderr, "\tLine: %s\n", fmt);
-		fprintf(stderr, "\tPriority: %c\n", *(fmt+1));
+		fprintf(stderr, "\tPriority: %d\n", priority);
 	}
 
 	/* Handle output to a file. */
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/klogd.h sysklogd-1.3/klogd.h
--- v1.3-1/sysklogd-1.3/klogd.h	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/klogd.h	Sun Mar 31 14:24:42 1996
@@ -13,5 +13,6 @@
 
 /* Function prototypes. */
 extern int InitKsyms(char *);
+extern int InitMsyms(void);
 extern char * ExpandKadds(char *, char *);
 extern void Syslog(int priority, char *fmt, ...);
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/ksym.c sysklogd-1.3/ksym.c
--- v1.3-1/sysklogd-1.3/ksym.c	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/ksym.c	Wed May  1 16:24:54 1996
@@ -1,6 +1,7 @@
 /*
     ksym.c - functions for kernel address->symbol translation
-    Copyright (c) 1995  Dr. G.W. Wettstein <greg@wind.rmcc.com>
+    Copyright (c) 1995, 1996  Dr. G.W. Wettstein <greg@wind.rmcc.com>
+    Copyright (c) 1996 Enjellic Systems Development
 
     This file is part of the sysklogd package, a kernel and system log daemon.
 
@@ -69,27 +70,20 @@
 #include <malloc.h>
 #include <sys/utsname.h>
 #include "klogd.h"
+#include "ksyms.h"
 
 #define VERBOSE_DEBUGGING 0
 
 
-/* Variables, structures and type definitions static to this module. */
+/* Variables static to this module. */
 struct sym_table
 {
 	unsigned long value;
 	char *name;
 };
 
-struct symbol
-{
-	char *name;
-	int size;
-	int offset;
-};
-
-static struct sym_table *sym_array = (struct sym_table *) 0;
-
 static int num_syms = 0;
+static struct sym_table *sym_array = (struct sym_table *) 0;
 
 static char *system_maps[] =
 {
@@ -104,7 +98,7 @@
 
 
 #if defined(TEST)
-static int debugging = 1;
+int debugging;
 #else
 extern int debugging;
 #endif
@@ -192,7 +186,7 @@
 	 */
 	while ( !feof(sym_file) )
 	{
-		if ( fscanf(sym_file, "%8lx %c %s\n", &address, &type, sym)
+		if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym)
 		    != 3 )
 		{
 			Syslog(LOG_ERR, "Error in symbol table input.");
@@ -303,7 +297,7 @@
 		version = 0;
 		while ( !feof(sym_file) && (version == 0) )
 		{
-			if ( fscanf(sym_file, "%8lx %c %s\n", &address, \
+			if ( fscanf(sym_file, "%lx %c %s\n", &address, \
 				    &type, sym) != 3 )
 			{
 				Syslog(LOG_ERR, "Error in symbol table input.");
@@ -527,7 +521,7 @@
  *		closely matching the address is returned.
  **************************************************************************/
 
-extern char * LookupSymbol(value, sym)
+static char * LookupSymbol(value, sym)
 
 	unsigned long value;
 
@@ -556,6 +550,9 @@
 		last = sym_array[lp].name;
 	}
 
+	if ( (last = LookupModuleSymbol(value, sym)) != (char *) 0 )
+		return(last);
+
 	return((char *) 0);
 }
 
@@ -594,8 +591,29 @@
 	auto int value;
 
 	auto struct symbol sym;
+
+
+	/*
+	 * This is as handy a place to put this as anyplace.
+	 *
+	 * Since the insertion of kernel modules can occur in a somewhat
+	 * dynamic fashion we need some mechanism to insure that the
+	 * kernel symbol tables get read just prior to when they are
+	 * needed.
+	 *
+	 * To accomplish this we look for the Oops string and use its
+	 * presence as a signal to load the module symbols.
+	 *
+	 * This is not the best solution of course, especially if the
+	 * kernel is rapidly going out to lunch.  What really needs to
+	 * be done is to somehow generate a callback from the
+	 * kernel whenever a module is loaded or unloaded.  I am
+	 * open for patches.
+	 */
+	if ( (strstr(line, "Oops:") != (char *) 0) && !InitMsyms() )
+		Syslog(LOG_WARNING, "Cannot load kernel module symbols.\n");
 	
-	
+
 	/*
 	 * Early return if there do not appear to be any kernel
 	 * messages in this line.
@@ -670,21 +688,17 @@
 
 extern int main(int argc, char *argv[])
 {
-	auto long int value;
 	auto char line[1024], eline[2048];
+
+	debugging = 1;
 	
 	
-#if 0
-	value = atol(argv[1]);
-	fprintf(stdout, "Value of %ld: %s\n", value, LookupSymbol(value));
-#endif
-
 	if ( !InitKsyms((char *) 0) )
 	{
 		fputs("ksym: Error loading system map.\n", stderr);
 		return(1);
 	}
-	
+
 	while ( !feof(stdin) )
 	{
 		gets(line);
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/ksym_mod.c sysklogd-1.3/ksym_mod.c
--- v1.3-1/sysklogd-1.3/ksym_mod.c	Wed Dec 31 18:00:00 1969
+++ sysklogd-1.3/ksym_mod.c	Wed May  1 16:15:25 1996
@@ -0,0 +1,587 @@
+/*
+    ksym_mod.c - functions for building symbol lookup tables for klogd
+    Copyright (c) 1995, 1996  Dr. G.W. Wettstein <greg@wind.rmcc.com>
+    Copyright (c) 1996 Enjellic Systems Development
+
+    This file is part of the sysklogd package, a kernel and system log daemon.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+ * This file implements functions which are useful for building
+ * a symbol lookup table based on the in kernel symbol table
+ * maintained by the Linux kernel.
+ *
+ * Proper logging of kernel panics generated by loadable modules
+ * tends to be difficult.  Since the modules are loaded dynamically
+ * their addresses are not known at kernel load time.  A general
+ * protection fault (Oops) cannot be properly deciphered with 
+ * classic methods using the static symbol map produced at link time.
+ *
+ * One solution to this problem is to have klogd attempt to translate
+ * addresses from module when the fault occurs.  By referencing the
+ * the kernel symbol table proper resolution of these symbols is made
+ * possible.
+ *
+ * At least that is the plan.
+ */
+
+
+/* Includes. */
+#include <stdlib.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <linux/time.h>
+#include <linux/module.h>
+#include <stdarg.h>
+#include <paths.h>
+
+#include "klogd.h"
+#include "ksyms.h"
+
+
+/*
+ * The following bit uses some kernel/library magic to product what
+ * looks like a function call to user level code.  This function is
+ * actually a system call in disguise.  The purpose of the getsyms
+ * call is to return a current copy of the in-kernel symbol table.
+ */
+#define __LIBRARY__
+#include <linux/unistd.h>
+# define __NR_getsyms __NR_get_kernel_syms
+_syscall1(int, getsyms, struct kernel_sym *, syms);
+#undef __LIBRARY__
+extern int getsyms(struct kernel_sym *);
+
+
+/* Variables static to this module. */
+struct sym_table
+{
+	unsigned long value;
+	char *name;
+};
+
+struct Module
+{
+	struct sym_table *sym_array;
+	int num_syms;
+
+	char *name;
+	struct module module;
+};
+
+static int num_modules;
+struct Module *sym_array_modules = (struct Module *) 0;
+
+static int have_modules = 0;
+
+#if defined(TEST)
+static int debugging = 1;
+#else
+extern int debugging;
+#endif
+
+
+/* Function prototypes. */
+static void FreeModules(void);
+static int AddSymbol(struct Module *mp, unsigned long, char *);
+static int AddModule(unsigned long, char *);
+static int symsort(const void *, const void *);
+
+
+/**************************************************************************
+ * Function:	InitMsyms
+ *
+ * Purpose:	This function is responsible for building a symbol
+ *		table which can be used to resolve addresses for
+ *		loadable modules.
+ *
+ * Arguements:	Void
+ *
+ * Return:	A boolean return value is assumed.
+ *
+ *		A false value indicates that something went wrong.
+ *
+ *		True if loading is successful.
+ **************************************************************************/
+
+extern int InitMsyms()
+
+{
+	auto int	rtn,
+			tmp;
+
+	auto struct kernel_sym	*ksym_table,
+				*p;
+
+
+	/* Init the symbol table if one exists. */
+	if ( num_modules > 0 )
+		FreeModules();
+
+
+	/*
+	 * The system call which returns the kernel symbol table has
+	 * essentialy two modes of operation.  Called with a null pointer
+	 * the system call returns the number of symbols defined in the
+	 * the table.
+	 *
+	 * The second mode of operation is to pass a valid pointer to
+	 * the call which will then load the current symbol table into
+	 * the memory provided.
+	 *
+	 * Returning the symbol table is essentially an all or nothing
+	 * proposition so we need to pre-allocate enough memory for the
+	 * complete table regardless of how many symbols we need.
+	 *
+	 * Bummer.
+	 */
+	rtn = getsyms((struct kernel_sym *) 0);
+	if ( debugging )
+		fprintf(stderr, "Loading kernel module symbols - "
+			"Size of table: %d\n", rtn);
+
+	ksym_table = (struct kernel_sym *) malloc(rtn * \
+						  sizeof(struct kernel_sym));
+	if ( ksym_table == (struct kernel_sym *) 0 )
+	{
+		Syslog(LOG_WARNING, " Failed memory allocation for kernel "
+		       "symbol table.\n");
+		return(0);
+	}
+	if ( (rtn = getsyms(ksym_table)) == 0 )
+		Syslog(LOG_WARNING, "Kernel symbol read returned 0\n");
+
+
+	/*
+	 * Build a symbol table compatible with the other one used by
+	 * klogd.
+	 */
+	tmp = rtn;
+	p = ksym_table;
+	while ( tmp-- )
+	{
+ 		if ( !AddModule(p->value, p->name) )
+		{
+			Syslog(LOG_WARNING, "Error adding kernel module table "
+				"entry.\n");
+			free(ksym_table);
+			return(0);
+		}
+		++p;
+	}
+
+	/* Sort the symbol tables in each module. */
+	for (tmp= 0; tmp < num_modules; ++tmp)
+	{
+		if ( sym_array_modules[tmp].num_syms < 2 )
+			continue;
+		qsort(sym_array_modules[tmp].sym_array, \
+		      sym_array_modules[tmp].num_syms, \
+		      sizeof(struct sym_table), symsort);
+	}
+
+	free(ksym_table);
+	return(1);
+}
+
+
+static int symsort(p1, p2)
+
+     const void *p1;
+
+     const void *p2;
+
+{
+	auto const struct sym_table	*sym1 = p1,
+					*sym2 = p2;
+
+	if ( sym1->value < sym2->value )
+		return(-1);
+	if ( sym1->value == sym2->value )
+		return(0);
+	return(1);
+}
+
+
+/**************************************************************************
+ * Function:	FreeModules
+ *
+ * Purpose:	This function is used to free all memory which has been
+ *		allocated for the modules and their symbols.
+ *
+ * Arguements:	None specified.
+ *
+ * Return:	void
+ **************************************************************************/
+
+static void FreeModules()
+
+{
+	auto int	nmods,
+			nsyms;
+
+	auto struct Module *mp;
+
+
+	for (nmods= 0; nmods <num_modules; ++nmods)
+	{
+		mp = &sym_array_modules[nmods];
+		if ( mp->num_syms == 0 )
+			continue;
+	       
+		for (nsyms= 0; nsyms < mp->num_syms; ++nsyms)
+			free(mp->sym_array[nsyms].name);
+		free(mp->sym_array);
+	}
+
+	free(sym_array_modules);
+	sym_array_modules = (struct Module *) 0;
+	have_modules = num_modules = 0;
+	return;
+}
+
+
+/**************************************************************************
+ * Function:	AddModule
+ *
+ * Purpose:	This function is responsible for adding a module to
+ *		the list of currently loaded modules.
+ *
+ * Arguements:	(unsigned long) address, (char *) symbol
+ *
+ *		address:->	The address of the module.
+ *
+ *		symbol:->	The name of the module.
+ *
+ * Return:	int
+ **************************************************************************/
+
+static int AddModule(address, symbol)
+
+     unsigned long address;
+
+     char *symbol;
+
+{
+	auto int memfd;
+
+	auto struct Module *mp;
+
+
+	/* Return if we have loaded the modules. */
+	if ( have_modules )
+		return(1);
+
+	/*
+	 * The following section of code is responsible for determining
+	 * whether or not we are done reading the list of modules.
+	 */
+	if ( symbol[0] == '#' )
+	{
+		if ( symbol[1] == '\0' )
+		{
+			/*
+			 * A symbol which consists of a # sign only
+			 * signifies a a resident kernel segment.  When we
+			 * hit one of these we are done reading the
+			 * module list.
+			 */
+			have_modules = 1;
+			return(1);
+		}
+
+		/* Allocate space for the module. */
+		sym_array_modules = (struct Module *) \
+			realloc(sym_array_modules, \
+				(num_modules+1) * sizeof(struct Module));
+		if ( sym_array_modules == (struct Module *) 0 )
+		{
+			Syslog(LOG_WARNING, "Cannot allocate Module array.\n");
+			return(0);
+		}
+		mp = &sym_array_modules[num_modules];
+
+		if ( (memfd = open("/dev/kmem", O_RDONLY)) < 0 )
+		{
+			Syslog(LOG_WARNING, "Error opening /dev/kmem\n");
+			return(1);
+		}
+		if ( lseek(memfd, address, SEEK_SET) < 0 )
+		{
+			Syslog(LOG_WARNING, "Error seeking in /dev/kmem\n");
+			return(0);
+		}
+		if ( read(memfd, \
+			  (char *)&sym_array_modules[num_modules].module,  \
+			  sizeof(struct module)) < 0 )
+		{
+			Syslog(LOG_WARNING, "Error reading module "
+			       "descriptor.\n");
+			return(0);
+		}
+		close(memfd);
+
+		/* Save the module name. */
+		mp->name = (char *) malloc(strlen(&symbol[1]) + 1);
+		if ( mp->name == (char *) 0 )
+			return(0);
+		strcpy(mp->name, &symbol[1]);
+
+		mp->num_syms = 0;
+		mp->sym_array = (struct sym_table *) 0;
+		++num_modules;
+		return(1);
+	}
+	else
+	{
+		mp = &sym_array_modules[num_modules - 1];
+		AddSymbol(mp, address, symbol);
+	}
+
+
+	return(1);
+}
+
+
+/**************************************************************************
+ * Function:	AddSymbol
+ *
+ * Purpose:	This function is responsible for adding a symbol name
+ *		and its address to the symbol table.
+ *
+ * Arguements:	(struct Module *) mp, (unsigned long) address, (char *) symbol
+ *
+ *		mp:->	A pointer to the module which the symbol is
+ *			to be added to.
+ *
+ *		address:->	The address of the symbol.
+ *
+ *		symbol:->	The name of the symbol.
+ *
+ * Return:	int
+ *
+ *		A boolean value is assumed.  True if the addition is
+ *		successful.  False if not.
+ **************************************************************************/
+
+static int AddSymbol(mp, address, symbol)
+
+	struct Module *mp;     
+
+	unsigned long address;
+	
+	char *symbol;
+	
+{
+	auto int tmp;
+
+
+	/* Allocate space for the symbol table entry. */
+	mp->sym_array = (struct sym_table *) realloc(mp->sym_array, \
+        	(mp->num_syms+1) * sizeof(struct sym_table));
+	if ( mp->sym_array == (struct sym_table *) 0 )
+		return(0);
+
+	/* Then the space for the symbol. */
+	tmp = strlen(symbol);
+	tmp += (strlen(mp->name) + 1);
+	mp->sym_array[mp->num_syms].name = (char *) malloc(tmp + 1);
+	if ( mp->sym_array[mp->num_syms].name == (char *) 0 )
+		return(0);
+	memset(mp->sym_array[mp->num_syms].name, '\0', tmp + 1);
+	
+	/* Stuff interesting information into the module. */
+	mp->sym_array[mp->num_syms].value = address;
+	strcpy(mp->sym_array[mp->num_syms].name, mp->name);
+	strcat(mp->sym_array[mp->num_syms].name, ":");
+	strcat(mp->sym_array[mp->num_syms].name, symbol);
+	++mp->num_syms;
+
+	return(1);
+}
+
+
+/**************************************************************************
+ * Function:	LookupModuleSymbol
+ *
+ * Purpose:	Find the symbol which is related to the given address from
+ *		a kernel module.
+ *
+ * Arguements:	(long int) value, (struct symbol *) sym
+ *
+ *		value:->	The address to be located.
+ * 
+ *		sym:->		A pointer to a structure which will be
+ *				loaded with the symbol's parameters.
+ *
+ * Return:	(char *)
+ *
+ *		If a match cannot be found a diagnostic string is printed.
+ *		If a match is found the pointer to the symbolic name most
+ *		closely matching the address is returned.
+ **************************************************************************/
+
+extern char * LookupModuleSymbol(value, sym)
+
+	unsigned long value;
+
+	struct symbol *sym;
+	
+{
+	auto int	nmod,
+			nsym;
+
+	auto struct sym_table *last;
+
+	auto struct Module *mp;
+
+
+	sym->size = 0;
+	sym->offset = 0;
+	if ( num_modules == 0 )
+		return((char *) 0);
+	
+	for(nmod= 0; nmod < num_modules; ++nmod)
+	{
+		mp = &sym_array_modules[nmod];
+
+		/*
+		 * Run through the list of symbols in this module and
+		 * see if the address can be resolved.
+		 */
+		for(nsym= 1, last = &mp->sym_array[0];
+		    nsym < mp->num_syms;
+		    ++nsym)
+		{
+			if ( mp->sym_array[nsym].value > value )
+			{		
+				sym->offset = value - last->value;
+				sym->size = mp->sym_array[nsym].value - \
+					last->value;
+				return(last->name);
+			}
+			last = &mp->sym_array[nsym];
+		}
+
+
+		/*
+		 * At this stage of the game we still cannot give up the
+		 * ghost.  There is the possibility that the address is
+		 * from a module which has no symbols registered with
+		 * the kernel.  The solution is to compare the address
+		 * against the starting address and extant of the module
+		 * If it is in this range we can at least return the
+		 * name of the module.
+		 */
+		if ( (void *) value >= mp->module.addr &&
+		     (void *) value <= (mp->module.addr + \
+					mp->module.size * 4096) )
+		{
+			/*
+			 * A special case needs to be checked for.  The above
+			 * conditional tells us that we are within the
+			 * extant of this module but symbol lookup has
+			 * failed.
+			 *
+			 * We need to check to see if any symbols have
+			 * been defined in this module.  If there have been
+			 * symbols defined the assumption must be made that
+			 * the faulting address lies somewhere beyond the
+			 * last symbol.  About the only thing we can do
+			 * at this point is use an offset from this
+			 * symbol.
+			 */
+			if ( mp->num_syms > 0 )
+			{
+				last = &mp->sym_array[mp->num_syms - 1];
+				sym->size = (int) mp->module.addr + \
+					(mp->module.size * 4096) - value;
+				sym->offset = value - last->value;
+				return(last->name);
+			}
+
+			/*
+			 * There were no symbols defined for this module.
+			 * Return the module name and the offset of the
+			 * faulting address in the module.
+			 */
+			sym->size = mp->module.size * 4096;
+			sym->offset = (void *) value - mp->module.addr;
+			return(mp->name);
+		}
+	}
+
+	/* It has been a hopeless exercise. */
+	return((char *) 0);
+}
+
+
+/*
+ * Setting the -DTEST define enables the following code fragment to
+ * be compiled.  This produces a small standalone program which will
+ * dump the current kernel symbol table.
+ */
+#if defined(TEST)
+
+#include <stdarg.h>
+
+
+extern int main(int, char **);
+
+
+int main(argc, argv)
+
+	int argc;
+
+	char *argv[];
+
+{
+	auto int lp, syms;
+
+
+	if ( !InitMsyms() )
+	{
+		fprintf(stderr, "Cannot load module symbols.\n");
+		return(1);
+	}
+
+	printf("Number of modules: %d\n\n", num_modules);
+
+	for(lp= 0; lp < num_modules; ++lp)
+	{
+		printf("Module #%d = %s, Number of symbols = %d\n", lp + 1, \
+		       sym_array_modules[lp].name, \
+		       sym_array_modules[lp].num_syms);
+
+		for (syms= 0; syms < sym_array_modules[lp].num_syms; ++syms)
+		{
+			printf("\tSymbol #%d\n", syms + 1);
+			printf("\tName: %s\n", \
+			       sym_array_modules[lp].sym_array[syms].name);
+			printf("\tAddress: %lx\n\n", \
+			       sym_array_modules[lp].sym_array[syms].value);
+		}
+	}
+
+	FreeModules();
+	return(0);
+}
+#endif
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/ksyms.h sysklogd-1.3/ksyms.h
--- v1.3-1/sysklogd-1.3/ksyms.h	Wed Dec 31 18:00:00 1969
+++ sysklogd-1.3/ksyms.h	Sun Mar 31 16:44:26 1996
@@ -0,0 +1,36 @@
+/*
+    ksym.h - Definitions for symbol table utilities.
+    Copyright (c) 1995, 1996  Dr. G.W. Wettstein <greg@wind.rmcc.com>
+    Copyright (c) 1996 Enjellic Systems Development
+
+    This file is part of the sysklogd package, a kernel and system log daemon.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+
+
+/* Variables, structures and type definitions static to this module. */
+
+struct symbol
+{
+	char *name;
+	int size;
+	int offset;
+};
+
+
+/* Function prototypes. */
+extern char * LookupModuleSymbol(unsigned long int, struct symbol *);
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/oops.c sysklogd-1.3/oops.c
--- v1.3-1/sysklogd-1.3/oops.c	Wed Dec 31 18:00:00 1969
+++ sysklogd-1.3/oops.c	Thu May  2 15:25:49 1996
@@ -0,0 +1,118 @@
+/*
+ * Loadable driver which provides the ability to generate a kernel
+ * protection fault.  Mainly useful for testing the address translation
+ * capabilities of klogd.
+ *
+ * Fri Oct 27 14:34:27 CDT 1995:  Dr. Wettstein
+ *
+ *	Initial version.
+ */
+
+#define NEW_MODULES
+
+/* Kernel includes. */
+#include <linux/kernel.h>
+#include <linux/config.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+
+/* Standard module stuff. */
+#if defined(NEW_MODULES)
+#include <linux/module.h>
+#else
+#include <linux/module.h>
+#include <linux/version.h>
+char kernel_version[] = UTS_RELEASE;
+#endif
+
+
+static int major = 32;
+
+
+#ifdef MODULE
+static int oops_ioctl(struct inode *, struct file *, unsigned int cmd, unsigned long arg);
+static int oops_open(struct inode * node, struct file * file);
+static void oops(void);
+
+static struct symbol_table these_symbols = {
+#include <linux/symtab_begin.h>
+	X(oops_open),
+	X(oops_ioctl),
+	X(oops),
+#include <linux/symtab_end.h>
+};
+
+/* driver specific module definitions */
+static struct file_operations oops_fops1 = {
+	NULL,		/* hw_lseek */
+	NULL,		/* hw_read */
+	NULL,		/* write */
+	NULL,		/* hw_readdir */
+	NULL,		/* hw_select */
+	oops_ioctl,	/* hw_ioctl */
+	NULL,		/* mmap */
+	oops_open,	/* hw_open */
+	NULL,		/* hw_release */
+	NULL		/* fsync */
+};
+
+static int oops_open(struct inode * node, struct file * file)
+{
+	printk("Called oops_open.\n");
+	return(0);
+}
+
+
+static int oops_ioctl(struct inode * node, struct file * file, \
+		      unsigned int cmd, unsigned long arg)
+{
+	
+	printk("Called oops_ioctl.\n");
+	printk("Cmd: %d, Arg: %ld\n", cmd, arg);
+	if ( cmd == 1 )
+	{
+		oops();
+	}
+		
+	return(0);
+}
+
+static void oops()
+
+{
+	auto unsigned long *p = (unsigned long *) 828282828;
+	*p = 5;
+	return;
+}
+
+	
+int
+init_module(void)
+{
+	printk("oops: Module initilization.\n");
+	if (register_chrdev(major, "oops", &oops_fops1)) {
+		printk("register_chrdev failed.");
+		return -EIO;
+	}
+
+	printk("oops: Registering symbols.\n");
+  	register_symtab(&these_symbols);
+	
+	return 0;
+}
+
+
+void
+cleanup_module(void)
+{
+	/* driver specific cleanups, ususally "unregister_*()" */
+	printk("oops: Module unloadeding.\n");
+	if (unregister_chrdev(major, "oops") != 0)
+		printk("cleanup_module failed\n");
+	else
+		printk("cleanup_module succeeded\n");
+
+	return;
+
+}
+#endif /* MODULE */
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/oops_test.c sysklogd-1.3/oops_test.c
--- v1.3-1/sysklogd-1.3/oops_test.c	Wed Dec 31 18:00:00 1969
+++ sysklogd-1.3/oops_test.c	Fri Apr 26 13:07:32 1996
@@ -0,0 +1,52 @@
+/*
+ * This is a small test program for generating a kernel protection fault
+ * using the oops loadable module.
+ *
+ * Fri Apr 26 12:52:43 CDT 1996:  Dr. Wettstein
+ *	Initial version.
+ */
+
+
+/* Includes. */
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+
+/* Function prototypes. */
+extern int main(int, char **);
+
+
+extern int main(argc, argv)
+
+     int argc;
+
+     char *argv[];
+
+{
+	auto int fd;
+
+	if ( argc != 2 )
+	{
+		fprintf(stderr, "No oops device specified.\n");
+		return(1);
+	}
+
+	if ( (fd = open(argv[1], O_RDONLY)) < 0 )
+	{
+		fprintf(stderr, "Cannot open device: %s.\n", argv[1]);
+		return(1);
+	}
+
+	if ( ioctl(fd, 1, 0) < 0 )
+	{
+		fprintf(stderr, "Failed on oops.\n");
+		return(1);
+	}
+
+	printf("OOoops\n");
+
+	close(fd);
+	return(0);
+}
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/syslogd.c sysklogd-1.3/syslogd.c
--- v1.3-1/sysklogd-1.3/syslogd.c	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/syslogd.c	Thu May  2 15:18:09 1996
@@ -269,6 +269,14 @@
  *	when syslogd starts up.
  *
  *	Minor code cleanups.
+ *
+ * Thu May  2 15:15:33 CDT 1996:  Dr. Wettstein
+ *	Fixed bug in init function which resulted in file descripters
+ *	being orphaned when syslogd process was re-initialized with SIGHUP
+ *	signal.  Thanks to Edvard Tuinder
+ *	(Edvard.Tuinder@praseodymium.cistron.nl) for putting me on the
+ *	trail of this bug.  I am amazed that we didn't catch this one
+ *	before now.
  */
 
 
@@ -1846,47 +1854,37 @@
 	register char *p;
 	char cline[BUFSIZ];
 
-	dprintf("Called init.\n");
 
 	/*
-	 *  Close all open log files.
+	 *  Close all open log files and free log descriptor array.
 	 */
+	dprintf("Called init.\n");
 	Initialized = 0;
 	if ( nlogs > -1 )
 	{
 		dprintf("Initializing log structures.\n");
+
+		for (lognum = 0; lognum <= nlogs; lognum++ ) {
+			f = &Files[lognum];
+
+			/* flush any pending output */
+			if (f->f_prevcount)
+				fprintlog(f, LocalHostName, 0, (char *)NULL);
+
+			switch (f->f_type) {
+				case F_FILE:
+				case F_TTY:
+				case F_CONSOLE:
+					(void) close(f->f_file);
+				break;
+			}
+		}
+
 		nlogs = -1;
 		free((void *) Files);
 		Files = (struct filed *) 0;
 	}
 	
-#ifdef SYSV
-	for (lognum = 0; lognum <= nlogs; lognum++ ) {
-		f = &Files[lognum];
-#else
-	for (f = Files; f != NULL; f = next) {
-#endif
-		/* flush any pending output */
-		if (f->f_prevcount)
-			fprintlog(f, LocalHostName, 0, (char *)NULL);
-
-		switch (f->f_type) {
-		  case F_FILE:
-		  case F_TTY:
-		  case F_CONSOLE:
-			(void) close(f->f_file);
-			break;
-		}
-#ifdef SYSV
-		f->f_type = F_UNUSED;	/* clear entry - ASP */
-	}
-#else
-		next = f->f_next;
-		free((char *) f);
-	}
-	Files = NULL;
-	nextp = &OBFiles;
-#endif
 
 	/* open the configuration file */
 	if ((cf = fopen(ConfFile, "r")) == NULL) {
diff -u --new-file --recursive v1.3-1/sysklogd-1.3/version.h sysklogd-1.3/version.h
--- v1.3-1/sysklogd-1.3/version.h	Sun Mar 31 11:19:05 1996
+++ sysklogd-1.3/version.h	Wed Apr 17 15:15:58 1996
@@ -1,2 +1,2 @@
 #define VERSION "1.3"
-#define PATCHLEVEL "1"
+#define PATCHLEVEL "2"
Cut here to complete separating patch 2. ----------------------------------

Cut here to begin separating patch 3. -------------------------------------
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/ANNOUNCE ./sysklogd-1.3/ANNOUNCE
--- v1.3-2/sysklogd-1.3/ANNOUNCE	Tue Feb 27 16:19:26 1996
+++ ./sysklogd-1.3/ANNOUNCE	Thu Aug 29 08:44:55 1996
@@ -1,6 +1,6 @@
-On behalf of Martin Schulze, the beta-testers and other members of the
-Linux INTERNET community who have helped shape and debug this package
-I am pleased to announce version 1.3 of the sysklogd package.
+On behalf of the beta-testers and other members of the Linux INTERNET
+community who have helped shape and debug this package I am pleased to
+announce version 1.3-pl3 of the sysklogd package.
 
 This package implements two system log daemons. The syslogd daemon is
 an enhanced version of the standard Berkeley utility program. This
@@ -26,6 +26,9 @@
 	* klogd supports on-the-fly kernel address to symbol
 	translations. This requires that a valid kernel symbol map be
 	found at execution.
+
+	* klogd also supports debugging of protection faults which occur
+	in kernel loadable modules.
 
 	* syslogd has better handling of remote logging capabilities.
 
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/MANIFEST ./sysklogd-1.3/MANIFEST
--- v1.3-2/sysklogd-1.3/MANIFEST	Fri Aug 30 11:19:11 1996
+++ ./sysklogd-1.3/MANIFEST	Thu Aug 29 10:02:33 1996
@@ -56,3 +56,7 @@
 
 oops_test.c:	A small driver program used in conjunction with the oops
 		module to generate a kernel protection fault.
+
+modules.patch:	A patch to the modules-2.0.0 package which provides for
+		automatic signalling of klogd whenever the kernel module
+		state changes.
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/NEWS ./sysklogd-1.3/NEWS
--- v1.3-2/sysklogd-1.3/NEWS	Fri Aug 30 11:19:10 1996
+++ ./sysklogd-1.3/NEWS	Fri Aug 30 11:13:28 1996
@@ -1,3 +1,42 @@
+Version 1.3 Patch Level 3
+
+General. ------------------------------------------------------------------
+Update to documentation including klogd.8 manpage to reflect new features.
+
+Included patch for modules-2.0.0 package to provide support for signalling
+klogd of changes in kernel module status.
+
+klogd ---------------------------------------------------------------------
+Provided support for signalling klogd to reload static and kernel module
+symbol information via SIGUSR1 and SIGUSR2.
+
+Implemented -p switch to cause a reload of kernel module symbol information
+whenever a protection fault is detected.
+
+Informative message is printed whenever klogd state change occurs.
+
+Added -i and -I switches to signal the currently executing klogd daemon
+to reload symbold information.
+
+
+Version 1.3 Patch Level 2
+
+General. ------------------------------------------------------------------
+Added oops.c and oops_test.c.  Oops.c implements a kernel loadable module
+which will generate a general protection fault.  The oops_test.c program
+generates a test program for exercising the loadable module.
+
+syslogd ------------------------------------------------------------------
+Fixed bug resulting in file descriptors being orphaned when syslogd was
+initialized via signal handler.
+
+klogd ---------------------------------------------------------------------
+Bug fix to prevent errors when reading symbol tables with 64 bit addresses.
+
+Added support for debugging of protection faults occuring in kernel
+loadable modules.
+
+
 Version 1.3 Patch Level 1
 
 General. ------------------------------------------------------------------
@@ -9,7 +48,6 @@
 
 Spelling and grammar corrections in the man pages.
 
-
 syslogd ------------------------------------------------------------------
 Patch to fix parsing of hostnames in syslogd.c.
 
@@ -18,7 +56,6 @@
 
 Bounds error fixed when setting the file descriptors for UNIX domain
 sockets.
-
 
 klogd ---------------------------------------------------------------------
 Error checking and reporting enhanced.  I have a couple of reports
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/Sysklogd-1.3.lsm ./sysklogd-1.3/Sysklogd-1.3.lsm
--- v1.3-2/sysklogd-1.3/Sysklogd-1.3.lsm	Tue Feb 27 16:22:57 1996
+++ ./sysklogd-1.3/Sysklogd-1.3.lsm	Fri Aug 30 10:52:39 1996
@@ -12,6 +12,8 @@
 		routes them to either output files or to syslogd.  This
 		version of klogd will optionally translate kernel addresses
 		to their symbolic equivalents if provided with a system map.
+		The klogd daemon also provides support for debugging of
+		protection faults which occur in kernel loadable modules.
 Keywords:       logging, remote, kernel, syslogd, proc, daemon, klogd
 Author:         greg@wind.rmcc.com (Dr. G.W. Wettstein)
 Maintained-by:  greg@wind.rmcc.com (Dr. G.W. Wettstein)
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/klogd.8 ./sysklogd-1.3/klogd.8
--- v1.3-2/sysklogd-1.3/klogd.8	Fri Dec 15 15:06:26 1995
+++ ./sysklogd-1.3/klogd.8	Fri Aug 30 11:00:56 1996
@@ -2,6 +2,7 @@
 .\" May be distributed under the GNU General Public License
 .\" Sun Jul 30 01:35:55 MET: Martin Schulze: Updates
 .\" Sun Nov 19 23:22:21 MET: Martin Schulze: Updates
+.\" Mon Aug 19 09:42:08 CDT 1996: Dr. G.W. Wettstein: Updates
 .\"
 .TH KLOGD 8 "24 November 1995" "Version 1.3" "Linux System Administration"
 .SH NAME
@@ -16,8 +17,10 @@
 .RB [ " \-f "
 .I fname
 ]
+.RB [ " \-iI " ]
 .RB [ " \-n " ]
 .RB [ " \-o " ]
+.RB [ " \-p " ]
 .RB [ " \-s " ]
 .RB [ " \-k "
 .I fname
@@ -41,6 +44,12 @@
 .BI "\-f " file
 Log messages to the specified filename rather than to the syslog facility.
 .TP
+.BI "\-i \-I"
+Signal the currently executing klogd daemon.  Both of these switches control
+the loading/reloading of symbol information.  The \-i switch signals the
+daemon to reload the kernel module symbols.  The \-I switch signals for a
+reload of both the static kernel symbols and the kernel module symbols.
+.TP
 .B "\-n"
 Avoid auto-backgrounding. This is needed especially if the
 .B klogd
@@ -52,6 +61,12 @@
 all the messages that are found in the kernel message buffers.  After
 a single read and log cycle the daemon exits.
 .TP
+.B "-p"
+Enable paranoia.  This option controls when klogd loads kernel module symbol
+information.  Setting this switch causes klogd to load the kernel module
+symbol information whenever an Oops string is detected in the kernel message
+stream.
+.TP
 .B "-s"
 Force \fBklogd\fP to use the system call interface to the kernel message
 buffers.
@@ -72,15 +87,15 @@
 
 In Linux there are two potential sources of kernel log information: the 
 .I /proc
-filesystem and the syscall (sys_syslog) interface, although
+file system and the syscall (sys_syslog) interface, although
 ultimately they are one and the same.  Klogd is designed to choose
 whichever source of information is the most appropriate.  It does this
 by first checking for the presence of a mounted 
 .I /proc
-filesystem. If this is found the 
+file system. If this is found the 
 .I /proc/kmsg
 file is used as the source of kernel log
-information. If the proc filesystem is not mounted 
+information. If the proc file system is not mounted 
 .B klogd
 uses a
 system call to obtain kernel messages.  The command line switch
@@ -163,10 +178,43 @@
 .fi
 .PP
 .SH KERNEL ADDRESS RESOLUTION
+If the kernel detects an internal error condition a general protection
+fault will be triggered.  As part of the GPF handling procedure the
+kernel prints out a status report indicating the state of the
+processor at the time of the fault.  Included in this display are the
+contents of the microprocessor's registers, the contents of the kernel
+stack and a tracing of what functions were being executed at the time
+of the fault.
+
+This information is
+.B EXTREMELY IMPORTANT
+in determining what caused the internal error condition.  The
+difficulty comes when a kernel developer attempts to analyze this
+information.  The raw numeric information present in the protection
+fault printout is of very little use to the developers.  This is due
+to the fact that kernels are not identical and the addresses of
+variable locations or functions will not be the same in all kernels.
+In order to correctly diagnose the cause of failure a kernel developer
+needs to know what specific kernel functions or variable locations
+were involved in the error.
+
+As part of the kernel compilation process a listing is created which
+specified the address locations of important variables and function in
+the kernel being compiled.  This listing is saved in a file called
+System.map in the top of the kernel directory source tree.  Using this
+listing a kernel developer can determine exactly what the kernel was
+doing when the error condition occurred.
+
+The process of resolving the numeric addresses from the protection
+fault printout can be done manually or by using the
+.B ksymoops
+program which is included in the kernel sources.
+
+As a convenience
 .B klogd
 will attempt to resolve kernel numeric addresses to their symbolic
-forms if a kernel symbol table is available at execution time.
-A symbol table may be specified by using the \fB\-k\fR switch on the
+forms if a kernel symbol table is available at execution time.  A
+symbol table may be specified by using the \fB\-k\fR switch on the
 command line.  If a symbol file is not explicitly specified the
 following filenames will be tried:
 
@@ -192,19 +240,101 @@
 so that they will be recognized and translated by klogd.  Earlier
 kernels require a source code patch be applied to the kernel sources.
 This patch is supplied with the sysklogd sources.
+
+The process of analyzing kernel protections faults works very well
+with a static kernel.  Additional difficulties are encountered when
+attempting to diagnose errors which occur in loadable kernel modules.
+Loadable kernel modules are used to implement kernel functionality in
+a form which can be loaded or unloaded at will.  The use of loadable
+modules is useful from a debugging standpoint and can also be useful
+in decreasing the amount of memory required by a kernel.
+
+The difficulty with diagnosing errors in loadable modules is due to
+the dynamic nature of the kernel modules.  When a module is loaded the
+kernel will allocate memory to hold the module, when the module is
+unloaded this memory will be returned back to the kernel.  This
+dynamic memory allocation makes it impossible to produce a map file
+which details the addresses of the variable and functions in a kernel
+loadable module.  Without this location map it is not possible for a
+kernel developer to determine what went wrong if a protection fault
+involves a kernel module.
+
+.B klogd
+has support for dealing with the problem of diagnosing protection
+faults in kernel loadable modules.  At program start time or in
+response to a signal the daemon will interrogate the kernel for a
+listing of all modules loaded and the addresses in memory they are
+loaded at.  Individual modules can also register the locations of
+important functions when the module is loaded.  The addresses of these
+exported symbols are also determined during this interrogation
+process.
+
+When a protection fault occurs an attempt will be made to resolve
+kernel addresses from the static symbol table.  If this fails the
+symbols from the currently loaded modules are examined in an attempt
+to resolve the addresses.  At the very minimum this allows klogd to
+indicate which loadable module was responsible for generating the
+protection fault.  Additional information may be available if the
+module developer chose to export symbol information from the module.
+
+Proper and accurate resolution of addresses in kernel modules requires
+that
+.B klogd
+be informed whenever the kernel module status changes.  The
+.B \-i
+and
+.B \-I
+switches can be used to signal the currently executing daemon that
+symbol information be reloaded.  Of most importance to proper
+resolution of module symbols is the
+.B \-i
+switch.  Each time a kernel module is loaded or removed from the
+kernel the following command should be executed:
+
+.nf
+.I klogd \-i
+.fi
+
+The
+.B \-p
+switch can also be used to insure that module symbol information is up
+to date.  This switch instructs
+.B klogd
+to reload the module symbol information whenever a protection fault
+is detected.  Caution should be used before invoking the program in
+\'paranoid\' mode.  The stability of the kernel and the operating
+environment is always under question when a protection fault occurs.
+Since the klogd daemon must execute system calls in order to read the
+module symbol information there is the possibility that the system may
+be too unstable to capture useful information.  A much better policy
+is to insure that klogd is updated whenever a module is loaded or
+unloaded.  Having uptodate symbol information loaded increases the
+probability of properly resolving a protection fault if it should occur.
+
+Included in the sysklogd source distribution is a patch to the
+modules-2.0.0 package which allows the
+.B insmod,
+.B rmmod
+and
+.B modprobe
+utilities to automatically signal
+.B klogd
+whenever a module is inserted or removed from the kernel.  Using this
+patch will insure that the symbol information maintained in klogd is
+always consistent with the current kernel state.
 .PP
 .SH SIGNAL HANDLING
 The 
 .B klogd
-will respond to six signals:
-.BR SIGHUP ", " SIGINT ", " SIGKILL ", " SIGTERM ", " SIGTSTP " and " SIGCONT ". The"
+will respond to eight signals:
+.BR SIGHUP ", " SIGINT ", " SIGKILL ", " SIGTERM ", " SIGTSTP ", " SIGUSR1 ", "SIGUSR2 " and " SIGCONT ". The"
 .BR SIGINT ", " SIGKILL ", " SIGTERM " and " SIGHUP
 signals will cause the daemon to close its kernel log sources and
 terminate gracefully.
 
 The 
 .BR SIGTSTP " and " SIGCONT
-singals are used to start and stop kernel logging. Upon receipt of a 
+signals are used to start and stop kernel logging. Upon receipt of a 
 .B SIGTSTP
 signal the daemon will close its
 log sources and spin in an idle loop.  Subsequent receipt of a 
@@ -229,6 +359,26 @@
 .B LOG_INFO
 priority
 documenting the start/stop of logging.
+
+The 
+.BR SIGUSR1 " and " SIGUSR2
+signals are used to initiate loading/reloading of kernel symbol information.
+Receipt of the
+.B SIGUSR1
+signal will cause the kernel module symbols to be reloaded.  Signaling the
+daemon with
+.B SIGUSR2
+will cause both the static kernel symbols and the kernel module symbols to
+be reloaded.
+
+Provided that the System.map file is placed in an appropriate location the
+signal of generally greatest usefulness is the
+.B SIGUSR1
+signal.  This signal is designed to be used to signal the daemon when kernel
+modules are loaded/unloaded.  Sending this signal to the daemon after a
+kernel module state change will insure that proper resolution of symbols will
+occur if a protection fault occurs in the address space occupied by a kernel
+module.
 .LP
 .SH FILES
 .PD 0
@@ -241,7 +391,7 @@
 The file containing the process id of 
 .B klogd
 .TP
-.I /System.map, /usr/src/linux/System.map
+.I /boot/System.map, /System.map, /usr/src/linux/System.map
 Default locations for kernel system maps.
 .PD
 .SH BUGS
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/klogd.c ./sysklogd-1.3/klogd.c
--- v1.3-2/sysklogd-1.3/klogd.c	Fri Aug 30 11:19:11 1996
+++ ./sysklogd-1.3/klogd.c	Wed Aug 21 09:15:17 1996
@@ -141,6 +141,18 @@
  *	termination cleanup sequence.  This minimizes the potential for
  *	conflicting pidfiles causing immediate termination at boot time.
  *	
+ * Wed Aug 21 09:13:03 CDT 1996:  Dr. Wettstein
+ *	Added ability to reload static symbols and kernel module symbols
+ *      under control of SIGUSR1 and SIGUSR2 signals.
+ *
+ *	Added -p switch to select 'paranoid' behavior with respect to the
+ *	loading of kernel module symbols.
+ *
+ *	Informative line now printed whenever a state change occurs due
+ *	to signal reception by the daemon.
+ *
+ *	Added the -i and -I command line switches to signal the currently
+ *	executing daemon.
  */
 
 
@@ -177,13 +189,15 @@
 		change_state = 0,
 		terminate = 0,
 		caught_TSTP = 0,
+		reload_symbols = 0,
 		console_log_level = 6;
 
 static int	use_syscall = 0,
 		one_shot = 0,
 		NoFork = 0;	/* don't fork - don't run in daemon mode */
 
-static char log_buffer[LOG_BUFFER_SIZE];
+static char	*symfile = (char *) 0,
+		log_buffer[LOG_BUFFER_SIZE];
 
 static FILE *output_file = (FILE *) 0;
 
@@ -198,7 +212,10 @@
 extern void restart(int sig);
 extern void stop_logging(int sig);
 extern void stop_daemon(int sig);
+extern void reload_daemon(int sig);
 static void Terminate(void);
+static void SignalDaemon(int);
+static void ReloadSymbols(void);
 static void ChangeLogging(void);
 static enum LOGSRC GetKernelLogSrc(void);
 static void LogLine(char *ptr, int len);
@@ -269,6 +286,27 @@
 }
 
 
+void reload_daemon(sig)
+
+     int sig;
+
+{
+	change_state = 1;
+	reload_symbols = 1;
+
+
+	if ( sig == SIGUSR2 )
+	{
+		++reload_symbols;
+		signal(SIGUSR2, reload_daemon);
+	}
+	else
+		signal(SIGUSR1, reload_daemon);
+		
+	return;
+}
+
+
 static void Terminate()
 
 {
@@ -282,7 +320,29 @@
 	exit(1);
 }
 
-	
+static void SignalDaemon(sig)
+
+     int sig;
+
+{
+	auto int pid = check_pid(PidFile);
+
+	kill(pid, sig);
+	return;
+}
+
+
+static void ReloadSymbols()
+
+{
+	if ( reload_symbols > 1 )
+		InitKsyms(symfile);
+	InitMsyms();
+	reload_symbols = change_state = 0;
+	return;
+}
+
+
 static void ChangeLogging(void)
 
 {
@@ -290,6 +350,17 @@
 	if ( terminate == 1 )
 		Terminate();
 
+	/* Indicate that something is happening. */
+	Syslog(LOG_INFO, "klogd %s-%s, ---------- state change ----------\n", \
+	       VERSION, PATCHLEVEL);
+
+	/* Reload symbols. */
+	if ( reload_symbols > 0 )
+	{
+		ReloadSymbols();
+		return;
+	}
+
 	/* Stop kernel logging. */
 	if ( caught_TSTP == 1 )
 	{
@@ -566,14 +637,14 @@
 	char *argv[];
 
 {
-	auto int ch, use_output = 0;
+	auto int	ch,
+			use_output = 0;
 
-	auto char	*symfile = (char *) 0,
-			*log_level = (char *) 0,
+	auto char	*log_level = (char *) 0,
 			*output = (char *) 0;
 
 	/* Parse the command-line. */
-	while ((ch = getopt(argc, argv, "c:df:k:nosv")) != EOF)
+	while ((ch = getopt(argc, argv, "c:df:iIk:nopsv")) != EOF)
 		switch((char)ch)
 		{
 		    case 'c':		/* Set console message level. */
@@ -586,6 +657,12 @@
 			output = optarg;
 			use_output++;
 			break;
+		    case 'i':		/* Reload module symbols. */
+			SignalDaemon(SIGUSR1);
+			return(0);
+		    case 'I':
+			SignalDaemon(SIGUSR2);
+			return(0);
 		    case 'k':		/* Kernel symbol file. */
 			symfile = optarg;
 			break;
@@ -595,6 +672,9 @@
 		    case 'o':		/* One-shot mode. */
 			one_shot = 1;
 			break;
+		    case 'p':
+			SetParanoiaLevel(1);	/* Load symbols on oops. */
+			break;	
 		    case 's':		/* Use syscall interface. */
 			use_syscall = 1;
 			break;
@@ -682,6 +762,8 @@
 	signal(SIGHUP, stop_daemon);
 	signal(SIGTSTP, stop_logging);
 	signal(SIGCONT, restart);
+	signal(SIGUSR1, reload_daemon);
+	signal(SIGUSR2, reload_daemon);
 
 
 	/* Open outputs. */
@@ -704,6 +786,7 @@
 	if ( one_shot )
 	{
 		InitKsyms(symfile);
+		InitMsyms();
 		if ( (logsrc = GetKernelLogSrc()) == kernel )
 			LogKernelLine();
 		else
@@ -717,6 +800,7 @@
 #endif
 	logsrc = GetKernelLogSrc();
 	InitKsyms(symfile);
+	InitMsyms();
 
         /* The main loop. */
 	while (1)
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/klogd.h ./sysklogd-1.3/klogd.h
--- v1.3-2/sysklogd-1.3/klogd.h	Fri Aug 30 11:19:11 1996
+++ ./sysklogd-1.3/klogd.h	Tue Jul 30 10:57:17 1996
@@ -15,4 +15,5 @@
 extern int InitKsyms(char *);
 extern int InitMsyms(void);
 extern char * ExpandKadds(char *, char *);
+extern void SetParanoiaLevel(int);
 extern void Syslog(int priority, char *fmt, ...);
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/ksym.c ./sysklogd-1.3/ksym.c
--- v1.3-2/sysklogd-1.3/ksym.c	Fri Aug 30 11:19:12 1996
+++ ./sysklogd-1.3/ksym.c	Wed Aug 21 09:19:14 1996
@@ -62,6 +62,16 @@
  *	Added patch from beta-testers to allow for reading of both
  *	ELF and a.out map files.
  *
+ * Wed Aug 21 09:15:49 CDT 1996:  Dr. Wettstein
+ *	Reloading of kernel module symbols is now turned on by the
+ *	SetParanoiaLevel function.  The default behavior is to NOT reload
+ *	the kernel module symbols when a protection fault is detected.
+ *
+ *	Added support for freeing of the current kernel module symbols.
+ *	This was necessary to support reloading of the kernel module symbols.
+ *
+ *	When a matching static symbol table is loaded the kernel version
+ *	number is printed.
  */
 
 
@@ -83,6 +93,8 @@
 };
 
 static int num_syms = 0;
+static int i_am_paranoid = 0;
+static char vstring[12];
 static struct sym_table *sym_array = (struct sym_table *) 0;
 
 static char *system_maps[] =
@@ -108,6 +120,7 @@
 static char * FindSymbolFile(void);
 static int AddSymbol(unsigned long, char*);
 static char * LookupSymbol(unsigned long, struct symbol *);
+static void FreeSymbols(void);
 static int CheckVersion(char *);
 
 
@@ -144,6 +157,11 @@
 	auto FILE *sym_file;
 
 
+	/* Check and make sure that we are starting with a clean slate. */
+	if ( num_syms > 0 )
+		FreeSymbols();
+
+
 	/*
 	 * Search for and open the file containing the kernel symbols.
 	 */
@@ -222,7 +240,7 @@
 		break;
 		
 	    case 1:
-		Syslog(LOG_INFO, "Symbols match kernel version.");
+		Syslog(LOG_INFO, "Symbols match kernel version %s.", vstring);
 		break;
 	}
 		
@@ -397,8 +415,6 @@
 	
 
 {
-	auto char vstring[6];
-
 	auto int	vnum,
 			major,
 			minor,
@@ -423,16 +439,15 @@
 	 * things out by decoding the version string into its component
 	 * parts.
 	 */
-	memset(vstring, '\0', sizeof(vstring));
-	strncpy(vstring, version + strlen(prefix), sizeof(vstring)-1);
-	vnum = atoi(vstring);
+	vnum = atoi(version + strlen(prefix));
 	major = vnum / 65536;
 	vnum -= (major * 65536);
 	minor = vnum / 256;
 	patch = vnum - (minor * 256);
 	if ( debugging )
 		fprintf(stderr, "Version string = %s, Major = %d, " \
-		       "Minor = %d, Patch = %d.\n", vstring, major, minor, \
+		       "Minor = %d, Patch = %d.\n", version +
+		       strlen(prefix), major, minor, \
 		       patch);
 	sprintf(vstring, "%d.%d.%d", major, minor, patch);
 
@@ -558,6 +573,37 @@
 
 
 /**************************************************************************
+ * Function:	FreeSymbols
+ *
+ * Purpose:	This function is responsible for freeing all memory which
+ *		has been allocated to hold the static symbol table.  It
+ *		also initializes the symbol count and in general prepares
+ *		for a re-read of a static symbol table.
+ *
+ * Arguements:  void
+ *
+ * Return:	void
+ **************************************************************************/
+
+static void FreeSymbols()
+
+{
+	auto int lp;
+
+	/* Free each piece of memory allocated for symbol names. */
+	for(lp= 0; lp < num_syms; ++lp)
+		free(sym_array[lp].name);
+
+	/* Whack the entire array and initialize everything. */
+	free(sym_array);
+	sym_array = (struct sym_table *) 0;
+	num_syms = 0;
+
+	return;
+}
+
+
+/**************************************************************************
  * Function:	LogExpanded
  *
  * Purpose:	This function is responsible for logging a kernel message
@@ -610,7 +656,8 @@
 	 * kernel whenever a module is loaded or unloaded.  I am
 	 * open for patches.
 	 */
-	if ( (strstr(line, "Oops:") != (char *) 0) && !InitMsyms() )
+	if ( i_am_paranoid &&
+	     (strstr(line, "Oops:") != (char *) 0) && !InitMsyms() )
 		Syslog(LOG_WARNING, "Cannot load kernel module symbols.\n");
 	
 
@@ -670,6 +717,30 @@
 	if ( debugging )
 		fprintf(stderr, "Expanded line: %s\n", el);
 	return(el);
+}
+
+
+/**************************************************************************
+ * Function:	SetParanoiaLevel
+ *
+ * Purpose:	This function is an interface function for setting the
+ *		mode of loadable module symbol lookups.  Probably overkill
+ *		but it does slay another global variable.
+ *
+ * Arguements:	(int) level
+ *
+ *		level:->	The amount of paranoia which is to be
+ *				present when resolving kernel exceptions.
+ * Return:	void
+ **************************************************************************/
+
+extern void SetParanoiaLevel(level)
+
+	int level;
+
+{
+	i_am_paranoid = level;
+	return;
 }
 
 
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/ksym_mod.c ./sysklogd-1.3/ksym_mod.c
--- v1.3-2/sysklogd-1.3/ksym_mod.c	Fri Aug 30 11:19:12 1996
+++ ./sysklogd-1.3/ksym_mod.c	Fri Aug 23 11:45:27 1996
@@ -37,6 +37,15 @@
  * possible.
  *
  * At least that is the plan.
+ *
+ * Wed Aug 21 09:20:09 CDT 1996:  Dr. Wettstein
+ *	The situation where no module support has been compiled into a
+ *	kernel is now detected.  An informative message is output indicating
+ *	that the kernel has no loadable module support whenever kernel
+ *	module symbols are loaded.
+ *
+ *	An informative message is printed indicating the number of kernel
+ *	modules and the number of symbols loaded from these modules.
  */
 
 
@@ -65,7 +74,7 @@
  */
 #define __LIBRARY__
 #include <linux/unistd.h>
-# define __NR_getsyms __NR_get_kernel_syms
+#define __NR_getsyms __NR_get_kernel_syms
 _syscall1(int, getsyms, struct kernel_sym *, syms);
 #undef __LIBRARY__
 extern int getsyms(struct kernel_sym *);
@@ -87,7 +96,7 @@
 	struct module module;
 };
 
-static int num_modules;
+static int num_modules = 0;
 struct Module *sym_array_modules = (struct Module *) 0;
 
 static int have_modules = 0;
@@ -132,9 +141,8 @@
 				*p;
 
 
-	/* Init the symbol table if one exists. */
-	if ( num_modules > 0 )
-		FreeModules();
+	/* Initialize the kernel module symbol table. */
+	FreeModules();
 
 
 	/*
@@ -153,7 +161,16 @@
 	 *
 	 * Bummer.
 	 */
-	rtn = getsyms((struct kernel_sym *) 0);
+	if ( (rtn = getsyms((struct kernel_sym *) 0)) < 0 )
+	{
+		if ( errno == ENOSYS )
+			Syslog(LOG_INFO, "No module symbols loaded - "
+			       "kernel modules not enabled.\n");
+		else
+			Syslog(LOG_ERR, "Error loading kernel symbols " \
+			       "- %s\n", strerror(errno));
+		return(0);
+	}
 	if ( debugging )
 		fprintf(stderr, "Loading kernel module symbols - "
 			"Size of table: %d\n", rtn);
@@ -162,12 +179,16 @@
 						  sizeof(struct kernel_sym));
 	if ( ksym_table == (struct kernel_sym *) 0 )
 	{
-		Syslog(LOG_WARNING, " Failed memory allocation for kernel "
+		Syslog(LOG_WARNING, " Failed memory allocation for kernel " \
 		       "symbol table.\n");
 		return(0);
 	}
-	if ( (rtn = getsyms(ksym_table)) == 0 )
-		Syslog(LOG_WARNING, "Kernel symbol read returned 0\n");
+	if ( (rtn = getsyms(ksym_table)) < 0 )
+	{
+		Syslog(LOG_WARNING, "Error reading kernel symbols - %s\n", \
+		       strerror(errno));
+		return(0);
+	}
 
 
 	/*
@@ -189,8 +210,9 @@
 	}
 
 	/* Sort the symbol tables in each module. */
-	for (tmp= 0; tmp < num_modules; ++tmp)
+	for (rtn = tmp= 0; tmp < num_modules; ++tmp)
 	{
+		rtn += sym_array_modules[tmp].num_syms;
 		if ( sym_array_modules[tmp].num_syms < 2 )
 			continue;
 		qsort(sym_array_modules[tmp].sym_array, \
@@ -198,6 +220,12 @@
 		      sizeof(struct sym_table), symsort);
 	}
 
+	if ( rtn == 0 )
+		Syslog(LOG_INFO, "No module symbols loaded.");
+	else
+		Syslog(LOG_INFO, "Loaded %d %s from %d module%s", rtn, \
+		       (rtn == 1) ? "symbol" : "symbols", \
+		       num_modules, (num_modules == 1) ? "." : "s.");
 	free(ksym_table);
 	return(1);
 }
@@ -241,7 +269,13 @@
 	auto struct Module *mp;
 
 
-	for (nmods= 0; nmods <num_modules; ++nmods)
+	/* Check to see if the module symbol tables need to be cleared. */
+	have_modules = 0;
+	if ( num_modules == 0 )
+		return;
+
+
+	for (nmods= 0; nmods < num_modules; ++nmods)
 	{
 		mp = &sym_array_modules[nmods];
 		if ( mp->num_syms == 0 )
@@ -254,7 +288,7 @@
 
 	free(sym_array_modules);
 	sym_array_modules = (struct Module *) 0;
-	have_modules = num_modules = 0;
+	num_modules = 0;
 	return;
 }
 
@@ -296,6 +330,7 @@
 	 */
 	if ( symbol[0] == '#' )
 	{
+
 		if ( symbol[1] == '\0' )
 		{
 			/*
@@ -307,7 +342,6 @@
 			have_modules = 1;
 			return(1);
 		}
-
 		/* Allocate space for the module. */
 		sym_array_modules = (struct Module *) \
 			realloc(sym_array_modules, \
@@ -584,4 +618,19 @@
 	FreeModules();
 	return(0);
 }
+
+extern void Syslog(int priority, char *fmt, ...)
+
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	fprintf(stdout, "Pr: %d, ", priority);
+	vfprintf(stdout, fmt, ap);
+	va_end(ap);
+	fputc('\n', stdout);
+
+	return;
+}
+
 #endif
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/modutils.patch ./sysklogd-1.3/modutils.patch
--- v1.3-2/sysklogd-1.3/modutils.patch	Wed Dec 31 18:00:00 1969
+++ ./sysklogd-1.3/modutils.patch	Thu Aug 29 10:00:32 1996
@@ -0,0 +1,65 @@
+diff -u --new-file --recursive base/modules-2.0.0/depmod/modprobe.c ./modules-2.0.0/depmod/modprobe.c
+--- base/modules-2.0.0/depmod/modprobe.c	Mon Jun 10 05:29:08 1996
++++ ./modules-2.0.0/depmod/modprobe.c	Thu Aug 29 09:58:01 1996
+@@ -233,6 +233,13 @@
+ 	verbose ("\r\t%s\n\t\t",cmd);
+ 	int ret = system(cmd);
+ #endif
++	if ( fork() == 0 )
++	{
++		/* Child process. */
++		if ( execlp("klogd", "klogd", "-i", (char *) 0)  < 0 )
++			fprintf(stderr, "Failure in signaling klogd.\n");
++		exit(0);
++	}
+ 	return ret;
+ }
+ /*
+diff -u --new-file --recursive base/modules-2.0.0/insmod/insmod.c ./modules-2.0.0/insmod/insmod.c
+--- base/modules-2.0.0/insmod/insmod.c	Mon Jun 10 06:42:25 1996
++++ ./modules-2.0.0/insmod/insmod.c	Thu Aug 29 09:56:53 1996
+@@ -253,6 +253,18 @@
+ 	++n_stringpatches;
+ }
+ 
++
++void signal_klogd() {
++	if ( fork() == 0 )
++	{
++		if ( execlp("klogd", "klogd", "-i", (char *) 0)  < 0 )
++			fprintf(stderr, "Failure in signaling klogd.\n");
++		exit(0);
++	}
++	return;
++}
++
++
+ int main(int argc, char **argv)
+ {
+ 	FILE *fp;
+@@ -983,6 +995,8 @@
+ 			symvalue(sp) + addr, symtype, symname(sp));
+ 	}
+ 
++	signal_klogd();
++
+ 	if (nksyms > 0)
+ 		free(ksymtab); /* it has done its job */
+ 
+@@ -1292,6 +1306,7 @@
+ 			--argc;
+ 			++argv;
+ 		}
++		signal_klogd();
+ 		return errors;
+ 	}
+ 	/* else recursive removal */
+@@ -1353,6 +1368,8 @@
+ 			break;
+ 		}
+ 	}
++
++	signal_klogd();
+ 
+ 	return errors;
+ }
diff -u --new-file --recursive v1.3-2/sysklogd-1.3/version.h ./sysklogd-1.3/version.h
--- v1.3-2/sysklogd-1.3/version.h	Fri Aug 30 11:19:13 1996
+++ ./sysklogd-1.3/version.h	Fri Jul 12 13:03:12 1996
@@ -1,2 +1,2 @@
 #define VERSION "1.3"
-#define PATCHLEVEL "2"
+#define PATCHLEVEL "3"
Cut here to complete separating patch 3. ----------------------------------

}-- End of excerpt from "John M. Fisk"

As always,
Dr. G.W. Wettstein           Oncology Research Div. Computing Facility
Roger Maris Cancer Center    INTERNET: greg@wind.rmcc.com
820 4th St. N.
Fargo, ND  58122
Phone: 701-234-7556
------------------------------------------------------------------------------
"A computer without Windows is like a fish without a bicycle."
				-- Chris Woods