howie@cunixc.columbia.edu (Howie Kaye) (10/06/87)
We have had a problem where the major and minor device numbers of various devices have been changing to 0 (a scary bug, since it modifying the file system). We set up a program, and a list of devices for it to watch. Maybe if a bunch of us can report the symptoms to DEC, then they will be able to figure something out faster. Below is a shar file with the programs we have set up. If you have problems with them, please let me know. ------------------------------------------------------------ Howie Kaye howie@columbia.edu Columbia University hlkcu@cuvma.bitnet Systems Group ...!rutgers!columbia!howie #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # ./-README # ./DEVICES # ./DEVICES.README # ./Makefile # ./OURDEVS # ./checkdev.8 # ./checkdev.c # ./dev # ./showdev.8 # ./showdev.c # This archive created: Mon Oct 5 11:46:26 1987 export PATH; PATH=/bin:/usr/bin:$PATH if test -f './-README' then echo shar: "will not over-write existing file './-README'" else cat << \SHAR_EOF > './-README' DEVICES: The list of devices to be checked at columbia DEVICES.README: description of the DEVICES file. See checkdev.8 OURDEVS: Shell script run out of crontab to validate and correct device errors, and to notify us of them. dev: A shell script for looking at devices with a specific major/minor number showdev.c: program which just prints device names for a specified major/ minor number checkdev.c: program to do device error detection and correction. showdev.8: man page for showdev checkdev.8: man page for checkdev. We have things configured to run showdev/checkdev out of /etc, and OURDEV out of /dev. Also the file DEVICES resides in /dev. Some minor changes would be needed to move those around (ie, absolute filename in shell scripts). SHAR_EOF fi if test -f './DEVICES' then echo shar: "will not over-write existing file './DEVICES'" else cat << \SHAR_EOF > './DEVICES' c 622 root wheel 0 0 console y c 622 root wheel 0 1 ttyc1 y c 622 root wheel 0 2 ttyc2 y c 622 root wheel 0 3 ttyc3 y c 666 root wheel 2 0 tty y c 640 root kmem 3 0 mem y c 640 root kmem 3 1 kmem y c 666 root wheel 3 2 null y c 640 root kmem 3 3 kUmem y c 644 root wheel 7 0 drum y b 600 root wheel 9 0 ra0a y b 600 root wheel 9 1 ra0b y b 600 root wheel 9 2 ra0c y b 600 root wheel 9 3 ra0d y b 600 root wheel 9 4 ra0e y b 600 root wheel 9 5 ra0f y b 600 root wheel 9 6 ra0g y b 600 root wheel 9 7 ra0h y b 600 root wheel 9 8 ra1a y b 600 root wheel 9 9 ra1b y b 600 root wheel 9 10 ra1c y b 600 root wheel 9 11 ra1d y b 600 root wheel 9 12 ra1e y b 600 root wheel 9 13 ra1f y b 600 root wheel 9 14 ra1g y b 600 root wheel 9 15 ra1h y b 600 root wheel 9 16 ra2a y b 600 root wheel 9 17 ra2b y b 600 root wheel 9 18 ra2c y b 600 root wheel 9 19 ra2d y b 600 root wheel 9 20 ra2e y b 600 root wheel 9 21 ra2f y b 600 root wheel 9 22 ra2g y b 600 root wheel 9 23 ra2h y b 600 root wheel 9 24 ra3a y b 600 root wheel 9 25 ra3b y b 600 root wheel 9 26 ra3c y b 600 root wheel 9 27 ra3d y b 600 root wheel 9 28 ra3e y b 600 root wheel 9 29 ra3f y b 600 root wheel 9 30 ra3g y b 600 root wheel 9 31 ra3h y b 600 root wheel 9 32 ra4a y b 600 root wheel 9 33 ra4b y b 600 root wheel 9 34 ra4c y b 600 root wheel 9 35 ra4d y b 600 root wheel 9 36 ra4e y b 600 root wheel 9 37 ra4f y b 600 root wheel 9 38 ra4g y b 600 root wheel 9 39 ra4h y b 600 root wheel 9 40 ra5a y b 600 root wheel 9 41 ra5b y b 600 root wheel 9 42 ra5c y b 600 root wheel 9 43 ra5d y b 600 root wheel 9 44 ra5e y b 600 root wheel 9 45 ra5f y b 600 root wheel 9 46 ra5g y b 600 root wheel 9 47 ra5h y b 600 root wheel 9 48 ra6a y b 600 root wheel 9 49 ra6b y b 600 root wheel 9 50 ra6c y b 600 root wheel 9 51 ra6d y b 600 root wheel 9 52 ra6e y b 600 root wheel 9 53 ra6f y b 600 root wheel 9 54 ra6g y b 600 root wheel 9 55 ra6h y b 600 root wheel 9 56 ra7a y b 600 root wheel 9 57 ra7b y b 600 root wheel 9 58 ra7c y b 600 root wheel 9 59 ra7d y b 600 root wheel 9 60 ra7e y b 600 root wheel 9 61 ra7f y b 600 root wheel 9 62 ra7g y b 600 root wheel 9 63 ra7h y b 600 root wheel 9 64 ra8a y b 600 root wheel 9 65 ra8b y b 600 root wheel 9 66 ra8c y b 600 root wheel 9 67 ra8d y b 600 root wheel 9 68 ra8e y b 600 root wheel 9 69 ra8f y b 600 root wheel 9 70 ra8g y b 600 root wheel 9 71 ra8h y b 600 root wheel 9 72 ra9a y b 600 root wheel 9 73 ra9b y b 600 root wheel 9 74 ra9c y b 600 root wheel 9 75 ra9d y b 600 root wheel 9 76 ra9e y b 600 root wheel 9 77 ra9f y b 600 root wheel 9 78 ra9g y b 600 root wheel 9 79 ra9h y b 600 root wheel 9 80 ra10a y b 600 root wheel 9 81 ra10b y b 600 root wheel 9 82 ra10c y b 600 root wheel 9 83 ra10d y b 600 root wheel 9 84 ra10e y b 600 root wheel 9 85 ra10f y b 600 root wheel 9 86 ra10g y b 600 root wheel 9 87 ra10h y b 600 root wheel 9 88 ra11a y b 600 root wheel 9 89 ra11b y b 600 root wheel 9 90 ra11c y b 600 root wheel 9 91 ra11d y b 600 root wheel 9 92 ra11e y b 600 root wheel 9 93 ra11f y b 600 root wheel 9 94 ra11g y b 600 root wheel 9 95 ra11h y b 600 root wheel 9 96 ra12a y b 600 root wheel 9 97 ra12b y b 600 root wheel 9 98 ra12c y b 600 root wheel 9 99 ra12d y b 600 root wheel 9 100 ra12e y b 600 root wheel 9 101 ra12f y b 600 root wheel 9 102 ra12g y b 600 root wheel 9 103 ra12h y c 600 root wheel 9 0 rra0a y c 600 root wheel 9 1 rra0b y c 600 root wheel 9 2 rra0c y c 600 root wheel 9 3 rra0d y c 600 root wheel 9 4 rra0e y c 600 root wheel 9 5 rra0f y c 600 root wheel 9 6 rra0g y c 600 root wheel 9 7 rra0h y c 600 root wheel 9 8 rra1a y c 600 root wheel 9 9 rra1b y c 600 root wheel 9 10 rra1c y c 600 root wheel 9 11 rra1d y c 600 root wheel 9 12 rra1e y c 600 root wheel 9 13 rra1f y c 600 root wheel 9 14 rra1g y c 600 root wheel 9 15 rra1h y c 600 root wheel 9 16 rra2a y c 600 root wheel 9 17 rra2b y c 600 root wheel 9 18 rra2c y c 600 root wheel 9 19 rra2d y c 600 root wheel 9 20 rra2e y c 600 root wheel 9 21 rra2f y c 600 root wheel 9 22 rra2g y c 600 root wheel 9 23 rra2h y c 600 root wheel 9 24 rra3a y c 600 root wheel 9 25 rra3b y c 600 root wheel 9 26 rra3c y c 600 root wheel 9 27 rra3d y c 600 root wheel 9 28 rra3e y c 600 root wheel 9 29 rra3f y c 600 root wheel 9 30 rra3g y c 600 root wheel 9 31 rra3h y c 600 root wheel 9 32 rra4a y c 600 root wheel 9 33 rra4b y c 600 root wheel 9 34 rra4c y c 600 root wheel 9 35 rra4d y c 600 root wheel 9 36 rra4e y c 600 root wheel 9 37 rra4f y c 600 root wheel 9 38 rra4g y c 600 root wheel 9 39 rra4h y c 600 root wheel 9 40 rra5a y c 600 root wheel 9 41 rra5b y c 600 root wheel 9 42 rra5c y c 600 root wheel 9 43 rra5d y c 600 root wheel 9 44 rra5e y c 600 root wheel 9 45 rra5f y c 600 root wheel 9 46 rra5g y c 600 root wheel 9 47 rra5h y c 600 root wheel 9 48 rra6a y c 600 root wheel 9 49 rra6b y c 600 root wheel 9 50 rra6c y c 600 root wheel 9 51 rra6d y c 600 root wheel 9 52 rra6e y c 600 root wheel 9 53 rra6f y c 600 root wheel 9 54 rra6g y c 600 root wheel 9 55 rra6h y c 600 root wheel 9 56 rra7a y c 600 root wheel 9 57 rra7b y c 600 root wheel 9 58 rra7c y c 600 root wheel 9 59 rra7d y c 600 root wheel 9 60 rra7e y c 600 root wheel 9 61 rra7f y c 600 root wheel 9 62 rra7g y c 600 root wheel 9 63 rra7h y c 600 root wheel 9 64 rra8a y c 600 root wheel 9 65 rra8b y c 600 root wheel 9 66 rra8c y c 600 root wheel 9 67 rra8d y c 600 root wheel 9 68 rra8e y c 600 root wheel 9 69 rra8f y c 600 root wheel 9 70 rra8g y c 600 root wheel 9 71 rra8h y c 600 root wheel 9 72 rra9a y c 600 root wheel 9 73 rra9b y c 600 root wheel 9 74 rra9c y c 600 root wheel 9 75 rra9d y c 600 root wheel 9 76 rra9e y c 600 root wheel 9 77 rra9f y c 600 root wheel 9 78 rra9g y c 600 root wheel 9 79 rra9h y c 600 root wheel 9 80 rra10a y c 600 root wheel 9 81 rra10b y c 600 root wheel 9 82 rra10c y c 600 root wheel 9 83 rra10d y c 600 root wheel 9 84 rra10e y c 600 root wheel 9 85 rra10f y c 600 root wheel 9 86 rra10g y c 600 root wheel 9 87 rra10h y c 600 root wheel 9 88 rra11a y c 600 root wheel 9 89 rra11b y c 600 root wheel 9 90 rra11c y c 600 root wheel 9 91 rra11d y c 600 root wheel 9 92 rra11e y c 600 root wheel 9 93 rra11f y c 600 root wheel 9 94 rra11g y c 600 root wheel 9 95 rra11h y c 600 root wheel 9 96 rra12a y c 600 root wheel 9 97 rra12b y c 600 root wheel 9 98 rra12c y c 600 root wheel 9 99 rra12d y c 600 root wheel 9 100 rra12e y c 600 root wheel 9 101 rra12f y c 600 root wheel 9 102 rra12g y c 600 root wheel 9 103 rra12h y b 644 root wheel 16 8 cs1a y b 644 root wheel 16 10 cs1c y b 644 root wheel 16 16 cs2a y b 644 root wheel 16 18 cs2c y c 620 root wheel 20 0 ttyp0 n c 620 root wheel 20 1 ttyp1 n c 620 root wheel 20 2 ttyp2 n c 620 root wheel 20 3 ttyp3 n c 620 root wheel 20 4 ttyp4 n c 620 root wheel 20 5 ttyp5 n c 620 root wheel 20 6 ttyp6 n c 620 root wheel 20 7 ttyp7 n c 620 root wheel 20 8 ttyp8 n c 620 root wheel 20 9 ttyp9 n c 620 root wheel 20 10 ttypa n c 620 root wheel 20 11 ttypb n c 620 root wheel 20 12 ttypc n c 620 root wheel 20 13 ttypd n c 620 root wheel 20 14 ttype n c 620 root wheel 20 15 ttypf n c 620 root wheel 20 16 ttyq0 n c 620 root wheel 20 17 ttyq1 n c 620 root wheel 20 18 ttyq2 n c 620 root wheel 20 19 ttyq3 n c 620 root wheel 20 20 ttyq4 n c 620 root wheel 20 21 ttyq5 n c 620 root wheel 20 22 ttyq6 n c 620 root wheel 20 23 ttyq7 n c 620 root wheel 20 24 ttyq8 n c 620 root wheel 20 25 ttyq9 n c 620 root wheel 20 26 ttyqa n c 620 root wheel 20 27 ttyqb n c 620 root wheel 20 28 ttyqc n c 620 root wheel 20 29 ttyqd n c 620 root wheel 20 30 ttyqe n c 620 root wheel 20 31 ttyqf n c 620 root wheel 20 32 ttyr0 n c 620 root wheel 20 33 ttyr1 n c 620 root wheel 20 34 ttyr2 n c 620 root wheel 20 35 ttyr3 n c 620 root wheel 20 36 ttyr4 n c 620 root wheel 20 37 ttyr5 n c 620 root wheel 20 38 ttyr6 n c 620 root wheel 20 39 ttyr7 n c 620 root wheel 20 40 ttyr8 n c 620 root wheel 20 41 ttyr9 n c 620 root wheel 20 42 ttyra n c 620 root wheel 20 43 ttyrb n c 620 root wheel 20 44 ttyrc n c 620 root wheel 20 45 ttyrd n c 620 root wheel 20 46 ttyre n c 620 root wheel 20 47 ttyrf n c 620 root wheel 20 48 ttys0 n c 620 root wheel 20 49 ttys1 n c 620 root wheel 20 50 ttys2 n c 620 root wheel 20 51 ttys3 n c 620 root wheel 20 52 ttys4 n c 620 root wheel 20 53 ttys5 n c 620 root wheel 20 54 ttys6 n c 620 root wheel 20 55 ttys7 n c 620 root wheel 20 56 ttys8 n c 620 root wheel 20 57 ttys9 n c 620 root wheel 20 58 ttysa n c 620 root wheel 20 59 ttysb n c 620 root wheel 20 60 ttysc n c 620 root wheel 20 61 ttysd n c 620 root wheel 20 62 ttyse n c 620 root wheel 20 63 ttysf n c 666 root wheel 21 0 ptyp0 y c 666 root wheel 21 1 ptyp1 y c 666 root wheel 21 2 ptyp2 y c 666 root wheel 21 3 ptyp3 y c 666 root wheel 21 4 ptyp4 y c 666 root wheel 21 5 ptyp5 y c 666 root wheel 21 6 ptyp6 y c 666 root wheel 21 7 ptyp7 y c 666 root wheel 21 8 ptyp8 y c 666 root wheel 21 9 ptyp9 y c 666 root wheel 21 10 ptypa y c 666 root wheel 21 11 ptypb y c 666 root wheel 21 12 ptypc y c 666 root wheel 21 13 ptypd y c 666 root wheel 21 14 ptype y c 666 root wheel 21 15 ptypf y c 666 root wheel 21 16 ptyq0 y c 666 root wheel 21 17 ptyq1 y c 666 root wheel 21 18 ptyq2 y c 666 root wheel 21 19 ptyq3 y c 666 root wheel 21 20 ptyq4 y c 666 root wheel 21 21 ptyq5 y c 666 root wheel 21 22 ptyq6 y c 666 root wheel 21 23 ptyq7 y c 666 root wheel 21 24 ptyq8 y c 666 root wheel 21 25 ptyq9 y c 666 root wheel 21 26 ptyqa y c 666 root wheel 21 27 ptyqb y c 666 root wheel 21 28 ptyqc y c 666 root wheel 21 29 ptyqd y c 666 root wheel 21 30 ptyqe y c 666 root wheel 21 31 ptyqf y c 666 root wheel 21 32 ptyr0 y c 666 root wheel 21 33 ptyr1 y c 666 root wheel 21 34 ptyr2 y c 666 root wheel 21 35 ptyr3 y c 666 root wheel 21 36 ptyr4 y c 666 root wheel 21 37 ptyr5 y c 666 root wheel 21 38 ptyr6 y c 666 root wheel 21 39 ptyr7 y c 666 root wheel 21 40 ptyr8 y c 666 root wheel 21 41 ptyr9 y c 666 root wheel 21 42 ptyra y c 666 root wheel 21 43 ptyrb y c 666 root wheel 21 44 ptyrc y c 666 root wheel 21 45 ptyrd y c 666 root wheel 21 46 ptyre y c 666 root wheel 21 47 ptyrf y c 666 root wheel 21 48 ptys0 y c 666 root wheel 21 49 ptys1 y c 666 root wheel 21 50 ptys2 y c 666 root wheel 21 51 ptys3 y c 666 root wheel 21 52 ptys4 y c 666 root wheel 21 53 ptys5 y c 666 root wheel 21 54 ptys6 y c 666 root wheel 21 55 ptys7 y c 666 root wheel 21 56 ptys8 y c 666 root wheel 21 57 ptys9 y c 666 root wheel 21 58 ptysa y c 666 root wheel 21 59 ptysb y c 666 root wheel 21 60 ptysc y c 666 root wheel 21 61 ptysd y c 666 root wheel 21 62 ptyse y c 666 root wheel 21 63 ptysf y c 620 root wheel 34 0 tty00 n c 620 root wheel 34 1 tty01 n c 620 root wheel 34 2 gsicl n c 620 root wheel 34 2 tty02 n c 620 root wheel 34 3 uris n c 620 root wheel 34 3 tty03 n c 620 root wheel 34 4 cclw n c 620 root wheel 34 4 tty04 n c 620 root wheel 34 5 iab1 n c 620 root wheel 34 5 tty05 n c 620 root wheel 34 5 ttyJ9 n c 620 root wheel 34 6 tty06 n c 400 root wheel 34 7 pacxstats n c 400 root wheel 34 7 tty07 n c 620 root wheel 34 8 tty08 n c 620 root wheel 34 9 tty09 n c 620 root wheel 34 10 tty10 n c 620 root wheel 34 11 tty11 n c 620 root wheel 34 12 tty12 n c 620 root wheel 34 13 tty13 n c 620 root wheel 34 14 tty14 n c 620 root wheel 34 15 tty15 n c 620 root wheel 34 16 tty16 n c 620 root wheel 34 17 tty17 n c 620 root wheel 34 18 tty18 n c 620 root wheel 34 19 tty19 n c 620 root wheel 34 20 tty20 n c 620 root wheel 34 21 tty21 n c 620 root wheel 34 22 tty22 n c 620 root wheel 34 23 tty23 n c 620 root wheel 34 24 tty24 n c 620 root wheel 34 25 tty25 n c 620 root wheel 34 26 tty26 n c 620 root wheel 34 27 tty27 n c 620 root wheel 34 28 tty28 n c 620 root wheel 34 29 tty29 n c 620 root wheel 34 30 tty30 n c 620 root wheel 34 31 tty31 n c 620 root wheel 34 32 tty32 n c 620 root wheel 34 33 tty33 n c 620 root wheel 34 34 tty34 n c 620 root wheel 34 35 tty35 n c 620 root wheel 34 36 tty36 n c 620 root wheel 34 37 tty37 n c 620 root wheel 34 38 tty38 n c 620 root wheel 34 39 tty39 n c 620 root wheel 34 40 tty40 n c 620 root wheel 34 41 tty41 n c 620 root wheel 34 42 tty42 n c 620 root wheel 34 43 tty43 n c 620 root wheel 34 44 tty44 n c 620 root wheel 34 45 tty45 n c 620 root wheel 34 46 tty46 n c 620 root wheel 34 47 tty47 n c 620 root wheel 34 48 tty48 n c 620 root wheel 34 49 tty49 n c 620 root wheel 34 50 tty50 n c 620 root wheel 34 51 tty51 n c 620 root wheel 34 52 tty52 n c 620 root wheel 34 53 tty53 n c 620 root wheel 34 54 tty54 n c 620 root wheel 34 55 tty55 n c 620 root wheel 34 56 tty56 n c 620 root wheel 34 57 tty57 n c 620 root wheel 34 58 tty58 n c 620 root wheel 34 59 tty59 n c 620 root wheel 34 60 tty60 n c 620 root wheel 34 61 tty61 n c 620 root wheel 34 62 tty62 n c 620 root wheel 34 63 tty63 n c 620 root wheel 34 64 tty64 n c 620 root wheel 34 65 tty65 n c 620 root wheel 34 66 tty66 n c 620 root wheel 34 67 tty67 n c 620 root wheel 34 68 tty68 n c 620 root wheel 34 69 tty69 n c 620 root wheel 34 70 tty70 n c 620 root wheel 34 71 tty71 n c 620 root wheel 34 72 tty72 n c 620 root wheel 34 73 tty73 n c 620 root wheel 34 74 tty74 n c 620 root wheel 34 75 tty75 n c 620 root wheel 34 76 tty76 n c 620 root wheel 34 77 tty77 n c 620 root wheel 34 78 tty78 n c 620 root wheel 34 79 tty79 n c 620 root wheel 34 80 tty80 n c 620 root wheel 34 81 tty81 n c 620 root wheel 34 82 tty82 n c 620 root wheel 34 83 tty83 n c 620 root wheel 34 84 tty84 n c 620 root wheel 34 85 tty85 n c 620 root wheel 34 86 tty86 n c 620 root wheel 34 87 tty87 n c 620 root wheel 34 88 tty88 n c 620 root wheel 34 89 tty89 n c 620 root wheel 34 90 tty90 n c 620 root wheel 34 91 tty91 n c 620 root wheel 34 92 tty92 n c 620 root wheel 34 93 tty93 n c 620 root wheel 34 94 tty94 n c 620 root wheel 34 95 tty95 n c 620 root wheel 34 96 tty96 n c 620 root wheel 34 97 tty97 n c 620 root wheel 34 98 tty98 n c 620 root wheel 34 99 tty99 n c 620 root wheel 34 100 ttyA0 n c 620 root wheel 34 101 ttyA1 n c 620 root wheel 34 102 ttyA2 n c 620 root wheel 34 103 ttyA3 n c 620 root wheel 34 104 ttyA4 n c 620 root wheel 34 105 ttyA5 n c 620 root wheel 34 106 ttyA6 n c 620 root wheel 34 107 ttyA7 n c 620 root wheel 34 108 ttyA8 n c 620 root wheel 34 109 ttyA9 n c 620 root wheel 34 110 ttyB0 n c 620 root wheel 34 111 ttyB1 n c 620 root wheel 34 112 ttyB2 n c 620 root wheel 34 113 ttyB3 n c 620 root wheel 34 114 ttyB4 n c 620 root wheel 34 115 ttyB5 n c 620 root wheel 34 116 ttyB6 n c 620 root wheel 34 117 ttyB7 n c 620 root wheel 34 118 ttyB8 n c 620 root wheel 34 119 ttyB9 n c 620 root wheel 34 120 ttyC0 n c 620 root wheel 34 121 ttyC1 n c 620 root wheel 34 122 ttyC2 n c 620 root wheel 34 123 ttyC3 n c 620 root wheel 34 124 ttyC4 n c 620 root wheel 34 125 ttyC5 n c 620 root wheel 34 126 ttyC6 n c 620 root wheel 34 127 ttyC7 n c 620 root wheel 34 128 ttyC8 n c 620 root wheel 34 129 ttyC9 n c 620 root wheel 34 130 ttyD0 n c 620 root wheel 34 131 ttyD1 n c 620 root wheel 34 132 ttyD2 n c 620 root wheel 34 133 ttyD3 n c 620 root wheel 34 134 ttyD4 n c 620 root wheel 34 135 ttyD5 n c 620 root wheel 34 136 ttyD6 n c 620 root wheel 34 137 ttyD7 n c 620 root wheel 34 138 ttyD8 n c 620 root wheel 34 139 ttyD9 n c 620 root wheel 34 140 ttyE0 n c 620 root wheel 34 141 ttyE1 n c 620 root wheel 34 142 ttyE2 n c 620 root wheel 34 143 ttyE3 n c 666 root wheel 36 0 rmt0l y c 666 root wheel 36 1 rmt1l y c 666 root wheel 36 4 nrmt0l y c 666 root wheel 36 5 nrmt1l y c 666 root wheel 36 8 rmt0h y c 666 root wheel 36 9 rmt1h y c 666 root wheel 36 12 nrmt0h y c 666 root wheel 36 13 nrmt1h y c 620 root wheel 39 0 ttyE4 n c 620 root wheel 39 1 ttyE5 n c 620 root wheel 39 2 ttyE6 n c 620 root wheel 39 3 ttyE7 n c 620 root wheel 39 4 ttyE8 n c 620 root wheel 39 5 ttyE9 n c 620 root wheel 39 6 ttyF0 n c 620 root wheel 39 7 ttyF1 n c 620 root wheel 39 8 ttyF2 n c 620 root wheel 39 9 ttyF3 n c 620 root wheel 39 10 ttyF4 n c 620 root wheel 39 11 ttyF5 n c 620 root wheel 39 12 ttyF6 n c 620 root wheel 39 13 ttyF7 n c 620 root wheel 39 14 ttyF8 n c 620 root wheel 39 15 ttyF9 n c 620 root wheel 39 16 ttyG0 n c 620 root wheel 39 17 ttyG1 n c 620 root wheel 39 18 ttyG2 n c 620 root wheel 39 19 ttyG3 n c 620 root wheel 39 20 ttyG4 n c 620 root wheel 39 21 ttyG5 n c 620 root wheel 39 22 ttyG6 n c 620 root wheel 39 23 ttyG7 n c 620 root wheel 39 24 ttyG8 n c 620 root wheel 39 25 ttyG9 n c 620 root wheel 39 26 ttyH0 n c 620 root wheel 39 27 ttyH1 n c 620 root wheel 39 28 ttyH2 n c 620 root wheel 39 29 ttyH3 n c 620 root wheel 39 30 ttyH4 n c 620 root wheel 39 31 ttyH5 n c 620 root wheel 39 32 ttyH6 n c 620 root wheel 39 33 ttyH7 n c 620 root wheel 39 34 ttyH8 n c 620 root wheel 39 35 ttyH9 n c 620 root wheel 39 36 ttyI0 n c 620 root wheel 39 37 ttyI1 n c 620 root wheel 39 38 ttyI2 n c 620 root wheel 39 39 ttyI3 n c 620 root wheel 39 40 ttyI4 n c 620 root wheel 39 41 ttyI5 n c 620 root wheel 39 42 ttyI6 n c 620 root wheel 39 43 ttyI7 n c 620 root wheel 39 44 ttyI8 n c 620 root wheel 39 45 ttyI9 n c 620 root wheel 39 46 ttyJ0 n c 620 root wheel 39 47 ttyJ1 n c 600 root wheel 41 8 bootdev y c 600 root wheel 41 8 rcs1a y c 600 root wheel 41 10 rcs1c y c 600 root wheel 41 16 rcs2a y c 600 root wheel 41 18 rcs2c y c 600 root wheel 43 0 errlog y c 444 root wheel 48 0 trace y c 600 ingres wheel 53 0 iidr/000 y c 600 ingres wheel 53 1 iidr/001 y c 600 ingres wheel 53 2 iidr/002 y c 600 ingres wheel 53 3 iidr/003 y c 600 ingres wheel 53 4 iidr/004 y c 600 ingres wheel 53 5 iidr/005 y c 600 ingres wheel 53 6 iidr/006 y c 600 ingres wheel 53 7 iidr/007 y c 600 ingres wheel 53 8 iidr/008 y c 600 ingres wheel 53 9 iidr/009 y c 600 ingres wheel 53 10 iidr/010 y c 600 ingres wheel 53 11 iidr/011 y c 600 ingres wheel 53 12 iidr/012 y c 600 ingres wheel 53 13 iidr/013 y c 600 ingres wheel 53 14 iidr/014 y c 600 ingres wheel 53 15 iidr/015 y c 600 ingres wheel 53 16 iidr/016 y c 600 ingres wheel 53 17 iidr/017 y c 600 ingres wheel 53 18 iidr/018 y c 600 ingres wheel 53 19 iidr/019 y c 600 ingres wheel 53 20 iidr/020 y c 600 ingres wheel 53 21 iidr/021 y c 600 ingres wheel 53 22 iidr/022 y c 600 ingres wheel 53 23 iidr/023 y c 600 ingres wheel 53 24 iidr/024 y c 600 ingres wheel 53 25 iidr/025 y SHAR_EOF fi if test -f './DEVICES.README' then echo shar: "will not over-write existing file './DEVICES.README'" else cat << \SHAR_EOF > './DEVICES.README' The DEVICES file has the form: c/b mode owner group major minor name y/n c/b: type of special file. mode: the mode of the device (or'ed with 07777). owner: user who should own the device. group: group which should own the device. major: major device number. minor: minor device number. name: device name. y/n: critical nature of errors. if 'y', than fix any errors, otherwise, only fix critical errors (leave mode, owner, group alone). SHAR_EOF fi if test -f './Makefile' then echo shar: "will not over-write existing file './Makefile'" else cat << \SHAR_EOF > './Makefile' all: checkdev showdev checkdev: checkdev.o cc -o checkdev checkdev.o showdev: showdev.o cc -o showdev showdev.o install: checkdev showdev cp checkdev showdev /etc cp DEVICES OURDEVS /dev @echo You may want to run OURDEVS from crontab. Fix the mail @echo addresses in it though. SHAR_EOF fi if test -f './OURDEVS' then echo shar: "will not over-write existing file './OURDEVS'" else cat << \SHAR_EOF > './OURDEVS' #!/bin/sh renice -15 $$ umask 077 /etc/checkdev -d /dev -f /dev/DEVICES > /tmp/baddevs [ -s /tmp/baddevs ] && { /usr/ucb/mail -s 'Checkdev notice' howie fuat < /tmp/baddevs } rm /tmp/baddevs SHAR_EOF fi if test -f './checkdev.8' then echo shar: "will not over-write existing file './checkdev.8'" else cat << \SHAR_EOF > './checkdev.8' .TH checkdev 8 .UC 4 .SH NAME checkdev \- check consistency of system special files .SH SYNTAX .B checkdev [-iq -f devfile -d devdir] .SH DESCRIPTION Verifies the devices in the .i devdir directory which are specified in the .i devfile file for consistency. Checks the mode, owner, group, major/minor device numbers, and block/character "specialness" of the files. Creates missing files, and "fixes" files which are incorrect. .SH OPTIONS .TP .B -i Run in interactive mode. This turns off quiet mode. .TP .B -q Run quietly. Don't generate information about actions. .TP .B -f filename read filename for the list of known devices. .TP .B -d directory create/check the devices in the specified directory. .SH FILES Reads in a file for the listing of known devices. This file is of the format: .sp special mode owner group major minor name critical .sp c/b 777 root wheel 3 2 null y .TP .I special character/block (c/b) type of special file. .TP .I mode mode of the device (or'ed with 07777). .TP .I owner user who should own the device. .TP .I group group which should own the device. .TP .I major major device number. .TP .I minor minor device number. .TP .I name device name. .TP .I critical critical nature of errors. if 'y', than fix any errors, otherwise, only fix critical errors (leave mode, owner, group alone). .SH SEE ALSO mknod(1), stat(2), showdev(8). SHAR_EOF fi if test -f './checkdev.c' then echo shar: "will not over-write existing file './checkdev.c'" else cat << \SHAR_EOF > './checkdev.c' #include <sys/types.h> #include <sys/dir.h> /* for MAXNAMLEN */ #include <sys/stat.h> #include <pwd.h> #include <grp.h> #include <stdio.h> #define FALSE 0 #define TRUE (!FALSE) #define BLOCKDEV ((int) 'b') #define CHARDEV ((int) 'c') #define CRITICAL ((int) 'y') #define UNCRIT ((int) 'n') #define cprintf(x) if (!quiet) {printf("checkdev: "); printf x;} char *itoa(); struct user { char pw_name[9]; int pw_uid; }; struct grp { char gr_name[9]; int gr_gid; }; struct user *get_user_uid(), *get_user_name(); struct grp *get_grp_gid(), *get_grp_name(); struct dev { int special; /* c or b */ int mode; /* octal */ char user[9]; char group[9]; int majno; /* major dev number */ int minno; /* minor dev number */ char name[MAXNAMLEN]; /* device name in /dev */ int critical; /* specify if mode, user and group */ }; /* must be set if others are correct */ static char *dir = "/dev"; static char *devfile = "/dev/DEVICES"; main(argc,argv) int argc; char **argv; { struct dev adev; FILE *df; struct stat sbuf; char c; int interactive = FALSE; int quiet = FALSE; extern char *optarg; while ((c = getopt (argc, argv, "id:f:hq")) != EOF) { switch (c) { case 'i': interactive = TRUE; quiet = FALSE; break; case 'f': devfile = optarg; break; case 'd': dir = optarg; break; case 'q': quiet = !interactive; break; case 'h': default: printf("usage:\tcheckdev [-iq -f devfile -d directory]\n\ \t-i: interactive mode\n\ \t-q: quiet mode\n\ \t-f devfile: read devices from devfile instead of /dev/DEVICES\n\ \t-d directory: create devices in directory instead of /dev\n"); if (c != 'h') exit(1); } } if ((df = fopen(devfile,"r")) == NULL) { fprintf(stderr,"fopen "); perror(devfile); exit(1); } if (chdir(dir) != 0) { fprintf(stderr,"chdir "); perror("dir"); exit(1); } umask(0); cache_passwd(); /* cache the passwd file. */ cache_group(); /* and the group file */ /* for speed */ while (1) { char buf[1000]; int n; if (fgets(buf,999,df) == NULL) break; n = sscanf(buf, "%c %o %s %s %d %d %s %c\n", &adev.special, &adev.mode, adev.user, adev.group, &adev.majno, &adev.minno, adev.name, &adev.critical); if (n != 8) { /* 8 items per record */ fprintf(stderr,"%s: invalid record: '%s'\n", devfile,buf); } #ifdef DEBUG printf("%c %o %s %s %d %d %s %c\n", adev.special, adev.mode, adev.user, adev.group, adev.majno, adev.minno, adev.name, adev.critical); #endif if (stat(adev.name,&sbuf) != 0) { /* does file exist? */ create_dev(&adev,interactive, quiet); /* nope....create to spec. */ } else { /* exists...verify */ verify_dev(&adev,&sbuf,interactive,quiet); } } fclose(df); } create_dev(dev,interactive,quiet) struct dev *dev; int interactive, quiet; { struct user *owner; struct grp *grp; int special = (dev->special == BLOCKDEV) ? 0060000 : 0020000; if (interactive) if (!y_or_n("Create", dev->name)) return; cprintf(("creating %s/%s\n", dir, dev->name)); if (mknod(dev->name, special|dev->mode, makedev(dev->majno, dev->minno))) { fprintf(stderr,"mknod "); perror(dev->name); } else { owner = get_user_name(dev->user); grp = get_grp_name(dev->group); if (owner) chown(dev->name, owner->pw_uid,-1); else cprintf(("no such user %s\n", dev->user)); if (grp) chown(dev->name, -1, grp->gr_gid); else cprintf(("no such group %s\n", dev->group)); } } verify_dev(dev, sbuf, interactive, quiet) struct dev *dev; struct stat *sbuf; { struct user *owner; struct grp *grp; int special = (dev->special == BLOCKDEV) ? 0060000 : 0020000; int critical = (dev->critical == CRITICAL); int type; int error = FALSE; owner = get_user_name(dev->user); grp = get_grp_name(dev->group); /* check critical data */ type = sbuf->st_mode & S_IFMT; if (dev->special == BLOCKDEV && type != S_IFBLK) { cprintf(("%s should be a block device and is a char device\n", dev->name)); error = TRUE; } if (dev->special == CHARDEV && type != S_IFCHR) { cprintf(("%s should be a char device and is a block device\n" ,dev->name)); error = TRUE; } if (dev->majno != major(sbuf->st_rdev)) { cprintf(("%s major device %d, should be major device %d\n", dev->name, major(sbuf->st_rdev), dev->majno)); error = TRUE; } if (dev->minno != minor(sbuf->st_rdev)) { cprintf(("%s minor device %d, should be minor device %d\n", dev->name, minor(sbuf->st_rdev), dev->minno)); error = TRUE; } /* check non critical things */ if (critical) { if (owner == NULL) { cprintf((": %s, no such user %s\n", dev->name,dev->user)); } else { if (owner->pw_uid != sbuf->st_uid) { struct user *user = get_user_uid(sbuf->st_uid); char *who = user ? user->pw_name : itoa(sbuf->st_uid); cprintf(("%s, owned by user %s instead of %s\n", dev->name,who,dev->user)); error = TRUE; } } if (grp == NULL) { cprintf(("%s, no such group %s\n", dev->name,dev->group)); } else { if (grp->gr_gid != sbuf->st_gid) { struct grp *gp = get_grp_gid(sbuf->st_gid); char *who = gp ? gp->gr_name : itoa(sbuf->st_gid); cprintf(("%s, owned by group %s instead of %s\n", dev->name,who,dev->group)); error = TRUE; } } if ((dev->mode & 07777) != (sbuf->st_mode & 07777)) { cprintf(("%s incorrect mode %o, should be %o\n",dev->name, sbuf->st_mode &07777,dev->mode&07777)); error = TRUE; } } if (error) { /* error */ if (interactive) if (!y_or_n("Remove",dev->name)) return; if (unlink(dev->name)) { /* remove the old one */ fprintf(stderr,"unlink "); perror(dev->name); } else { /* and recreate it. */ create_dev(dev,FALSE,quiet); } } } char *itoa(num) int num; { static char buf[100]; sprintf(buf,"%d",num); return(buf); } static struct user *users = NULL; static int nusers = 0; cache_passwd() { static int len=0; struct passwd *p; while(p = getpwent()) { if (nusers == len) { if (users) users = (struct user *)realloc(users, (len+=100)*sizeof(struct user)); else users = (struct user *)malloc((len+=100)*sizeof(struct user)); } strncpy(users[nusers].pw_name, p->pw_name,8); users[nusers].pw_name[8] = '\0'; users[nusers].pw_uid = p->pw_uid; nusers++; } } struct user* get_user_uid(uid) { int i = 0; for(i = 0; i < nusers; i++) if (users[i].pw_uid == uid) return(&users[i]); return(NULL); } struct user * get_user_name(name) char *name; { int i = 0; for(i = 0; i < nusers; i++) if ((strcmp(users[i].pw_name ,name) == 0)) return(&users[i]); return(NULL); } static struct grp *grps = NULL; static int ngrps=0; cache_group() { static int len=0; struct group *g; while(g = getgrent()) { if (ngrps == len) { if (grps) grps = (struct grp *)realloc(grps, (len+=100)*sizeof(struct grp)); else grps = (struct grp *)malloc((len+=100)*sizeof(struct grp)); } strncpy(grps[ngrps].gr_name, g->gr_name,8); grps[ngrps].gr_name[8] = '\0'; grps[ngrps].gr_gid = g->gr_gid; ngrps++; } } struct grp* get_grp_gid(gid) { int i = 0; for(i = 0; i < ngrps; i++) if (grps[i].gr_gid == gid) return(&grps[i]); return(NULL); } struct grp * get_grp_name(name) char *name; { int i = 0; for(i = 0; i < ngrps; i++) if ((strcmp(grps[i].gr_name ,name) == 0)) return(&grps[i]); return(NULL); } y_or_n(prompt,name) char *prompt; { int c,x; printf("%s %s [n]? ",prompt,name); c = getchar(); if (c == '\n') c = 'n'; if (c == EOF) exit(1); else while ((x = getchar()) != '\n') if (x == EOF) exit(1); if ((c == 'Y') || (c == 'y')) return(TRUE); if ((c == 'N') || (c == 'n')) return(FALSE); printf("Please answer 'y' or 'n'\n"); } SHAR_EOF fi if test -f './dev' then echo shar: "will not over-write existing file './dev'" else cat << \SHAR_EOF > './dev' #!/bin/sh cd /dev x=`/etc/showdev $1 $2` [ "$x" != "" ] && { ls -l $x } SHAR_EOF chmod +x './dev' fi if test -f './showdev.8' then echo shar: "will not over-write existing file './showdev.8'" else cat << \SHAR_EOF > './showdev.8' .TH showdev 8 .UC 4 .SH NAME showdev \- display system special files .SH SYNTAX .B showdev .IR [major [minor]] .SH DESCRIPTION Shows devices in the /dev directory which have major device number .I major and minor device number .I minor. If no minor number is specified, then all devices with major device number .I major are shown. If no major device number is specified, then all devices are displayed. Only character and block special devices are displayed. Regular files, directories, FIFO's are not displayed. Symbolic links are not followed. .SH "See Also" mknod(1), stat(2). SHAR_EOF fi if test -f './showdev.c' then echo shar: "will not over-write existing file './showdev.c'" else cat << \SHAR_EOF > './showdev.c' #include <sys/types.h> #include <sys/stat.h> #include <dir.h> #include <stdio.h> #define FALSE 0 #define TRUE (!FALSE) main(argc, argv) int argc; char **argv; { int usemajor = argc > 1; int useminor = argc > 2; int maj,min; DIR *devdir; struct direct *dp; struct stat sbuf; char fname[MAXNAMLEN+1]; int useit; if (usemajor) /* set up major and minor numbers */ maj = atoi(argv[1]); if (useminor) min = atoi(argv[2]); if (chdir("/dev") != 0) { /* cd to /dev so we dont have to */ perror("chdir"); /* worry about appending /dev to */ exit(1); /* filenames */ } if (devdir = opendir(".")) { /* open up /dev */ while (dp = readdir(devdir)) { /* start reading entries */ useit = TRUE; /* assume this file matches */ strncpy(fname,dp->d_name,dp->d_namlen); /* get this entries name */ fname[dp->d_namlen] = '\0'; if (lstat(fname,&sbuf) == 0) { /* stat it */ if (((sbuf.st_mode & S_IFMT) == S_IFCHR) || /* a special */ ((sbuf.st_mode & S_IFMT) == S_IFBLK)) { /* file? */ if (usemajor && (major(sbuf.st_rdev) != maj)) useit = FALSE; else if (useminor && (minor(sbuf.st_rdev) != min)) useit = FALSE; if (useit) printf("%s\n",fname); } } } closedir(devdir); } } SHAR_EOF fi exit 0 # End of shell archive