[cs631apue] HW#2 grades sent

Jan Schaumann jschauma at stevens.edu
Tue Oct 4 17:00:14 EDT 2011


Hello,

I just sent out the grades for HW#2.  If you have not received an email
from me with your grade, please contact me ASAP.

It is worth noting that:

- most of you really need to go back and check the return values of all
  your function calls
- you cannot read the entire file into memory and the write it out in
  one go -- files can be larger than the amount of available memory
- covering the edge cases as noted in the 'testcp' script is tricky, but
  most of you did a good job

For the extra credit part, all of you made the mistake of trying to map
the entire file into memory (again).  Using mmap(2) and friends does not
magically enhance the memory you have -- it's just a different way of
copying a buffer of data.  Take a look at Stevens, Chapter 14.9 (we will
revisit that in a future lecture).

Also, the mmap(2) logic needs to account for zero-sized files (since
you're seeking and writing a byte to establish the size of the file).

For some example code of how to copy a file, take a look at:
http://cvsweb.netbsd.org/bsdweb.cgi/src/bin/cp/utils.c?rev=HEAD

-Jan


More information about the cs631apue mailing list