the folder isn't a problem, we can create that (I'd suggest CHDK/TMP)
Note that we can't use the above without finding a working mkstemp in both vxworks and dryos, but we don't actually need to use mkstemp in CHDK, because the main reason that is used is because of security concerns on multi-users sytsems.
for chdk, you just need a unique file name, which you could generate quite easily in lua. (it'll be easier once we have 'stat' in lua)
tmpfile would be more useful, but that requires extra logic for the delete-on-close behavior.
You can see
Signature finder - CHDK Wiki for a description of how signattures_dryos.h is generated.