[squeak-dev] Adding fsync() call to the primitiveFileFlush prim ?

tim Rowledge tim at rowledge.org
Sat May 21 16:50:16 UTC 2016


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.

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….

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: JSP: Jump on Sexy Programmer




More information about the Squeak-dev mailing list