home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / wizards / 4780 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.6 KB

  1. Path: sparky!uunet!kithrup!hoptoad!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!dsinc!ub!acsu.buffalo.edu!sivap-s
  2. From: sivap-s@acsu.buffalo.edu (Suresh .S)
  3. Newsgroups: comp.unix.wizards
  4. Subject: Re: system call write
  5. Message-ID: <BxxFoq.7vE@acsu.buffalo.edu>
  6. Date: 18 Nov 92 19:34:01 GMT
  7. References: <1992Nov13.164855.14013@tamsun.tamu.edu>
  8. Sender: nntp@acsu.buffalo.edu
  9. Organization: UB
  10. Lines: 22
  11. Nntp-Posting-Host: thuban.cs.buffalo.edu
  12. X-Newsreader: TIN [version 1.1 PL6]
  13.  
  14. P S Narayan (pnarayan@cs.tamu.edu) wrote:
  15. : When I do a write (fd, buf, bytes), assuming that the file descriptor refers
  16. : to an open block device say disk, is the kernel going to copy buf from user
  17. : space to system buffer or is it going to flush it immediately onto disk ?
  18. : System V literature says that it is copied onto buffer and then by LRU 
  19. : algorithm, it gets flushed when another process tries to access this buffer.
  20. : In that case how can the user process without closing the files, ensure that
  21. : his write system call flushes info onto disk ? Is there a way to do it ?
  22. : My question is how can I get synchronous write ?
  23.  
  24. When you are opening the file, you can  set  the  O_SYNC option in the
  25. flags, which will give you synchronous writes. Another way could be to
  26. set the descriptor flags using fcntl()[cmd is F_SETFL].
  27.  
  28. I am not sure if that  is available in  others OS, it  is available in
  29. SunOS4.1.1.
  30.  
  31. -- 
  32. Suresh Sivaprakasam                    
  33. Department of Computer Science,    SUNY Buffalo,    Amherst,   NY - 14260-0001
  34. Internet :sivap-s@cs.Buffalo.EDU               Bitnet : sivap-s@SUNYBCS.BITNET
  35.