Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

571 lines
11 KiB

22 years ago
4 years ago
4 years ago
7 years ago
14 years ago
22 years ago
20 years ago
21 years ago
21 years ago
26 years ago
20 years ago
20 years ago
20 years ago
20 years ago
6 years ago
20 years ago
20 years ago
20 years ago
14 years ago
22 years ago
20 years ago
22 years ago
20 years ago
14 years ago
20 years ago
4 years ago
20 years ago
20 years ago
17 years ago
18 years ago
14 years ago
4 years ago
18 years ago
11 years ago
20 years ago
17 years ago
20 years ago
13 years ago
18 years ago
20 years ago
14 years ago
20 years ago
18 years ago
20 years ago
15 years ago
15 years ago
7 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
19 years ago
21 years ago
21 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
19 years ago
19 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
19 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
19 years ago
22 years ago
11 years ago
22 years ago
19 years ago
11 years ago
19 years ago
11 years ago
19 years ago
11 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
10 years ago
22 years ago
22 years ago
22 years ago
22 years ago
6 years ago
22 years ago
7 years ago
27 years ago
7 years ago
15 years ago
16 years ago
7 years ago
16 years ago
20 years ago
22 years ago
18 years ago
20 years ago
22 years ago
20 years ago
22 years ago
14 years ago
4 years ago
14 years ago
22 years ago
6 years ago
18 years ago
7 years ago
18 years ago
13 years ago
20 years ago
17 years ago
17 years ago
20 years ago
11 years ago
20 years ago
19 years ago
20 years ago
19 years ago
20 years ago
4 years ago
14 years ago
18 years ago
17 years ago
20 years ago
4 years ago
20 years ago
4 years ago
22 years ago
20 years ago
4 years ago
20 years ago
4 years ago
20 years ago
4 years ago
22 years ago
22 years ago
19 years ago
22 years ago
4 years ago
22 years ago
14 years ago
10 years ago
4 years ago
14 years ago
20 years ago
7 years ago
22 years ago
14 years ago
20 years ago
17 years ago
20 years ago
14 years ago
20 years ago
14 years ago
5 years ago
14 years ago
20 years ago
20 years ago
19 years ago
20 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
20 years ago
21 years ago
21 years ago
7 years ago
20 years ago
20 years ago
20 years ago
20 years ago
22 years ago
22 years ago
22 years ago
17 years ago
22 years ago
17 years ago
28 years ago
22 years ago
22 years ago
7 years ago
6 years ago
4 years ago
12 years ago
12 years ago
22 years ago
22 years ago
22 years ago
22 years ago
19 years ago
7 years ago
22 years ago
19 years ago
22 years ago
  1. #!/bin/sh -
  2. #
  3. # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
  4. # generated from:
  5. #
  6. # OpenBSD: etc.alpha/MAKEDEV.md,v 1.74 2020/01/24 14:11:01 mpi Exp
  7. # OpenBSD: MAKEDEV.common,v 1.110 2020/04/18 21:28:35 ratchov Exp
  8. # OpenBSD: MAKEDEV.mi,v 1.83 2016/09/11 03:06:31 deraadt Exp
  9. # OpenBSD: MAKEDEV.sub,v 1.14 2005/02/07 06:14:18 david Exp
  10. #
  11. #
  12. # Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
  13. #
  14. # Permission to use, copy, modify, and distribute this software for any
  15. # purpose with or without fee is hereby granted, provided that the above
  16. # copyright notice and this permission notice appear in all copies.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  19. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  20. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  21. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  22. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  23. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  24. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  25. #
  26. # Device "make" file. Valid arguments:
  27. # all makes all known devices, including local devices.
  28. # Tries to make the ``standard'' number of each type.
  29. # ramdisk Ramdisk kernel devices
  30. # std Standard devices
  31. # local Configuration specific devices
  32. # Disks:
  33. # cd* ATAPI and SCSI CD-ROM drives
  34. # fd* Floppy disk drives (3 1/2", 5 1/4")
  35. # rd* "rd" pseudo-disks
  36. # sd* SCSI disks, including flopticals
  37. # vnd* "file" pseudo-disk devices
  38. # wd* "winchester" disk drives (ST506, IDE, ESDI, RLL, ...)
  39. # Tapes:
  40. # ch* SCSI media changers
  41. # st* SCSI tape drives
  42. # Terminal ports:
  43. # tty[0-7][0-9a-f] NS16x50 serial ports
  44. # ttyc* Cyclades serial ports
  45. # ttyB* DEC 3000 serial ports
  46. # Pseudo terminals:
  47. # ptm pty master device
  48. # pty* Set of 62 master pseudo terminals
  49. # tty* Set of 62 slave pseudo terminals
  50. # Console ports:
  51. # ttyC-J* wscons display devices
  52. # wscons Minimal wscons devices
  53. # wskbd* wscons keyboards
  54. # wsmux wscons keyboard/mouse mux devices
  55. # Pointing devices:
  56. # wsmouse* wscons mice
  57. # Printers:
  58. # lpa* Polled printer port
  59. # lpt* IEEE 1284 centronics printer
  60. # USB devices:
  61. # ttyU* USB serial ports
  62. # uall All USB devices
  63. # ugen* Generic USB devices
  64. # uhid* Generic HID devices
  65. # fido fido/* nodes
  66. # ulpt* Printer devices
  67. # usb* Bus control devices used by usbd for attach/detach
  68. # Special purpose devices:
  69. # audio* Audio devices
  70. # bio ioctl tunnel pseudo-device
  71. # bktr* Video frame grabbers
  72. # bpf Berkeley Packet Filter
  73. # diskmap Disk mapper
  74. # dt Dynamic Tracer
  75. # fd fd/* nodes
  76. # fuse Userland Filesystem
  77. # hotplug devices hot plugging
  78. # pci* PCI bus devices
  79. # pf* Packet Filter
  80. # pppx* PPP Multiplexer
  81. # pppac* PPP Access Concentrator
  82. # radio* FM tuner devices
  83. # *random In-kernel random data source
  84. # rmidi* Raw MIDI devices
  85. # speaker PC speaker
  86. # tun* Network tunnel driver
  87. # tap* Ethernet tunnel driver
  88. # tuner* Tuner devices
  89. # uk* Unknown SCSI devices
  90. # video* Video V4L2 devices
  91. # vscsi* Virtual SCSI controller
  92. # switch* Switch driver
  93. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  94. T=$0
  95. # set this to echo for Echo-Only debugging
  96. [ "$eo" ] || eo=
  97. hex()
  98. {
  99. case $1 in
  100. [0-9]) echo -n $1;;
  101. 10) echo -n a;;
  102. 11) echo -n b;;
  103. 12) echo -n c;;
  104. 13) echo -n d;;
  105. 14) echo -n e;;
  106. 15) echo -n f;;
  107. esac
  108. }
  109. alph2d()
  110. {
  111. local t="$1"
  112. local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  113. local sub=${p%${t}*}
  114. echo ${#sub}
  115. }
  116. h2d()
  117. {
  118. local s="$1"
  119. local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
  120. echo $(($(_h2d $f)*16+ $(_h2d $n) ))
  121. }
  122. _h2d()
  123. {
  124. case $1 in
  125. [0-9]) echo -n $1;;
  126. a) echo -n 10;;
  127. b) echo -n 11;;
  128. c) echo -n 12;;
  129. d) echo -n 13;;
  130. e) echo -n 14;;
  131. f) echo -n 15;;
  132. esac
  133. }
  134. unt()
  135. {
  136. # XXX pdksh can't seem to deal with locally scoped variables
  137. # in ${foo#$bar} expansions
  138. arg="$1"
  139. tmp="${arg#[a-zA-Z]*}"
  140. tmp="${tmp%*[a-zA-Z]}"
  141. while [ "$tmp" != "$arg" ]
  142. do
  143. arg=$tmp
  144. tmp="${arg#[a-zA-Z]*}"
  145. tmp="${tmp%*[a-zA-Z]}"
  146. done
  147. echo $arg
  148. }
  149. dodisk()
  150. {
  151. [ "$DEBUG" ] && set -x
  152. n=$(($((${5}*${7:-16}))+${6})) count=0
  153. [ 0$7 -ne 8 ] && l="i j k l m n o p"
  154. for d in a b c d e f g h $l
  155. do
  156. M $1$2$d b $3 $(($n+$count)) 640 operator
  157. M r$1$2$d c $4 $(($n+$count)) 640 operator
  158. let count=count+1
  159. done
  160. }
  161. dodisk2()
  162. {
  163. n=$(($(($5*${7:-16}))+$6))
  164. M $1$2a b $3 $n 640 operator
  165. M r$1$2a c $4 $n 640 operator
  166. n=$(($n+2))
  167. M $1$2c b $3 $n 640 operator
  168. M r$1$2c c $4 $n 640 operator
  169. }
  170. # M name b/c major minor [mode] [group]
  171. RMlist[0]="rm -f"
  172. mkl() {
  173. : ${mklist[0]:=";mknod"}
  174. mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5"
  175. }
  176. M() {
  177. RMlist[${#RMlist[*]}]=$1
  178. mkl ${5-666} $1 $2 $3 $4
  179. G=${6:-wheel}
  180. [ "$7" ] && {
  181. MKlist[${#MKlist[*]}]="&& chown $7:$G $1"
  182. } || {
  183. case $G in
  184. wheel)
  185. [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel"
  186. whlist[${#whlist[*]}]="$1"
  187. ;;
  188. operator)
  189. [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator"
  190. oplist[${#oplist[*]}]="$1"
  191. ;;
  192. *)
  193. MKlist[${#MKlist[*]}]="&& chgrp $G $1";
  194. esac
  195. }
  196. return 0
  197. }
  198. R() {
  199. [ "$DEBUG" ] && set -x
  200. for i in "$@"
  201. do
  202. U=`unt $i`
  203. [ "$U" ] || U=0
  204. case $i in
  205. ramdisk)
  206. R std fd0 wd0 wd1 wd2 sd0 sd1 sd2 bpf
  207. R st0 cd0 ttyC0 rd0 bio diskmap random
  208. ;;
  209. std)
  210. M console c 0 0 600
  211. M tty c 1 0
  212. M mem c 2 0 640 kmem
  213. M kmem c 2 1 640 kmem
  214. M null c 2 2
  215. M zero c 2 12
  216. M stdin c 10 0
  217. M stdout c 10 1
  218. M stderr c 10 2
  219. M ksyms c 39 0 640 kmem
  220. M klog c 6 0 600
  221. M xf86 c 2 4 600
  222. ;;
  223. ttyB*|ttyc*)
  224. U=${i##tty?}
  225. case $i in
  226. ttyB*) type=B major=15 minor=$U;;
  227. ttyc*) type=c major=38 minor=$U;;
  228. esac
  229. M tty$type$U c $major $minor 660 dialer root
  230. M cua$type$U c $major $(($minor+128)) 660 dialer root
  231. ;;
  232. switch*)
  233. M switch$U c 69 $U 600
  234. ;;
  235. vscsi*)
  236. M vscsi$U c 61 $U 600
  237. ;;
  238. video*)
  239. M video$U c 44 $U 600
  240. MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video"
  241. ;;
  242. uk*)
  243. M uk$U c 33 $U 640 operator
  244. ;;
  245. tuner*)
  246. M tuner$U c 58 $(($(($U*2))+16)) 644
  247. ;;
  248. tap*)
  249. M tap$U c 68 $U 600
  250. ;;
  251. tun*)
  252. M tun$U c 7 $U 600
  253. ;;
  254. speaker)
  255. M speaker c 40 0 600
  256. ;;
  257. rmidi*)
  258. M rmidi$U c 41 $U 660 _sndiop
  259. ;;
  260. *random)
  261. M urandom c 34 0 644
  262. RMlist[${#RMlist[*]}]=random
  263. MKlist[${#MKlist[*]}]=";ln -s urandom random"
  264. ;;
  265. radio*)
  266. M radio$U c 59 $U
  267. MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio"
  268. ;;
  269. pppac*)
  270. M pppac$U c 71 $U 600
  271. ;;
  272. pppx*)
  273. M pppx$U c 64 $U 600
  274. ;;
  275. pf*)
  276. M pf c 35 0 600
  277. ;;
  278. pci*)
  279. M pci$U c 52 $U 600
  280. MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci"
  281. ;;
  282. hotplug)
  283. M hotplug c 56 $U 400
  284. ;;
  285. fuse)
  286. M fuse$U c 67 $U 600
  287. ;;
  288. fd)
  289. RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0
  290. while [ $n -lt 64 ];do M fd/$n c 10 $n;n=$(($n+1));done
  291. MKlist[${#MKlist[*]}]=";chmod 555 fd"
  292. ;;
  293. dt)
  294. M dt c 32 0 600
  295. ;;
  296. diskmap)
  297. M diskmap c 63 0 640 operator
  298. ;;
  299. bpf)
  300. M bpf c 11 0 600
  301. M bpf0 c 11 0 600
  302. ;;
  303. bktr*)
  304. M bktr$U c 58 $U 644
  305. ;;
  306. bio)
  307. M bio c 53 0 600
  308. ;;
  309. audio*)
  310. M audio$U c 24 $U 660 _sndiop
  311. M audioctl$U c 24 $(($U+192)) 660 _sndiop
  312. ;;
  313. usb*)
  314. [ "$i" = "usb" ] && u= || u=$U
  315. M usb$u c 45 $U 640
  316. ;;
  317. ulpt*)
  318. M ulpt$U c 47 $U 600
  319. ;;
  320. fido)
  321. RMlist[${#RMlist[*]}]=";mkdir -p fido;rm -f" n=0
  322. while [ $n -lt 4 ];do M fido/$n c 70 $n 666;n=$(($n+1));done
  323. MKlist[${#MKlist[*]}]=";chmod 555 fido"
  324. ;;
  325. uhid*)
  326. M uhid$U c 46 $U 600
  327. ;;
  328. ugen*)
  329. n=$(($U*16))
  330. for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5}
  331. do
  332. M ugen$U.$j c 48 $(($n+10#$j)) 600
  333. done
  334. ;;
  335. uall)
  336. R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ugen2 ugen3 ugen4 ugen5
  337. R ugen6 ugen7 ulpt0 ulpt1 fido uhid0 uhid1 uhid2 uhid3 uhid4
  338. R uhid5 uhid6 uhid7 usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
  339. ;;
  340. ttyU[0-9a-zA-Z])
  341. U=${i#ttyU*}
  342. o=$(alph2d $U)
  343. M ttyU$U c 49 $o 660 dialer root
  344. M cuaU$U c 49 $(($o+128)) 660 dialer root
  345. ;;
  346. lpt*|lpa*)
  347. case $i in
  348. lpt*) n=lpt f=0;;
  349. lpa*) n=lpa f=128;;
  350. esac
  351. M $n$U c 31 $(($U+$f)) 600
  352. ;;
  353. wsmouse[0-9]*)
  354. M wsmouse$U c 30 $U 600
  355. ;;
  356. wsmux|wsmouse|wskbd)
  357. M wsmouse c 60 0 600
  358. M wskbd c 60 1 600
  359. ;;
  360. wskbd[0-9]*)
  361. M wskbd$U c 29 $U 600
  362. ;;
  363. wscons)
  364. R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5
  365. R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2
  366. R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5
  367. R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb
  368. ;;
  369. tty[C-J]*)
  370. U=${i##tty[C-J]}
  371. case $i in
  372. ttyC*) n=C m=0;;
  373. ttyD*) n=D m=256;;
  374. ttyE*) n=E m=512;;
  375. ttyF*) n=F m=768;;
  376. ttyG*) n=G m=1024;;
  377. ttyH*) n=H m=1280;;
  378. ttyI*) n=I m=1536;;
  379. ttyJ*) n=J m=1792;;
  380. esac
  381. case $U in
  382. [0-9a-f]) M tty$n$U c 25 $((16#$U+$m)) 600;;
  383. cfg) M tty${n}cfg c 25 $((255+$m)) 600;;
  384. *) echo bad unit $U for $i; exit 1;;
  385. esac
  386. ;;
  387. pty*)
  388. if [ $U -gt 15 ]; then
  389. echo bad unit for pty in: $i
  390. continue
  391. fi
  392. set -A letters p q r s t u v w x y z P Q R S T
  393. set -A suffixes 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q \
  394. r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X \
  395. Y Z
  396. name=${letters[$U]}
  397. n=0
  398. while [ $n -lt 62 ]
  399. do
  400. nam=$name${suffixes[$n]}
  401. off=$(($U*62))
  402. M tty$nam c 4 $(($off+$n))
  403. M pty$nam c 5 $(($off+$n))
  404. n=$(($n+1))
  405. done
  406. ;;
  407. ptm)
  408. M ptm c 55 0 666
  409. ;;
  410. tty[0-7][0-9a-f])
  411. U=${i#tty*}
  412. o=$(h2d $U)
  413. M tty$U c 26 $o 660 dialer root
  414. M cua$U c 26 $(($o+128)) 660 dialer root
  415. ;;
  416. st*)
  417. n=$(($U*16))
  418. for pre in " " n e en
  419. do
  420. M ${pre}rst$U c 12 $n 660 operator
  421. n=$(($n+1))
  422. done
  423. ;;
  424. ch*)
  425. M ch$U c 14 $U 660 operator
  426. ;;
  427. vnd*)
  428. dodisk vnd $U 9 9 $U 0
  429. ;;
  430. rd*)
  431. dodisk2 rd $U 6 28 $U 0
  432. ;;
  433. fd*)
  434. typnam=$U${i#fd[01]*}
  435. case $typnam in
  436. 0|1) typnum=0;; # no type specified, assume A
  437. *A) typnum=0; typnam=0;;
  438. *B) typnum=1;;
  439. *C) typnum=2;;
  440. *D) typnum=3;;
  441. *E) typnum=4;;
  442. *F) typnum=5;;
  443. *G) typnum=6;;
  444. *H) typnum=7;;
  445. *) echo bad type $typnam for $i; exit 1;;
  446. esac
  447. case $U in
  448. 0|1) blk=4; chr=37;;
  449. *) echo bad unit $U for $i; exit 1;;
  450. esac
  451. nam=fd${typnam}
  452. n=$(($(($U*128))+$(($typnum*16))))
  453. M ${nam}a b $blk $n 640 operator
  454. M ${nam}b b $blk $(($n+1)) 640 operator
  455. M ${nam}c b $blk $(($n+2)) 640 operator
  456. M ${nam}i b $blk $(($n+8)) 640 operator
  457. M r${nam}a c $chr $n 640 operator
  458. M r${nam}b c $chr $(($n+1)) 640 operator
  459. M r${nam}c c $chr $(($n+2)) 640 operator
  460. M r${nam}i c $chr $(($n+8)) 640 operator
  461. ;;
  462. cd*)
  463. dodisk2 cd $U 3 13 $U 0
  464. ;;
  465. local)
  466. test -s $T.local && sh $T.local
  467. ;;
  468. all)
  469. R switch0 switch1 switch2 switch3 vnd0 vnd1 vnd2 vnd3 sd0 sd1
  470. R sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 cd1 rd0 ttyB0 ttyB1 tap0
  471. R tap1 tap2 tap3 tun0 tun1 tun2 tun3 pty0 fd1 fd1B fd1C fd1D
  472. R fd1E fd1F fd1G fd1H fd0 fd0B fd0C fd0D fd0E fd0F fd0G fd0H
  473. R diskmap vscsi0 ch0 bio audio0 audio1 audio2 audio3 dt bpf
  474. R fuse pppac pppx hotplug ptm local wscons pci0 pci1 pci2 pci3
  475. R uall rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7
  476. R tuner0 radio0 speaker video0 video1 uk0 random lpa0 lpa1
  477. R lpa2 lpt0 lpt1 lpt2 tty00 tty01 tty02 tty03 tty04 tty05
  478. R tty06 tty07 tty08 tty09 tty0a tty0b ttyc0 ttyc1 ttyc2 ttyc3
  479. R ttyc4 ttyc5 ttyc6 ttyc7 pf wd0 wd1 wd2 wd3 std st0 st1 fd
  480. ;;
  481. wd*|sd*)
  482. case $i in
  483. wd*) dodisk wd $U 0 36 $U 0;;
  484. sd*) dodisk sd $U 8 8 $U 0;;
  485. esac
  486. ;;
  487. *)
  488. echo $i: unknown device
  489. ;;
  490. esac
  491. done
  492. }
  493. R "$@"
  494. {
  495. echo -n ${RMlist[*]}
  496. echo -n ${mklist[*]}
  497. echo -n ${MKlist[*]}
  498. echo -n ${whlist[*]}
  499. echo ${oplist[*]}
  500. } | if [ "$eo" = "echo" ]; then
  501. cat
  502. else
  503. sh
  504. fi