3 open, create \- prepare a fid for I/O on an existing or new file
34 request asks the file server to check permissions and
35 prepare a fid for I/O with subsequent
42 field determines the type of I/O:
56 read access, write access, read and write access,
60 to be checked against the permissions for the file.
67 the file is to be truncated, which requires write permission
69 the file is append-only, and permission is granted, the
71 succeeds but the file will not be truncated);
77 bit set, the file is to be removed when the fid
78 is clunked, which requires permission to remove the file from its directory.
82 It is illegal to write a directory, truncate it, or attempt to remove it on close.
83 If the file is marked for exclusive use (see
85 only one client can have the file open at any time.
86 That is, after such a file has been opened,
87 further opens will fail until
90 All these permissions are checked at the time of the
92 request; subsequent changes to the permissions of files do not affect
93 the ability to read, write, or remove an open file.
97 request asks the file server to create a new file
100 supplied, in the directory
104 and requires write permission in the directory.
105 The owner of the file is the implied user id of the request,
106 the group of the file is the same as
108 and the permissions are the value of
110 .B "perm & (~0666 | (dir.perm & 0666))"
111 if a regular file is being created and
113 .B "perm & (~0777 | (dir.perm & 0777))"
114 if a directory is being created.
115 This means, for example, that if the
117 allows read permission to others, but the containing directory
118 does not, then the created file will not allow others to read the file.
120 Finally, the newly created file is opened according to
124 will represent the newly opened file.
126 is not checked against the permissions in
130 for the new file is returned with the
134 Directories are created by setting the
145 are special; it is illegal to create files with these names.
147 It is an error for either of these messages if the fid
148 is already the product of a successful
156 a file in a directory where the given
158 already exists will be rejected;
167 The algorithm used by the
171 first walk to the directory to contain the file.
172 If that fails, return an error.
175 to the specified file.
178 succeeds, send a request to
180 and truncate the file and return the result, successful or not.
183 fails, send a create message.
184 If that fails, it may be because the file was created by another
185 process after the previous walk failed, so (once) try the
191 .\" For the behavior of
193 .\" on a union directory, see
198 .\" field returned by
203 .\" If it is not, it is the maximum number of bytes that are guaranteed to
204 .\" be read from or written to the file without breaking the I/O transfer
205 .\" into multiple 9P messages; see
222 associated with an open file may be discovered by calling
225 For programs that need atomic file creation, without the race
228 sequence described above,
241 message is not sent; the kernel issues only the
243 Thus, if the file exists,
245 will draw an error, but if it doesn't and the
247 call succeeds, the process issuing the
249 is guaranteed to be the one that created the file.