From 8fabcf17ec6ab17fe3b786d7de173c3e10abdb43 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 31 Mar 2007 14:12:03 +0000 Subject: [PATCH] Fix specification of "write" system call to match the file system implementation and the tests. --- doc/userprog.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/userprog.texi b/doc/userprog.texi index df25ed9..3541540 100644 --- a/doc/userprog.texi +++ b/doc/userprog.texi @@ -705,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 -- 2.11.4.GIT