[Fontconfig] Re: [patch]: mmapping FontConfig data structures

Patrick Lam plam at MIT.EDU
Sat Jun 11 01:35:26 EST 2005

Jeremy C. Reed wrote:
> Please make sure this doesn't have race conditions when using /tmp or
> Maybe use O_EXCL (with open(2)) when creating, but that may not be good
> enough for some network-based filesystems.
> And don't use 666 for creating the file. If I overlooked or misunderstood
> something, please let us know.

I will use 600 rather than 666. Since this file is just hanging around
anyway, it seems to be insufficient to avoid race conditions.  I think
that if I could create a checksum (e.g. CRC32) of the expected state, as
written, and verified the checksum before read, that ought to be
sufficient; what do you think?

Alan Coopersmith wrote:
> But only if fonts.mmap is platform independent.  Many places
> use home directories NFS shared across different types of machines.
> (big & little endian, 32 & 64 bit, etc.)

It's hard to imagine how one could possibly make fonts.mmap platform
independent.  However, I have included the output of uname's sysname and
machine fields in the filename to prevent horrible outcomes, and as an
extra check, I verify endianness by writing 0x12345678 to the file and
reading it again.


More information about the Fontconfig mailing list