home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v8 / text0062.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  1.4 KB

  1. From: scgvaxd!stb!michael@seismo.UUCP
  2. Date: Tue Nov 25 17:39:33 1986
  3.  
  4.  
  5. Ok, lets look at read() and write().
  6. 1. There is no requirement that anything written will be available for a
  7. read().
  8. 2. There is no requirement that read/write return everything that they can.
  9.  
  10. In general, you can't require this. The terminal lines are a good example; 
  11. writting to a terminal will not result in it being readable; the terminal
  12. drivers only return a line at a time no matter how much is requested. Or
  13. at least, thats what the docs say (I've never actually tested it, but it
  14. seems that if it were false, then type ahead would not work as well.)
  15.  
  16. In general, it is probably safe to require that anything written to a file
  17. should be available to a subsequent read provided that the read is done on
  18. a file descriptor corresponding to the same name, or a link to the same
  19. named file that was written to, all providing that it is a regular file.
  20. Certainly not for device or special files.
  21.  
  22. Incidently, don't think that 2 is obvious; my first unix programs assumed
  23. that the O/S would return a number of bytes so that the reads would be
  24. re-aligned on a 512 byte boundary, and that I had to call read() multiple
  25. times until I had gotten everything. I was quite suprised to find that
  26. other people had written stuff that did not do this, and even more
  27. suprised to find that it actually worked. No :-)
  28.  
  29.         Michael Gersten
  30.  
  31.  
  32.  
  33. Volume-Number: Volume 8, Number 63
  34.  
  35.