cleanup, docs
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
file_fsync
|
||||
:sig
|
||||
bool file_fsync(u64 h)
|
||||
|
||||
Filesystem nicety added to the wasm host membrane. Path arguments are policy-gated; operations return an empty value or false on denial/error. file_fsync() takes an open file handle and flushes it with fsync().
|
||||
:params
|
||||
h : handle from file_open() opened for writing
|
||||
return value : true if the flush succeeded
|
||||
|
||||
:content
|
||||
Flushes a handle's buffered writes to disk, so the data survives a crash or power loss. Call it before `file_close()` when durability matters (e.g. after writing a checkpoint).
|
||||
|
||||
:example
|
||||
u64 h = file_open("/tmp/doc-fsync.txt", "w");
|
||||
file_write(h, "durable");
|
||||
print(file_fsync(h) ? "flushed to disk" : "fsync failed", "\n");
|
||||
file_close(h);
|
||||
|
||||
:see
|
||||
>sys
|
||||
|
||||
:example
|
||||
print("file_fsync example\n");
|
||||
file_write
|
||||
file_close
|
||||
|
||||
Reference in New Issue
Block a user