我可以在浏览器之外运行 Google 的 Native Client 吗?
是否可以在浏览器之外将 Google NaCl 作为进程沙箱运行?
Is it possible to run Google NaCl outside of the browser as a process sandbox?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的。 Native Client 的独立版本包含一个名为“sel_ldr”的程序,该程序在 Web 浏览器之外运行 NaCl 沙箱。很多 NaCl 的测试套件通过在 sel_ldr 下运行程序而不是在浏览器下运行程序来测试 NaCl。
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.
Native Client文档可能是尝试弄清楚一切如何工作的一个很好的起点。
正如 Mark Seaborn 和 Bennet Yee 指出的那样,您可能最好考虑使用 sel_ldr。有关 sel_ldr 如何包含在“The life of sel_ldr”中的更多详细信息。
我个人还没有在浏览器之外实现任何使用 NaCl 的东西,因此不幸的是我无法评论这样做的难易程度。
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.
要添加到马克的答案,请查看 sel_universal 目标。显然有一些接口是不支持的,例如Pepper接口,因为这样的单机运行不涉及浏览器。此外,我们支持的稳定 ABI 是由“集成运行时”或 irt 公开的,并且 irt 代码 thunk 假定浏览器存在。通过 sel_ldr 独立使用 NaCl 可能最初必须使用系统调用接口,直到写入替代的 irt。 (注意:我们不保证系统调用接口的稳定性。)
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.)
您可以尝试包含在 Native Client 源代码中的
run.py
。这是运行 hello world 程序的示例。
该脚本可以构建、搜索和调用 sel_ldr,并自动向其传递适当的参数。
You can try
run.py
which included in Native Client's source.Here is an example that runs a hello world program.
This script can build, search and invoke
sel_ldr
, and pass proper arguments to it automatically.