kripken/emscripten — pull request #2849 by pkholland (2014-10-01 23:56:13+00:00)
Title: adding support for read-only filesystems

This work mainly permits correct implementations of read-only filesystems by teaching library_fs.js a small amount allowing it to understand when to use EACCES vs. EROFS. This additional logic allows a filesystem implementation to set the 'is_readonly_fs' attribute of directory nodes, and when set MEMFS will use EROFS instead of EACCES for certain access violation cases. In addition to this there is new test code showing one example of how one might implement a read-only filesystem -- in this case populated with simple, static file-like data represented as global char arrays in C. There is a new 'test_fs_rofs' test case in test_core.py which builds and runs the new test_rofs.c test code. The testing code in test_rofs.c is primarily attempting to validate that io operations which would change the file data in the mounted read-only filesystem correctly fail and set errno to EROFS.