<div dir="ltr">Hi Tim,<div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 21, 2016 at 9:50 AM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We have an interesting problem in Pi-land where many teachers report kids losing their Scratch work (and other, but I don’t get to fix that) because of pulling the power before fully shutting down etc. This tends to put them off trying again, apparently.<br>
<br>
We already close files properly after writing out files but it seems that dear ol’unix likes to save actual writing for later, perhaps when it has time for a relaxing latté or whatever. It has been suggested that using fsync() might force the lazy writer to actually do its job properly, which seems reasonable. In thinking about where to add this I see a couple of obvious possibilities<br>
a) a new primitive<br>
b) add fsync() (suitably wrapped in case of non-availability) to the end of the sqFileFlush() called in primitiveFileFlush() code.<br></blockquote><div><br></div><div>It could be optional so that either</div><div>c) its only done on ARM linux builds (via e.g. -DFlushAlsoFsyncs=1), or</div><div>d) a command-line flag to the VM (e.g. -fsynconflush) which can be set by default in the squeak or scratch startup script on rpi.</div><div><br></div><div>This seems to me more appropriate.  I think d) is worth the effort, but c) would be very simple.</div><div><br></div><div>Any other suggestions?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I think I prefer b) personally but I’m happy to be educated. Possible probles insclude some OS’ not having a fsync option; so far as I can see Windows already uses a totally disjoint set of code.<br>
<br>
Can anyone think of bad things happening if I do this? Think of the children….<br></blockquote><div><br></div><div>Your consequent popularity could go to your head...?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" rel="noreferrer" target="_blank">http://www.rowledge.org/tim</a><br>
Strange OpCodes: JSP: Jump on Sexy Programmer<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>