[Cuis-dev] Questions triggered by #forceChangesToDisk
Andres Valloud
ten at smallinteger.com
Mon Sep 16 19:32:40 PDT 2019
Phil,
Regarding your observations on forceChangesToDisk, first a side comment.
That there is a method or even a primitive called
'blah-blah-flush-blah' does not mean the function fflush()
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html
or equivalent is actually called. Assuming otherwise eventually leads
to conclusions such as "xyzOS is so broken haha", and that's really self
limiting.
So, with a skeptic mentality in place, what is that flush method
actually doing? It looks like the relevant code is this:
primFlush: id
"Flush pending changes to the disk"
| p |
<primitive: 'primitiveFileFlush' module: 'FilePlugin'>
"In some OS's seeking to 0 and back will do a flush"
p _ self position.
self position: 0; position: p
That primitive failure is strange indeed, plus the failure is silent so
good luck noticing something might be off. So, rather than seeking back
and forth to (pretend to) deal with the failure, the question should be
why fflush() can't do its job. Does primitiveFileFlush actually call
the equivalent of fflush() in all platforms? Where and why does the
primitive fail, exactly? Suppose the id is stale, why does changing the
file position improve the situation on an file that is not open? Does
the primitive fail because it's not implemented? If that happens, then
why isn't the hack of opening / closing the file done here instead,
i.e.: why is there yet another hack that is different? Or, why was it
necessary to hack forceChangesToDisk, in a different way, on top of the
hack here? Exactly what operating systems are those "some OS's" the
comment talks about? Is there any evidence in support of the
authoritative assertion that seeking causes flushing?
Andres.
More information about the Cuis-dev
mailing list