Is it possible to run Google NaCl outside of开发者_如何学运维 the browser as a process sandbox?
Yes. The standalone build of Native Client contains a program called "sel_ldr" which runs the NaCl sandbox outside of the web browser. A lot of NaCl's test suite tests NaCl by running programs under sel_ldr rather than under the browser.
The Native Client documentation is probably a good starting point for trying to figure out how everything works.
As Mark Seaborn and Bennet Yee indicate, you are probably best off looking into using sel_ldr. More details about how sel_ldr is included in "The life of sel_ldr".
I haven't personally implemented anything that uses NaCl outside of a browser, so I can't unfortunately comment on the ease of doing so.
To add to Mark's answer, take a look at the sel_universal target. There are obviously some interfaces that cannot be supported, e.g., Pepper interfaces, since such a stand-alone run doesn't involve a browser. Furthermore, the stable ABI that we support is that which is exposed by the "integrated runtime" or irt, and the irt code thunk assumes that the browser is present. a standalone use of NaCl via sel_ldr would probably have to use the syscall interface initially, until an alternate irt is written. (NB: we make no guarantees about the stability of the syscall interface.)
You can try run.py
which included in Native Client's source.
Here is an example that runs a hello world program.
make test_hello_world_nexe
python native_client/run.py out/Debug/hello_world_newlib_x64.nexe
This script can build, search and invoke sel_ldr
, and pass proper arguments to it automatically.
精彩评论