0intro 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .TH INTRO 3
  2. .SH NAME
  3. intro \- introduction to the Plan 9 devices
  4. .SH DESCRIPTION
  5. A Plan 9
  6. .I device
  7. implements a file tree for client processes.
  8. A file name beginning with a pound sign, such as
  9. .LR #c ,
  10. names the root of a file tree implemented by
  11. a particular
  12. .IR "kernel device driver"
  13. identified by the character after the pound sign.
  14. Such names are usually bound to conventional locations
  15. in the name space.
  16. For example, after
  17. .IP
  18. .EX
  19. bind("#c", "/dev", MREPL)
  20. .EE
  21. .LP
  22. an
  23. .IR ls (1)
  24. of
  25. .B /dev
  26. will list the files provided by the
  27. .I console
  28. device.
  29. .PP
  30. A kernel device driver is a
  31. .I server
  32. in the sense of the Plan 9 File Protocol, 9P (see Section 5),
  33. but with the messages implemented by local
  34. rather than remote procedure calls.
  35. Also, several of the messages
  36. .RI ( Nop ,
  37. .IR Session ,
  38. .IR Flush ,
  39. and
  40. .IR Error )
  41. have no subroutine equivalents.
  42. .PP
  43. When a system call is passed a file name beginning with
  44. .L "#"
  45. it looks at the next character, and if that is a valid
  46. .I device character
  47. it performs an
  48. .IR attach (5)
  49. on the corresponding device to get a channel representing the
  50. root of that device's file tree.
  51. If there are any characters after the device character but
  52. before the next
  53. .L "/"
  54. or end of string, those characters are passed as parameter
  55. .I aname
  56. to the attach. For example,
  57. .IP
  58. .EX
  59. #I2
  60. .EE
  61. .PP
  62. identifies the number 2 IP protocol stack
  63. (see
  64. .IR ip (3)).
  65. .PP
  66. Each kernel device has a conventional place at which to be bound
  67. to the name space.
  68. The
  69. .I SYNOPSIS
  70. sections of the following pages includes a
  71. .I bind
  72. command to put the device in the conventional place.
  73. Most of these binds are done automatically by
  74. .IR init (8)
  75. using
  76. .B newns
  77. (see
  78. .IR auth (2))
  79. on the file
  80. .B /lib/namespace
  81. (see
  82. .IR namespace (6)).
  83. When typed to
  84. .IR rc (1),
  85. the
  86. .I bind
  87. commands will need quotes to protect the
  88. .B #
  89. characters.
  90. .SH SEE ALSO
  91. .IR intro (5),
  92. .IR intro (2)