X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=doc%2Fuserprog.texi;h=3541540173dee33fd674a50783dfc716c9dd9e17;hb=d4711f749a61550fc1e64e2f78af1e8827b92de3;hp=60a53ee09cc6d876cb562d64be4544689e4716fc;hpb=d26c924c8cd947e91bd4f5e8d0b7f74d3460d22b;p=pintos-anon diff --git a/doc/userprog.texi b/doc/userprog.texi index 60a53ee..3541540 100644 --- a/doc/userprog.texi +++ b/doc/userprog.texi @@ -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