[squeak-dev] Adding fsync() call to the primitiveFileFlush prim ?
Eliot Miranda
eliot.miranda at gmail.com
Sat May 21 17:12:34 UTC 2016
Hi Tim,
On Sat, May 21, 2016 at 9:50 AM, tim Rowledge <tim at rowledge.org> wrote:
> 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.
>
> 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
> a) a new primitive
> b) add fsync() (suitably wrapped in case of non-availability) to the end
> of the sqFileFlush() called in primitiveFileFlush() code.
>
It could be optional so that either
c) its only done on ARM linux builds (via e.g. -DFlushAlsoFsyncs=1), or
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.
This seems to me more appropriate. I think d) is worth the effort, but c)
would be very simple.
Any other suggestions?
>
> 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.
>
> Can anyone think of bad things happening if I do this? Think of the
> children….
>
Your consequent popularity could go to your head...?
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Strange OpCodes: JSP: Jump on Sexy Programmer
>
>
>
>
--
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160521/b0fc1312/attachment.htm
More information about the Squeak-dev
mailing list
|