Commit bd7a2736 authored by jfb's avatar jfb Committed by Commit bot

NaCl documentation: update FAQ and examples

A few updates to the documentation, a developer pointed out some of the docs weren't quite clear.

TBR= sbc@chromium.org, jmedley@chromium.org
BUG=none
TEST=none

Review URL: https://codereview.chromium.org/886163005

Cr-Commit-Position: refs/heads/master@{#315345}
parent 166a9181
...@@ -419,29 +419,37 @@ generally straightforward, with large libraries often requiring no ...@@ -419,29 +419,37 @@ generally straightforward, with large libraries often requiring no
source change.</p> source change.</p>
<p>The following kinds of code may be more challenging to port:</p> <p>The following kinds of code may be more challenging to port:</p>
<ul class="small-gap"> <ul class="small-gap">
<li>Code that does direct TCP/IP or UDP networking. For security reasons <li>Code that does direct <a class="reference external" href="pepper_stable/cpp/classpp_1_1_u_d_p_socket">TCP</a> or
these APIs are only available to packaged applications, not on the <a class="reference external" href="pepper_stable/cpp/classpp_1_1_u_d_p_socket">UDP</a> networking. For security
open web, after asking for the appropriate permissions. Native Client reasons these APIs are only available to <a class="reference external" href="/apps/about_apps">packaged applications</a> after asking for the appropriate permissions, not on the
is otherwise restricted to the networking APIs available in the open web. Native Client is otherwise restricted to the networking APIs
browser.</li> available in the browser. You may want to use to <a class="reference external" href="nacl_io">nacl_io library</a>
<li>Code that creates processes, including UNIX forks. Creating processes to use POSIX-like sockets.</li>
is not supported for security reasons. However, threads are supported.</li> <li>Code that creates processes, including UNIX <code>fork</code>, won&#8217;t function
<li>Code that needs to do local file I/O. Native Client is restricted to as-is. However, threads are supported. You can nonetheless create new
accessing URLs and to local storage in the browser (the Pepper file I/O API <code>&lt;embed&gt;</code> tags in your HTML page to launch new PNaCl processes, even using
has access to the same per-application storage that JavaScript has via Local new <code>.pexe</code> files that your existing <code>.pexe</code> saved in a local
Storage). HTML5 File System can be used, among others. For POSIX compatabiliy filesystem. This is somewhat akin to <code>execve</code>, but the process management
the Native Client SDK includes a library called nacl_io which allows the has to go through <code>postMessage</code> to JavaScript in order to create the new
application to interact with all these types of files via standard POSIX I/O <code>&lt;embed&gt;</code>.</li>
functions (e.g. open/fopen/read/write/...). See <a class="reference internal" href="/native-client/devguide/coding/nacl_io.html"><em>Using NaCl I/O</em></a> for more details.</li> <li>Code that needs to do local file I/O. Native Client is restricted to accessing
URLs and to local storage in the browser (the Pepper <a class="reference internal" href="/native-client/devguide/coding/file-io.html"><em>File IO API</em></a> has access to the same per-application storage that
JavaScript has via Local Storage). HTML5 File System can be used, among
others. For POSIX compatabiliy the Native Client SDK includes a library called
nacl_io which allows the application to interact with all these types of files
via standard POSIX I/O functions (e.g. <code>open</code> / <code>fopen</code> / <code>read</code> /
<code>write</code> / ...). See <a class="reference internal" href="/native-client/devguide/coding/nacl_io.html"><em>Using NaCl I/O</em></a> for more
details.</li>
</ul> </ul>
<h2 id="troubleshooting"><span id="faq-troubleshooting"></span>Troubleshooting</h2> <h2 id="troubleshooting"><span id="faq-troubleshooting"></span>Troubleshooting</h2>
<h3 id="my-pexe-isn-t-loading-help">My <code>.pexe</code> isn&#8217;t loading, help!</h3> <h3 id="my-pexe-isn-t-loading-help">My <code>.pexe</code> isn&#8217;t loading, help!</h3>
<ul class="small-gap"> <ul class="small-gap">
<li>You must use Google Chrome version 31 or greater for Portable Native <li>You must use Google Chrome version 31 or greater for Portable Native
Client. Please <a class="reference external" href="http://www.google.com/chrome/">upgrade now</a> if you are Client. Find your version of chrome by opening <code>about:chrome</code>, and <a class="reference external" href="http://www.google.com/chrome/">update
not. If you&#8217;re already using a recent version, open <code>about:components</code> and Chrome</a> if you are on an older version. If
&#8220;Check for update&#8221; for PNaCl. Find your version of chrome by openning you&#8217;re already using a recent version, open <code>about:components</code> and &#8220;Check
<code>about:chrome</code>.</li> for update&#8221; for PNaCl. Note that on ChromeOS PNaCl is always up to date,
whereas on other operating systems it updates shortly after Chrome updates.</li>
<li>A PNaCl <code>.pexe</code> must be compiled with pepper_31 SDK or higher. <a class="reference internal" href="/native-client/sdk/download.html#updating-bundles"><em>Update <li>A PNaCl <code>.pexe</code> must be compiled with pepper_31 SDK or higher. <a class="reference internal" href="/native-client/sdk/download.html#updating-bundles"><em>Update
your bundles</em></a> and make sure you&#8217;re using a version of your bundles</em></a> and make sure you&#8217;re using a version of
Chrome that matches the SDK version.</li> Chrome that matches the SDK version.</li>
......
...@@ -168,18 +168,19 @@ $ export CHROME_PATH=&lt;Path to Google Chrome&gt; ...@@ -168,18 +168,19 @@ $ export CHROME_PATH=&lt;Path to Google Chrome&gt;
<p>Each example can also be launched as a packaged application. A packaged <p>Each example can also be launched as a packaged application. A packaged
application is a special zip file (with a .crx extension) hosted in the Chrome application is a special zip file (with a .crx extension) hosted in the Chrome
Web Store. This file contains all of the application parts: A Chrome Web Store Web Store. This file contains all of the application parts: A Chrome Web Store
manifest file (manifest.json), an icon, and all of the regular Native Client manifest file (<code>manifest.json</code>), an icon, and all of the regular Native Client
application files. Refer to <a class="reference external" href="/apps/about_apps">What are Chrome Apps</a> for more application files. Refer to <a class="reference external" href="/apps/about_apps">What are Chrome Apps</a> for more
information about creating a packaged application.</p> information about creating a packaged application.</p>
<p>Some Pepper features, such as TCP/UDP socket access, are only allowed in <p>Some Pepper features, such as <a class="reference external" href="pepper_stable/cpp/classpp_1_1_u_d_p_socket">TCP</a> or <a class="reference external" href="pepper_stable/cpp/classpp_1_1_u_d_p_socket">UDP</a> socket access, are only allowed
packaged applications. The examples that use these features must be run as in <a class="reference external" href="/apps/about_apps">packaged applications</a>. The examples that use these
packaged applications, by using the following command:</p> features must be run as <a class="reference external" href="/apps/about_apps">packaged applications</a>, by using
the following command:</p>
<pre class="prettyprint"> <pre class="prettyprint">
$ make run_package $ make run_package
</pre> </pre>
<p>You can use <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters as described above to run <p>You can use <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters as described above to run
with a different toolchain or configuration.</p> with a different toolchain or configuration.</p>
<h2 id="debugging-the-sdk-examples"><span id="id4"></span>Debugging the SDK examples</h2> <h2 id="debugging-the-sdk-examples"><span id="id5"></span>Debugging the SDK examples</h2>
<p>The NaCl SDK uses <a class="reference external" href="https://www.gnu.org/software/gdb/">GDB</a> to debug Native <p>The NaCl SDK uses <a class="reference external" href="https://www.gnu.org/software/gdb/">GDB</a> to debug Native
Client code. The SDK includes a prebuilt version of GDB that is compatible with Client code. The SDK includes a prebuilt version of GDB that is compatible with
NaCl code. To use it, run the <code>make debug</code> command from an example directory:</p> NaCl code. To use it, run the <code>make debug</code> command from an example directory:</p>
......
...@@ -493,21 +493,29 @@ source change. ...@@ -493,21 +493,29 @@ source change.
The following kinds of code may be more challenging to port: The following kinds of code may be more challenging to port:
* Code that does direct TCP/IP or UDP networking. For security reasons * Code that does direct `TCP <pepper_stable/cpp/classpp_1_1_u_d_p_socket>`_ or
these APIs are only available to packaged applications, not on the `UDP <pepper_stable/cpp/classpp_1_1_u_d_p_socket>`_ networking. For security
open web, after asking for the appropriate permissions. Native Client reasons these APIs are only available to `packaged applications
is otherwise restricted to the networking APIs available in the </apps/about_apps>`_ after asking for the appropriate permissions, not on the
browser. open web. Native Client is otherwise restricted to the networking APIs
* Code that creates processes, including UNIX forks. Creating processes available in the browser. You may want to use to `nacl_io library <nacl_io>`_
is not supported for security reasons. However, threads are supported. to use POSIX-like sockets.
* Code that needs to do local file I/O. Native Client is restricted to * Code that creates processes, including UNIX ``fork``, won't function
accessing URLs and to local storage in the browser (the Pepper file I/O API as-is. However, threads are supported. You can nonetheless create new
has access to the same per-application storage that JavaScript has via Local ``<embed>`` tags in your HTML page to launch new PNaCl processes, even using
Storage). HTML5 File System can be used, among others. For POSIX compatabiliy new ``.pexe`` files that your existing ``.pexe`` saved in a local
the Native Client SDK includes a library called nacl_io which allows the filesystem. This is somewhat akin to ``execve``, but the process management
application to interact with all these types of files via standard POSIX I/O has to go through ``postMessage`` to JavaScript in order to create the new
functions (e.g. open/fopen/read/write/...). See :doc:`Using NaCl I/O ``<embed>``.
<devguide/coding/nacl_io>` for more details. * Code that needs to do local file I/O. Native Client is restricted to accessing
URLs and to local storage in the browser (the Pepper :doc:`File IO API
<devguide/coding/file-io>` has access to the same per-application storage that
JavaScript has via Local Storage). HTML5 File System can be used, among
others. For POSIX compatabiliy the Native Client SDK includes a library called
nacl_io which allows the application to interact with all these types of files
via standard POSIX I/O functions (e.g. ``open`` / ``fopen`` / ``read`` /
``write`` / ...). See :doc:`Using NaCl I/O <devguide/coding/nacl_io>` for more
details.
.. _faq_troubleshooting: .. _faq_troubleshooting:
...@@ -518,10 +526,11 @@ My ``.pexe`` isn't loading, help! ...@@ -518,10 +526,11 @@ My ``.pexe`` isn't loading, help!
--------------------------------- ---------------------------------
* You must use Google Chrome version 31 or greater for Portable Native * You must use Google Chrome version 31 or greater for Portable Native
Client. Please `upgrade now <http://www.google.com/chrome/>`_ if you are Client. Find your version of chrome by opening ``about:chrome``, and `update
not. If you're already using a recent version, open ``about:components`` and Chrome <http://www.google.com/chrome/>`_ if you are on an older version. If
"Check for update" for PNaCl. Find your version of chrome by openning you're already using a recent version, open ``about:components`` and "Check
``about:chrome``. for update" for PNaCl. Note that on ChromeOS PNaCl is always up to date,
whereas on other operating systems it updates shortly after Chrome updates.
* A PNaCl ``.pexe`` must be compiled with pepper_31 SDK or higher. :ref:`Update * A PNaCl ``.pexe`` must be compiled with pepper_31 SDK or higher. :ref:`Update
your bundles <updating-bundles>` and make sure you're using a version of your bundles <updating-bundles>` and make sure you're using a version of
Chrome that matches the SDK version. Chrome that matches the SDK version.
......
...@@ -208,13 +208,16 @@ Run the SDK examples as packaged apps ...@@ -208,13 +208,16 @@ Run the SDK examples as packaged apps
Each example can also be launched as a packaged application. A packaged Each example can also be launched as a packaged application. A packaged
application is a special zip file (with a .crx extension) hosted in the Chrome application is a special zip file (with a .crx extension) hosted in the Chrome
Web Store. This file contains all of the application parts: A Chrome Web Store Web Store. This file contains all of the application parts: A Chrome Web Store
manifest file (manifest.json), an icon, and all of the regular Native Client manifest file (``manifest.json``), an icon, and all of the regular Native Client
application files. Refer to `What are Chrome Apps </apps/about_apps>`_ for more application files. Refer to `What are Chrome Apps </apps/about_apps>`_ for more
information about creating a packaged application. information about creating a packaged application.
Some Pepper features, such as TCP/UDP socket access, are only allowed in Some Pepper features, such as `TCP
packaged applications. The examples that use these features must be run as <pepper_stable/cpp/classpp_1_1_u_d_p_socket>`_ or `UDP
packaged applications, by using the following command:: <pepper_stable/cpp/classpp_1_1_u_d_p_socket>`_ socket access, are only allowed
in `packaged applications </apps/about_apps>`_. The examples that use these
features must be run as `packaged applications </apps/about_apps>`_, by using
the following command::
$ make run_package $ make run_package
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment