Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: native_client_sdk/doc_generated/devguide/coding/nacl_io.html

Issue 618823003: Add debugging information for nacl_io library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fixes. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {{+bindTo:partials.standard_nacl_article}} 1 {{+bindTo:partials.standard_nacl_article}}
2 2
3 <section id="the-nacl-io-library"> 3 <section id="the-nacl-io-library">
4 <span id="nacl-io"></span><h1 id="the-nacl-io-library"><span id="nacl-io"></span >The nacl_io Library</h1> 4 <span id="nacl-io"></span><h1 id="the-nacl-io-library"><span id="nacl-io"></span >The nacl_io Library</h1>
5 <div class="contents local" id="contents" style="display: none"> 5 <div class="contents local" id="contents" style="display: none">
6 <ul class="small-gap"> 6 <ul class="small-gap">
7 <li><a class="reference internal" href="#introduction" id="id1">Introduction</a> </li> 7 <li><a class="reference internal" href="#introduction" id="id1">Introduction</a> </li>
8 <li><a class="reference internal" href="#using-nacl-io" id="id2">Using nacl_io</ a></li> 8 <li><a class="reference internal" href="#using-nacl-io" id="id2">Using nacl_io</ a></li>
9 <li><p class="first"><a class="reference internal" href="#the-nacl-io-demo" id=" id3">The nacl_io demo</a></p> 9 <li><p class="first"><a class="reference internal" href="#the-nacl-io-demo" id=" id3">The nacl_io demo</a></p>
10 <ul class="small-gap"> 10 <ul class="small-gap">
11 <li><a class="reference internal" href="#building-and-running-the-demo" id="id4" >Building and running the demo</a></li> 11 <li><a class="reference internal" href="#building-and-running-the-demo" id="id4" >Building and running the demo</a></li>
12 <li><a class="reference internal" href="#a-look-at-the-code" id="id5">A look at the code</a></li> 12 <li><a class="reference internal" href="#a-look-at-the-code" id="id5">A look at the code</a></li>
13 </ul> 13 </ul>
14 </li> 14 </li>
15 <li><a class="reference internal" href="#reference-information" id="id6">Referen ce information</a></li> 15 <li><a class="reference internal" href="#reference-information" id="id6">Referen ce Information</a></li>
16 </ul> 16 </ul>
17 17
18 </div><h2 id="introduction">Introduction</h2> 18 </div><h2 id="introduction">Introduction</h2>
19 <p><code>nacl_io</code> is a utility library that provides implementations of st andard 19 <p><code>nacl_io</code> is a utility library that provides implementations of st andard
20 C APIs such as POSIX I/O (<code>stdio.h</code>) and BSD sockets (<code>sys/socke t.h</code>). 20 C APIs such as POSIX I/O (<code>stdio.h</code>) and BSD sockets (<code>sys/socke t.h</code>).
21 Its primary function is to allow code that uses these standard APIs to be 21 Its primary function is to allow code that uses these standard APIs to be
22 compiled and used in a Native Client module. The library is included as part 22 compiled and used in a Native Client module. The library is included as part
23 of Native Client SDK and is implemented in on top of Pepper API.</p> 23 of Native Client SDK and is implemented in on top of Pepper API.</p>
24 <p>Since Native Client modules cannot access the host machine&#8217;s file syste m 24 <p>Since Native Client modules cannot access the host machine&#8217;s file syste m
25 directly, nacl_io provides several alternative filesystem types which 25 directly, nacl_io provides several alternative filesystem types which can be
26 can be used by the application. For example, the Chrome browser supports the 26 used by the application. For example, the Chrome browser supports the <a class=" reference external" href="http://www.html5rocks.com/en/tutorials/file/filesystem /">HTML5
27 <a class="reference external" href="http://www.html5rocks.com/en/tutorials/file/ filesystem/">HTML5 File System API</a> which provides 27 File System API</a>
28 access to a protected area of the local file system. This filesystem can 28 which provides access to a protected area of the local file system. This
29 be accessed by an HTML page using JavaScript commands, and also by a Native 29 filesystem can be accessed by an HTML page using JavaScript commands, and also
30 Client module using the Pepper <a class="reference internal" href="/native-clien t/devguide/coding/file-io.html"><em>File IO API</em></a>. With nacl_io 30 by a Native Client module using the Pepper <a class="reference internal" href="/ native-client/devguide/coding/file-io.html"><em>File IO API</em></a>.</p>
31 a Native Client application can mount an HTML5 filesystem and access it via 31 <p>With nacl_io a Native Client application can mount an HTML5 filesystem and
32 standard POSIX I/O function such as <code>fopen</code>, <code>fseek</code>, <cod e>fread</code>, 32 access it via standard POSIX I/O function such as <code>fopen</code>, <code>fsee k</code>,
33 <code>fwrite</code>, and <code>fclose</code>, or their low level UNIX counterpar ts <code>open</code>, 33 <code>fread</code>, <code>fwrite</code>, and <code>fclose</code>, or their low l evel UNIX counterparts
34 <code>lseek</code>, <code>read</code>, <code>write</code> and <code>close</code> .</p> 34 <code>open</code>, <code>lseek</code>, <code>read</code>, <code>write</code> and <code>close</code>. Unlike most input/output
35 for nacl_io, logging writes directly to the <code>stderr</code> stream of the Na Cl
36 process. It deliberately bypasses the standard library functions implemented in
37 nacl_io to avoid circular calls to itself.</p>
35 <p>As well as the HTML5 file system, nacl_io provides several other file system 38 <p>As well as the HTML5 file system, nacl_io provides several other file system
36 types which are described in the table below:</p> 39 types which are described in the table below:</p>
37 <table border="1" class="docutils"> 40 <table border="1" class="docutils">
38 <colgroup> 41 <colgroup>
39 </colgroup> 42 </colgroup>
40 <thead valign="bottom"> 43 <thead valign="bottom">
41 <tr class="row-odd"><th class="head">File System</th> 44 <tr class="row-odd"><th class="head">File System</th>
42 <th class="head">Description</th> 45 <th class="head">Description</th>
43 </tr> 46 </tr>
44 </thead> 47 </thead>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return 2; 199 return 2;
197 } 200 }
198 201
199 bytes_written = fwrite(data, 1, data_len, file); 202 bytes_written = fwrite(data, 1, data_len, file);
200 203
201 *output = PrintfToNewString(&quot;fwrite\1%s\1%d&quot;, file_index_string, 204 *output = PrintfToNewString(&quot;fwrite\1%s\1%d&quot;, file_index_string,
202 bytes_written); 205 bytes_written);
203 return 0; 206 return 0;
204 } 207 }
205 </pre> 208 </pre>
206 <h2 id="reference-information">Reference information</h2> 209 <h2 id="reference-information">Reference Information</h2>
207 <p>The example discussed here is included in the SDK in the directory 210 <p>The example discussed here is included in the SDK in the directory
208 <code>examples/demo/nacl_io_demo</code>.</p> 211 <code>examples/demo/nacl_io_demo</code>.</p>
209 <p>The nacl_io library is included in the SDK toolchain and is not a part of the 212 <p>The nacl_io library is included in the SDK toolchain and is not a part of the
210 Pepper API. For reference information related to the nacl_io interface see 213 Pepper API. For reference information related to the nacl_io interface see
211 its header file in the SDK directory, located at 214 its header file in the SDK directory, located at
212 <code>include/nacl_io/nacl_io.h</code>.</p> 215 <code>include/nacl_io/nacl_io.h</code>.</p>
213 <p>For more about the HTML5 file system read the <a class="reference external" h ref="http://dev.w3.org/2009/dap/file-system/pub/FileSystem/">specification</a>.< /p> 216 <p>For more about the HTML5 file system read the <a class="reference external" h ref="http://dev.w3.org/2009/dap/file-system/pub/FileSystem/">specification</a>.< /p>
214 </section> 217 </section>
215 218
216 {{/partials.standard_nacl_article}} 219 {{/partials.standard_nacl_article}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698