-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Currently, the corresponding code for mkstemp
, mkostemp
and mkdtemp
is commented out, so any C code relying on those functions fails to compile:
wasi-libc/libc-top-half/musl/include/stdlib.h
Lines 116 to 120 in 5ccfab7
#ifdef __wasilibc_unmodified_upstream /* WASI has no temp directories */ | |
int mkstemp (char *); | |
int mkostemp (char *, int); | |
char *mkdtemp (char *); | |
#endif |
The comment says it's done because WASI doesn't have temporary directories, however (correct me if I'm wrong), unlike tmpfile
, those methods don't need the concept of a system-wide temporary directory.
They accept an explicit filename template, and just generate a unique filename based on it. As such, there's no reason they shouldn't work on WASI.
For example, it should be perfectly possible to create temporary files using template like /mounted-folder/tmp-XXXXXX
where /mounted-folder
is a valid preopen dir.