primitiveFileSize on mac/unix

Tim Rowledge tim at
Mon May 2 17:13:48 UTC 2005

Avi Bryant <avi.bryant at> wrote:

> I think this may have come up before, but: on the Unix or Mac (Carbon)
> VMs, a FileStream will always return the #size it had when it was
> opened, or the last time that FileStream instance was written to
Yah, I think I ranted about this a few years ago.

Take a look at platforms/Cross/plugins/FilePlugin/ (Hmm, typoed that as
pfilPlugin - must have read too much 'bondage fairies' recently)
sqFileBasicPlugins.c and note the strange usage of the 'fileSize' element of
the SQFile structure as noted in setSize and getSize.

It's all a bit of a mess. It seems to me that a number of the functions can
only really work in a world where a file can only be opened once, by a single
process, yet a lot of code in the image can only work by opening a file
multiple times. And if your OS allows sharing of files by several processes as
well it seems to be even uglier; how can you truncate a file sensibly if some
other process could be expecting to write to it from the previous endpoint?

Not to mention the strange primitive-level setting of file-position. 

Tim Rowledge, tim at,
The clothes have no Emperor - C.A.R. Hoare commenting on ADA

More information about the Squeak-dev mailing list