Skip to content

Commit

Permalink
Merge pull request emscripten-core#2 from rstz/restrict-to-filesystem…
Browse files Browse the repository at this point in the history
…access-folder

Restrict PThreadFS to persistent to /filesystemaccess folder
  • Loading branch information
rstz authored Aug 20, 2021
2 parents 90f5f03 + ae696b3 commit 1ef2dda
Show file tree
Hide file tree
Showing 27 changed files with 220 additions and 2,020 deletions.
9 changes: 3 additions & 6 deletions pthreadfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,18 @@ EM_PTHREADFS_ASM(
await PThreadFS.mkdir('mydirectory');
);
```
See `pthreadfs/examples/emscripten-tests/` for exemplary usage.
See `pthreadfs/examples/emscripten-tests/fsafs.cpp` for exemplary usage.


## Known Limitations

- All files to be stored using the file system access Access Handles must be stored in the `/filesystemaccess` folder.
- Files in the `/filesystemaccess` folder cannot interact through syscalls with other files (e.g. moving, copying, etc.).
- The code is still prototype quality and **should not be used in a production environment** yet. It is possible that the use of PThreadFS might lead to subtle bugs in other libraries.
- PThreadFS requires PROXY_TO_PTHREAD to be active. In particular, no system calls interacting with the file system should be called from the main thread.
- Some functionality of the Emscripten File System API is missing, such as sockets, IndexedDB integration and support for XHRequests.
- PThreadFS depends on C++ libraries. `EM_PTRHEADFS_ASM()` cannot be used within C files (although initializing through `emscripten_init_pthreadfs()` is possible, see the `pthreadfs/examples/sqlite-speedtest` for an example).
- Only in-memory storage (MEMFS) and OPFS Access Handles (FSAFS) are available as backends for PThreadFS.

There is no support (yet) for persisting data into IndexedDB (the way IDBFS works). Limited support is available for the Storage Foundation API as backend.
- Performance is good if and only if full optimizations (compiler option `-O3`) are enabled and DevTools are closed.
- Using stdout from C++ only prints to the Javascript console, not the Emscripten-generated html file.


## Examples

Expand Down
58 changes: 0 additions & 58 deletions pthreadfs/examples/emscripten-tests/access.cpp

This file was deleted.

58 changes: 0 additions & 58 deletions pthreadfs/examples/emscripten-tests/access.out

This file was deleted.

48 changes: 0 additions & 48 deletions pthreadfs/examples/emscripten-tests/close.cpp

This file was deleted.

8 changes: 0 additions & 8 deletions pthreadfs/examples/emscripten-tests/close.out

This file was deleted.

114 changes: 0 additions & 114 deletions pthreadfs/examples/emscripten-tests/curdir.cpp

This file was deleted.

32 changes: 0 additions & 32 deletions pthreadfs/examples/emscripten-tests/curdir.out

This file was deleted.

Loading

0 comments on commit 1ef2dda

Please sign in to comment.