Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/api/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ self-cleaning temporary image instead, while `lib.path` keeps reporting
the virtual path. Libraries on the real file system are unaffected and
load directly.

When using the [Permission Model][], loading a library from a virtual file
system also requires [`--allow-fs-write`][] access to the temporary
directory: the `TMPDIR` environment variable, or `/tmp` if it is unset, on
POSIX, and the directory returned by `GetTempPathW()` on Windows. The path is
matched as given, without resolving symbolic links. This applies even on
platforms where the image is held in memory.

When `definitions` is omitted, `functions` is returned as an empty object until
symbols are resolved explicitly.

Expand Down Expand Up @@ -1052,6 +1059,7 @@ and keep callback and pointer lifetimes explicit on the native side.
[Fast API call path]: #fast-api-call-path
[Permission Model]: permissions.md#permission-model
[`--allow-ffi`]: cli.md#--allow-ffi
[`--allow-fs-write`]: cli.md#--allow-fs-write
[`ffi.dlopen()`]: #ffidlopenpath-definitions
[`ffi.toBuffer(pointer, length, copy)`]: #ffitobufferpointer-length-copy
[`library.functions`]: #libraryfunctions
Expand Down
6 changes: 5 additions & 1 deletion doc/api/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ not constrained by the `fs.read`, `fs.write`, or `net` permission scopes.
Mounting a [virtual file system][] with [`vfs.mount()`][] throws
`ERR_INVALID_STATE` unless the [`--allow-fs-vfs`][] flag is passed. A mounted
VFS serves paths that the file system permissions do not describe, so it is not
gated by [`--allow-fs-read`][] or [`--allow-fs-write`][].
gated by [`--allow-fs-read`][] or [`--allow-fs-write`][]. Loading a native
addon or an [FFI library](ffi.md#ffidlopenpath-definitions) from a mounted VFS
is the exception: the library is copied to a temporary image before it is
loaded, so it also needs [`--allow-fs-write`][] access to the temporary
directory.

#### Runtime API

Expand Down
Loading