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.

500 lines
9.3 KiB

18 years ago
8 years ago
8 years ago
14 years ago
18 years ago
14 years ago
18 years ago
14 years ago
18 years ago
17 years ago
18 years ago
14 years ago
18 years ago
11 years ago
14 years ago
18 years ago
18 years ago
14 years ago
18 years ago
14 years ago
18 years ago
18 years ago
15 years ago
15 years ago
18 years ago
18 years ago
12 years ago
18 years ago
12 years ago
18 years ago
12 years ago
18 years ago
12 years ago
18 years ago
11 years ago
18 years ago
15 years ago
16 years ago
18 years ago
18 years ago
14 years ago
18 years ago
16 years ago
18 years ago
14 years ago
18 years ago
18 years ago
18 years ago
18 years ago
14 years ago
11 years ago
18 years ago
14 years ago
18 years ago
17 years ago
18 years ago
14 years ago
11 years ago
10 years ago
14 years ago
18 years ago
15 years ago
18 years ago
15 years ago
18 years ago
14 years ago
18 years ago
18 years ago
10 years ago
13 years ago
12 years ago
18 years ago
  1. #!/bin/sh -
  2. #
  3. # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
  4. # generated from:
  5. #
  6. # OpenBSD: etc.armish/MAKEDEV.md,v 1.36 2016/04/25 20:38:10 tedu Exp
  7. # OpenBSD: MAKEDEV.common,v 1.86 2016/04/25 20:39:42 tedu Exp
  8. # OpenBSD: MAKEDEV.mi,v 1.82 2016/03/12 17:58:59 espie 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. # ch* SCSI media changers
  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. # st* SCSI tape drives
  41. # Terminal ports:
  42. # tty[0-7][0-9a-f] NS16x50 serial ports
  43. # Pseudo terminals:
  44. # ptm pty master device
  45. # pty* Set of 62 master pseudo terminals
  46. # tty* Set of 62 slave pseudo terminals
  47. # Console ports:
  48. # ttyC-J* wscons display devices
  49. # wscons Minimal wscons devices
  50. # wskbd* wscons keyboards
  51. # wsmouse* wscons mice
  52. # wsmux wscons keyboard/mouse mux devices
  53. # USB devices:
  54. # ttyU* USB serial ports
  55. # uall All USB devices
  56. # ugen* Generic USB devices
  57. # uhid* Generic HID devices
  58. # ulpt* Printer devices
  59. # usb* Bus control devices used by usbd for attach/detach
  60. # Special purpose devices:
  61. # apm Power management device
  62. # audio* Audio devices
  63. # bio ioctl tunnel pseudo-device
  64. # bktr* Video frame grabbers
  65. # bpf Berkeley Packet Filter
  66. # diskmap Disk mapper
  67. # fd fd/* nodes
  68. # fuse Userland Filesystem
  69. # hotplug devices hot plugging
  70. # pci* PCI bus devices
  71. # pf* Packet Filter
  72. # pppx* PPP Multiplexer
  73. # radio* FM tuner devices
  74. # *random In-kernel random data source
  75. # rmidi* Raw MIDI devices
  76. # tun* Network tunnel driver
  77. # tap* Ethernet tunnel driver
  78. # uk* Unknown SCSI devices
  79. # tuner* Tuner devices
  80. # video* Video V4L2 devices
  81. # vscsi* Virtual SCSI controller
  82. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  83. T=$0
  84. # set this to echo for Echo-Only debugging
  85. [ "$eo" ] || eo=
  86. hex()
  87. {
  88. case $1 in
  89. [0-9]) echo -n $1;;
  90. 10) echo -n a;;
  91. 11) echo -n b;;
  92. 12) echo -n c;;
  93. 13) echo -n d;;
  94. 14) echo -n e;;
  95. 15) echo -n f;;
  96. esac
  97. }
  98. alph2d()
  99. {
  100. local t="$1"
  101. local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  102. local sub=${p%${t}*}
  103. echo ${#sub}
  104. }
  105. h2d()
  106. {
  107. local s="$1"
  108. local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
  109. echo $(($(_h2d $f)*16+ $(_h2d $n) ))
  110. }
  111. _h2d()
  112. {
  113. case $1 in
  114. [0-9]) echo -n $1;;
  115. a) echo -n 10;;
  116. b) echo -n 11;;
  117. c) echo -n 12;;
  118. d) echo -n 13;;
  119. e) echo -n 14;;
  120. f) echo -n 15;;
  121. esac
  122. }
  123. unt()
  124. {
  125. # XXX pdksh can't seem to deal with locally scoped variables
  126. # in ${foo#$bar} expansions
  127. arg="$1"
  128. tmp="${arg#[a-zA-Z]*}"
  129. tmp="${tmp%*[a-zA-Z]}"
  130. while [ "$tmp" != "$arg" ]
  131. do
  132. arg=$tmp
  133. tmp="${arg#[a-zA-Z]*}"
  134. tmp="${tmp%*[a-zA-Z]}"
  135. done
  136. echo $arg
  137. }
  138. dodisk()
  139. {
  140. [ "$DEBUG" ] && set -x
  141. n=$(($((${5}*${7:-16}))+${6})) count=0
  142. [ 0$7 -ne 8 ] && l="i j k l m n o p"
  143. for d in a b c d e f g h $l
  144. do
  145. M $1$2$d b $3 $(($n+$count)) 640 operator
  146. M r$1$2$d c $4 $(($n+$count)) 640 operator
  147. let count=count+1
  148. done
  149. }
  150. dodisk2()
  151. {
  152. n=$(($(($5*${7:-16}))+$6))
  153. M $1$2a b $3 $n 640 operator
  154. M r$1$2a c $4 $n 640 operator
  155. n=$(($n+2))
  156. M $1$2c b $3 $n 640 operator
  157. M r$1$2c c $4 $n 640 operator
  158. }
  159. # M name b/c major minor [mode] [group]
  160. RMlist[0]="rm -f"
  161. mkl() {
  162. : ${mklist[0]:=";mknod"}
  163. mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5"
  164. }
  165. M() {
  166. RMlist[${#RMlist[*]}]=$1
  167. mkl ${5-666} $1 $2 $3 $4
  168. G=${6:-wheel}
  169. [ "$7" ] && {
  170. MKlist[${#MKlist[*]}]="&& chown $7:$G $1"
  171. } || {
  172. case $G in
  173. wheel)
  174. [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel"
  175. whlist[${#whlist[*]}]="$1"
  176. ;;
  177. operator)
  178. [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator"
  179. oplist[${#oplist[*]}]="$1"
  180. ;;
  181. *)
  182. MKlist[${#MKlist[*]}]="&& chgrp $G $1";
  183. esac
  184. }
  185. return 0
  186. }
  187. R() {
  188. [ "$DEBUG" ] && set -x
  189. for i in "$@"
  190. do
  191. U=`unt $i`
  192. [ "$U" ] || U=0
  193. case $i in
  194. ramdisk)
  195. R std bpf wd0 wd1 sd0 tty00 rd0 wsmouse
  196. R st0 ttyC0 wskbd0 apm bio diskmap random
  197. ;;
  198. std)
  199. M console c 0 0 600
  200. M tty c 1 0
  201. M mem c 2 0 640 kmem
  202. M kmem c 2 1 640 kmem
  203. M null c 2 2
  204. M zero c 2 12
  205. M stdin c 7 0
  206. M stdout c 7 1
  207. M stderr c 7 2
  208. M ksyms c 8 0 640 kmem
  209. M klog c 6 0 600
  210. ;;
  211. vscsi*)
  212. M vscsi$U c 100 $U 600
  213. ;;
  214. video*)
  215. M video$U c 38 $U
  216. MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video"
  217. ;;
  218. tuner*)
  219. M tuner$U c 75 $(($(($U*2))+16)) 644
  220. ;;
  221. uk*)
  222. M uk$U c 28 $U 640 operator
  223. ;;
  224. tap*)
  225. M tap$U c 104 $U 600
  226. ;;
  227. tun*)
  228. M tun$U c 33 $U 600
  229. ;;
  230. rmidi*)
  231. M rmidi$U c 57 $U 666
  232. ;;
  233. *random)
  234. n=0
  235. for pre in " " s u a
  236. do
  237. M ${pre}random c 40 $n 644
  238. n=$(($n+1))
  239. done
  240. ;;
  241. radio*)
  242. M radio$U c 97 $U
  243. MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio"
  244. ;;
  245. pppx*)
  246. M pppx$U c 103 $U 600
  247. ;;
  248. pf*)
  249. M pf c 46 0 600
  250. ;;
  251. pci*)
  252. M pci$U c 88 $U 600
  253. MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci"
  254. ;;
  255. hotplug)
  256. M hotplug c 37 $U 400
  257. ;;
  258. fuse)
  259. M fuse$U c 77 $U 600
  260. ;;
  261. fd)
  262. RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0
  263. while [ $n -lt 64 ];do M fd/$n c 7 $n;n=$(($n+1));done
  264. MKlist[${#MKlist[*]}]=";chmod 555 fd"
  265. ;;
  266. diskmap)
  267. M diskmap c 102 0 640 operator
  268. ;;
  269. bpf)
  270. M bpf c 22 0 600
  271. M bpf0 c 22 0 600
  272. ;;
  273. bktr*)
  274. M bktr$U c 75 $U 644
  275. ;;
  276. bio)
  277. M bio c 52 0 600
  278. ;;
  279. audio*)
  280. M sound$U c 36 $U
  281. M mixer$U c 36 $(($U+16))
  282. M audio$U c 36 $(($U+128))
  283. M audioctl$U c 36 $(($U+192))
  284. MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio"
  285. MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
  286. MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound"
  287. MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl"
  288. ;;
  289. apm*)
  290. M apm c 34 0 644
  291. M apmctl c 34 8 644
  292. ;;
  293. usb*)
  294. [ "$i" = "usb" ] && u= || u=$U
  295. M usb$u c 64 $U 660
  296. ;;
  297. ulpt*)
  298. M ulpt$U c 66 $U 660
  299. ;;
  300. uhid*)
  301. M uhid$U c 65 $U 660
  302. ;;
  303. ugen*)
  304. n=$(($U*16))
  305. for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5}
  306. do
  307. M ugen$U.$j c 70 $(($n+10#$j)) 660
  308. done
  309. ;;
  310. uall)
  311. R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ugen2 ugen3 ugen4 ugen5
  312. R ugen6 ugen7 ulpt0 ulpt1 uhid0 uhid1 uhid2 uhid3 usb0 usb1
  313. R usb2 usb3 usb4 usb5 usb6 usb7
  314. ;;
  315. ttyU[0-9a-zA-Z])
  316. U=${i#ttyU*}
  317. o=$(alph2d $U)
  318. M ttyU$U c 68 $o 660 dialer uucp
  319. M cuaU$U c 68 $(($o+128)) 660 dialer uucp
  320. ;;
  321. wsmux|wsmouse|wskbd)
  322. M wsmouse c 63 0 600
  323. M wskbd c 63 1 600
  324. ;;
  325. wsmouse[0-9]*)
  326. M wsmouse$U c 62 $U 600
  327. ;;
  328. wskbd[0-9]*)
  329. M wskbd$U c 61 $U 600
  330. ;;
  331. wscons)
  332. R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wskbd0 wskbd1 wskbd2
  333. R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5
  334. R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb
  335. ;;
  336. tty[C-J]*)
  337. U=${i##tty[C-J]}
  338. case $i in
  339. ttyC*) n=C m=0;;
  340. ttyD*) n=D m=256;;
  341. ttyE*) n=E m=512;;
  342. ttyF*) n=F m=768;;
  343. ttyG*) n=G m=1024;;
  344. ttyH*) n=H m=1280;;
  345. ttyI*) n=I m=1536;;
  346. ttyJ*) n=J m=1792;;
  347. esac
  348. case $U in
  349. [0-9a-f]) M tty$n$U c 60 $((16#$U+$m)) 600;;
  350. cfg) M tty${n}cfg c 60 $((255+$m)) 600;;
  351. *) echo bad unit $U for $i; exit 1;;
  352. esac
  353. ;;
  354. pty*)
  355. if [ $U -gt 15 ]; then
  356. echo bad unit for pty in: $i
  357. continue
  358. fi
  359. set -A letters p q r s t u v w x y z P Q R S T
  360. 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 \
  361. 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 \
  362. Y Z
  363. name=${letters[$U]}
  364. n=0
  365. while [ $n -lt 62 ]
  366. do
  367. nam=$name${suffixes[$n]}
  368. off=$(($U*62))
  369. M tty$nam c 4 $(($off+$n))
  370. M pty$nam c 5 $(($off+$n))
  371. n=$(($n+1))
  372. done
  373. ;;
  374. ptm)
  375. M ptm c 98 0 666
  376. ;;
  377. tty[0-7][0-9a-f])
  378. U=${i#tty*}
  379. o=$(h2d $U)
  380. M tty$U c 12 $o 660 dialer uucp
  381. M cua$U c 12 $(($o+128)) 660 dialer uucp
  382. ;;
  383. st*)
  384. n=$(($U*16))
  385. for pre in " " n e en
  386. do
  387. M ${pre}st$U b 25 $n 660 operator
  388. M ${pre}rst$U c 25 $n 660 operator
  389. n=$(($n+1))
  390. done
  391. ;;
  392. vnd*)
  393. dodisk vnd $U 19 19 $U 0
  394. ;;
  395. rd*)
  396. dodisk2 rd $U 18 18 $U 0
  397. ;;
  398. ch*)
  399. M ch$U c 27 $U 660 operator
  400. ;;
  401. cd*)
  402. dodisk2 cd $U 26 26 $U 0
  403. ;;
  404. local)
  405. test -s $T.local && sh $T.local
  406. ;;
  407. all)
  408. R vnd0 vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9
  409. R cd0 cd1 rd0 tap0 tap1 tap2 tap3 tun0 tun1 tun2 tun3 bio pty0
  410. R diskmap vscsi0 ch0 audio0 audio1 audio2 bpf fuse pppx
  411. R hotplug ptm local wscons pci0 pci1 pci2 pci3 uall rmidi0
  412. R rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 tuner0
  413. R radio0 video0 video1 uk0 random tty00 tty01 tty02 tty03
  414. R tty04 tty05 tty06 tty07 tty08 tty09 tty0a tty0b apm pf wd0
  415. R wd1 wd2 wd3 std st0 st1 fd
  416. ;;
  417. wd*|sd*)
  418. case $i in
  419. wd*) dodisk wd $U 16 16 $U 0;;
  420. sd*) dodisk sd $U 24 24 $U 0;;
  421. esac
  422. ;;
  423. *)
  424. echo $i: unknown device
  425. ;;
  426. esac
  427. done
  428. }
  429. R "$@"
  430. {
  431. echo -n ${RMlist[*]}
  432. echo -n ${mklist[*]}
  433. echo -n ${MKlist[*]}
  434. echo -n ${whlist[*]}
  435. echo ${oplist[*]}
  436. } | if [ "$eo" = "echo" ]; then
  437. cat
  438. else
  439. sh
  440. fi