Fix specification of "write" system call to match the file system
[pintos-anon] / doc / userprog.texi
index 60a53ee09cc6d876cb562d64be4544689e4716fc..3541540173dee33fd674a50783dfc716c9dd9e17 100644 (file)
@@ -658,15 +658,16 @@ of the rest.
 @deftypefn {System Call} bool create (const char *@var{file}, unsigned @var{initial_size})
 Creates a new file called @var{file} initially @var{initial_size} bytes
 in size.  Returns true if successful, false otherwise.
-Opening the new file is a separate operation using the @code{open}
-system call.
+Creating a new file does not open it: opening the new file is a
+separate operation which would require a @code{open} system call.
 @end deftypefn
 
 @deftypefn {System Call} bool remove (const char *@var{file})
 Deletes the file called @var{file}.  Returns true if successful, false
 otherwise.
-A file may be removed regardless of whether it is open or closed
-(@pxref{Removing an Open File}, for more information).
+A file may be removed regardless of whether it is open or closed, and
+removing an open file does not close it.  @xref{Removing an Open
+File}, for details.
 @end deftypefn
 
 @deftypefn {System Call} int open (const char *@var{file})
@@ -704,13 +705,13 @@ than end of file).  Fd 0 reads from the keyboard using
 
 @deftypefn {System Call} int write (int @var{fd}, const void *@var{buffer}, unsigned @var{size})
 Writes @var{size} bytes from @var{buffer} to the open file @var{fd}.
-Returns the number of bytes actually written, or -1 if the file could
-not be written.
+Returns the number of bytes actually written, which may be less than
+@var{size} if some bytes could not be written.
 
 Writing past end-of-file would normally extend the file, but file growth
 is not implemented by the basic file system.  The expected behavior is
 to write as many bytes as possible up to end-of-file and return the
-actual number written, or -1 if no bytes could be written at all.
+actual number written, or 0 if no bytes could be written at all.
 
 Fd 1 writes to the console.  Your code to write to the console should
 write all of @var{buffer} in one call to @func{putbuf}, at least as