-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Shaw Summa <[email protected]>
- Loading branch information
Showing
10 changed files
with
125 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
|
||
cd $(dirname "$0") | ||
|
||
emcc src/empty/empty.c -o src/empty/empty.js -O3 -flto -s EXPORT_ES6=1 -s EXPORTED_RUNTIME_METHODS=FS,PROXYFS,ERRNO_CODES,allocateUTF8 -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH=1 --no-entry -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$ERRNO_CODES' -s EXPORTED_FUNCTIONS=_main,_free,_malloc -s --js-library=src/empty/fsroot.js -lproxyfs.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* @license | ||
* Copyright 2013 The Emscripten Authors | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
mergeInto(LibraryManager.library, { | ||
$FSROOT__deps: ["$FS"], | ||
$FSROOT__postset: "FSROOT.staticInit();", | ||
$FSROOT: { | ||
staticInit: () => { | ||
FS.root = null; | ||
|
||
let opts = (Module.ROOT && Module.ROOT.opts) || {}; | ||
let type = (Module.ROOT && Module.ROOT.type) || "MEMFS"; | ||
if (typeof type === "string") { | ||
type = FS.filesystems[type] || eval(type); | ||
} else if (typeof type === "function") { | ||
type = type(Module); | ||
} | ||
FS.mount(type, opts, '/'); | ||
|
||
FSROOT.createDefaultMountPoints(); | ||
|
||
// We need to ignore errors in mkdir | ||
// since we are pre-creation mountpoints | ||
// for directories otherwise created by the | ||
// FS.create* functions | ||
const restore_mkdir = FSROOT.safeMkdir(); | ||
|
||
FS.createDefaultDirectories(); | ||
FS.createDefaultDevices(); | ||
FS.createSpecialDirectories(); | ||
|
||
restore_mkdir(); | ||
}, | ||
createDefaultMountPoints: () => { | ||
// Mount a new MEMFS for /dev | ||
FS.mkdirTree("/dev"); | ||
FS.mount(MEMFS, {}, "/dev"); | ||
|
||
// Mount a new MEMFS for /proc/self | ||
FS.mkdirTree('/proc/self'); | ||
FS.mount(MEMFS, {}, '/proc/self'); | ||
}, | ||
safeMkdir: () => { | ||
const mkdir = FS.mkdir; | ||
FS.mkdir = (path, mode) => { | ||
try { | ||
return mkdir(path, mode); | ||
} catch { | ||
// ignore errors | ||
return FS.lookupPath(path, { follow: true }).node; | ||
} | ||
}; | ||
return () => { | ||
FS.mkdir = mkdir; | ||
}; | ||
}, | ||
}, | ||
}); | ||
|
||
DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('$FSROOT'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters