bind 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. .TH BIND 1
  2. .SH NAME
  3. bind, mount, unmount \- change name space
  4. .SH SYNOPSIS
  5. .B bind
  6. [
  7. .I option ...
  8. ]
  9. .I new old
  10. .PP
  11. .B mount
  12. [
  13. .I option ...
  14. ]
  15. .I servename old
  16. [
  17. .I spec
  18. ]
  19. .PP
  20. .B unmount
  21. [
  22. .I new
  23. ]
  24. .I old
  25. .SH DESCRIPTION
  26. .I Bind
  27. and
  28. .I mount
  29. modify the file name space of the current process
  30. and other processes in the same name space group
  31. (see
  32. .IR fork (2)).
  33. For both calls,
  34. .I old
  35. is the name of an existing file or directory in the
  36. current name space where the modification is to be made.
  37. .PP
  38. For
  39. .IR bind ,
  40. .I new
  41. is the name of another (or possibly the same)
  42. existing file or directory in
  43. the current name space.
  44. After a successful
  45. .IR bind ,
  46. the file name
  47. .I old
  48. is an alias for the object originally named by
  49. .IR new ;
  50. if the modification doesn't hide it,
  51. .I new
  52. will also still refer to its original file.
  53. The evaluation of
  54. .I new
  55. (see
  56. .IR intro (2))
  57. happens at the time of the
  58. .IR bind ,
  59. not when the binding is later used.
  60. .PP
  61. The
  62. .I servename
  63. argument to
  64. .I mount
  65. is the name of a file that, when opened, yields an
  66. existing connection to a file server.
  67. Almost always,
  68. .I servename
  69. will be a file in
  70. .B /srv
  71. (see
  72. .IR srv (3)).
  73. In the discussion below,
  74. .I new
  75. refers to the file named by the
  76. .I new
  77. argument to
  78. .I bind
  79. or the root directory of the service
  80. available in
  81. .I servename
  82. after a
  83. .IR mount .
  84. Either both
  85. .I old
  86. and
  87. .I new
  88. files must be directories,
  89. or both must not be directories.
  90. .PP
  91. Options control aspects of the modification to the name space:
  92. .TP 10
  93. (none)
  94. Replace the
  95. .I old
  96. file by the new one.
  97. Henceforth, an evaluation of
  98. .I old
  99. will be translated to the new file.
  100. If they are directories (for
  101. .IR mount ,
  102. this condition is true by definition),
  103. .I old
  104. becomes a
  105. .I "union directory"
  106. consisting of one directory (the new file).
  107. .TP
  108. .B -b
  109. Both files must be directories.
  110. Add the new directory to the beginning
  111. of the union directory represented by the old file.
  112. .TP
  113. .B -a
  114. Both files must be directories.
  115. Add the new directory to the end
  116. of the union directory represented by the old file.
  117. .TP
  118. .B -c
  119. This can be used in addition to any of the above to permit
  120. creation in a union directory.
  121. When a new file is created in a union directory,
  122. it is placed in the first element of the union that has been bound or mounted with the
  123. .B -c
  124. flag.
  125. If that directory does not have write permission, the create fails.
  126. .TP
  127. .B -C
  128. (Only in
  129. .IR mount .)
  130. By default, file contents are always retrieved from the server.
  131. With this option, the kernel may instead use a local cache to satisfy
  132. .IR read (5)
  133. requests for files accessible through this mount point.
  134. The currency of cached data for a file is verified at each
  135. .IR open (5)
  136. of the file from this client machine.
  137. .TP
  138. .B -q
  139. Exit silently if the
  140. .B bind
  141. or
  142. .B mount
  143. operation fails.
  144. .PD
  145. .PP
  146. .I Mount
  147. takes an additional option,
  148. .B -k
  149. .IR keypattern ,
  150. to constrain the set of
  151. .IR factotum (4)
  152. keys used for an authenticated mount.
  153. .PP
  154. The
  155. .I spec
  156. argument to
  157. .I mount
  158. is passed in the
  159. .IR attach (5)
  160. message to the server, and selects among different
  161. file trees served by the server.
  162. .PP
  163. The
  164. .IR srv (3)
  165. service registry device, normally bound to
  166. .BR /srv ,
  167. is a convenient rendezvous point for services that can be mounted.
  168. After bootstrap, the file
  169. .B /srv/boot
  170. contains the communications port to the file system from which
  171. the system was loaded.
  172. .PP
  173. The effects of
  174. .I bind
  175. and
  176. .I mount
  177. can be undone with the
  178. .I unmount
  179. command.
  180. If two arguments are given to
  181. .IR unmount ,
  182. the effect is to undo a
  183. .I bind
  184. or
  185. .I mount
  186. with the same arguments.
  187. If only one argument is given,
  188. everything bound to or mounted upon
  189. .I old
  190. is unmounted.
  191. .SH EXAMPLES
  192. To compile a program with the C library from July 16, 1992:
  193. .IP
  194. .EX
  195. mount /srv/boot /n/dump dump
  196. bind /n/dump/1992/0716/mips/lib/libc.a /mips/lib/libc.a
  197. mk
  198. .EE
  199. .SH SOURCE
  200. .B /sys/src/cmd/bind.c
  201. .br
  202. .B /sys/src/cmd/mount.c
  203. .br
  204. .B /sys/src/cmd/unmount.c
  205. .SH SEE ALSO
  206. .IR bind (2),
  207. .IR open (2),
  208. .IR srv (3),
  209. .IR srv (4)