home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 19972 < prev    next >
Encoding:
Text File  |  1992-12-29  |  5.0 KB  |  117 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!eco.twg.com!eco.twg.com!larry
  3. From: larry@eco.twg.com (Lawrence B. Henry III)
  4. Subject: Re: flushing in VAXC and DECC
  5. Message-ID: <1992Dec28.233640.10643@eco.twg.com>
  6. Lines: 102
  7. Sender: larry@vishnu.eco.twg.com (Lawrence B. Henry III)
  8. Nntp-Posting-Host: eco.twg.com
  9. Reply-To: larry@eco.twg.com
  10. Organization: The Wollongong Group (East Coast Operations)
  11. References: <1992Dec26.211521.4768@spcvxb.spc.edu> <6813@npri6.npri.com>,<1992Dec27.055031.24162@eco.twg.com> <1hjtr9INN34t@gap.caltech.edu>,<1992Dec27.200611.24473@nntpd2.cxo.dec.com> <1hn91uINNnna@gap.caltech.edu>
  12. Date: Mon, 28 Dec 92 23:36:40 GMT
  13. Lines: 102
  14.  
  15.  
  16. In article <1hn91uINNnna@gap.caltech.edu>, carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes:
  17. |>Path: eco.twg.com!uunet!utcsri!torn!spool.mu.edu!darwin.sura.net!gatech!emory!swrinde!elroy.jpl.nasa.gov!news.claremont.edu!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
  18. |>From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
  19. |>Newsgroups: comp.os.vms
  20. |>Subject: Re: flushing in VAXC and DECC
  21. |>Date: 28 Dec 1992 16:12:46 GMT
  22. |>Organization: HST Wide Field/Planetary Camera
  23. |>Lines: 79
  24. |>Distribution: world
  25. |>Message-ID: <1hn91uINNnna@gap.caltech.edu>
  26. |>References: <1992Dec26.211521.4768@spcvxb.spc.edu> <6813@npri6.npri.com>,<1992Dec27.055031.24162@eco.twg.com> <1hjtr9INN34t@gap.caltech.edu>,<1992Dec27.200611.24473@nntpd2.cxo.dec.com>
  27. |>Reply-To: carl@SOL1.GPS.CALTECH.EDU
  28. |>NNTP-Posting-Host: sol1.gps.caltech.edu
  29. |>
  30. |>In article <1992Dec27.200611.24473@nntpd2.cxo.dec.com>, winalski@adserv.enet.dec.com (Paul S. Winalski) writes:
  31. |>>The function behaves as documented.  It flushes all of the C RTL's internal
  32. |>>buffers and it also does an RMS SYS$FLUSH to force the data to be written to
  33. |>>disk.
  34. |>>
  35. |>>You're being caught by the special RMS processing for process-permanent files.
  36. |>
  37. |>Afraid not.  The same thing happens with the program:
  38. |>    #include stdio
  39. |>    main()
  40. |>    {    FILE *fp;
  41. |>        fp = fopen("TEST.DAT", "w");
  42. |>        fprintf(fp, "This is a test.\n");
  43. |>        fsync(fileno(fp));
  44. |>        sleep(30);
  45. |>    }
  46. |>
  47. |>fsync() *MUST* be preceded by an fflush() if you want to be sure that all stuff
  48. |>that's already been written using standard I/O calls is flushed to disk.  And,
  49. |>byt the way, despite the claim by another person, the program:
  50. |>
  51. |>#include stdio
  52. |>main()
  53. |>{    int fd;
  54. |>    fd = creat("TEST.DAT");
  55. |>    write(fd, "This is a test.\n", 16);
  56. |>    fsync(fd);
  57. |>    sleep(30);
  58. |>}
  59. |>
  60. |>Also exhibits exactly the same behavior.  Unfortunately, there doesn't appear
  61. |>to be any documented way to flush the C I/O buffers if you've been using
  62. |>write() instead of standard I/O.
  63. |>
  64. |>>When you do a SPAWN/NOWAIT/OUT=filespec, SYS$OUTPUT (aka stdout) is opened in
  65. |>>supervisor mode by DCL as a process-permanent file.  This is done so that each
  66. |>>program run in the subprocess doesn't create its own version of the output file.
  67. |>>Many user-mode RMS operations on a process-permanent file end up being no-ops.
  68. |>>Among these are SYS$OPEN, SYS$CLOSE, and SYS$FLUSH.  So what happens here is
  69. |>>that the DECC RTL does write its buffers and do a SYS$FLUSH, but RMS ignores
  70. |>>the SYS$FLUSH because stdout is a process-permanent file.
  71. |>
  72. |>>Note that your second program above (the one with the fflush()) behaves
  73. |>>identically to the first one--you still don't see "This is a test." until the
  74. |>>subprocess terminates.  This is because the fsync()'s SYS$FLUSH is still
  75. |>>being ignored.
  76. |>
  77. |>Have you actually tried this, or are you just making a wild-assed-guess without
  78. |>actually testing your claim?  The reason I ask is that your claim is dead wrong
  79. |>under VMS v5.4-2.  Perhaps it's different under a different version of VMS?
  80. |>
  81. |>>If you change the first program to read:
  82. |>>
  83. |>>    #include stdio
  84. |>>    #include signal
  85. |>>        main()
  86. |>>        {
  87. |>>        FILE *x;
  88. |>>        x = fopen ("x.x", "w");
  89. |>>        fprintf(x, "This is a test.");
  90. |>>        fsync(fileno(x));
  91. |>>        sleep(30);
  92. |>>        }
  93. |>>
  94. |>>and then run it using the command SPAWN/NOWAIT/OUT=Y.Y RUN program
  95. |>>you will find that the fsync() flushes "This is a test." to file X.X as the
  96. |>>fsync() documentation would lead one to believe.
  97. |>
  98. |>Again, is this just a wild-assed guess?  I tried that under VMS v5.4-2, and
  99. |>once again, your claim is dead wrong.  If it's not simply a guess, what version
  100. |>of VMS are you running?
  101. |>--------------------------------------------------------------------------------
  102. |>Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
  103. |>
  104. |>Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
  105. |>understanding of astronomy is purely at the amateur level (or below).  So
  106. |>unless what I'm saying is directly related to VAX/VMS, don't hold me or my
  107. |>organization responsible for it.  If it IS related to VAX/VMS, you can try to
  108. |>hold me responsible for it, but my organization had nothing to do with it.
  109. |>
  110.  
  111. Hello ???.. maybe you need to follow the thread of this discussion a little 
  112. closer.. Sorry if things are moving too fast, but this thread has switched to
  113. AXP.. not VAX/VMS v5.4-2.. it works fine on ALPHA as Mr. Winalski has 
  114. indicated..
  115.  
  116. -Larry.
  117.