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.

486 lines
9.4 KiB

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