summaryrefslogtreecommitdiff
path: root/native_client_sdk
diff options
context:
space:
mode:
authorPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
committerPrimiano Tucci <primiano@google.com>2014-09-30 14:45:55 +0100
commit1320f92c476a1ad9d19dba2a48c72b75566198e9 (patch)
treeea7f149ccad687b22c18a72b729646568b2d54fb /native_client_sdk
parent39b78c562f50ad7d5551ee861121f899239525a2 (diff)
downloadchromium_org-1320f92c476a1ad9d19dba2a48c72b75566198e9.tar.gz
Merge from Chromium at DEPS revision 267aeeb8d85c
This commit was generated by merge_to_master.py. Change-Id: Id3aac9713b301fae64408cdaee0888724eeb7c0e
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/doc_generated/_static/css/nacl.css17
-rw-r--r--native_client_sdk/doc_generated/_static/pygments.css4
-rw-r--r--native_client_sdk/doc_generated/c-api.html164
-rw-r--r--native_client_sdk/doc_generated/community/index.html4
-rw-r--r--native_client_sdk/doc_generated/community/security-contest/contest-terms.html8
-rw-r--r--native_client_sdk/doc_generated/cpp-api.html128
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/application-structure.html6
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/audio.html4
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/file-io.html4
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/message-system.html6
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/progress-events.html183
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/url-loading.html6
-rw-r--r--native_client_sdk/doc_generated/devguide/coding/view-focus-input-events.html170
-rw-r--r--native_client_sdk/doc_generated/devguide/devcycle/debugging.html76
-rw-r--r--native_client_sdk/doc_generated/devguide/devcycle/dynamic-loading.html83
-rw-r--r--native_client_sdk/doc_generated/devguide/devcycle/running.html92
-rw-r--r--native_client_sdk/doc_generated/devguide/devcycle/vs-addin.html10
-rw-r--r--native_client_sdk/doc_generated/devguide/tutorial/tutorial-part1.html39
-rw-r--r--native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html19
-rw-r--r--native_client_sdk/doc_generated/glossary.html2
-rw-r--r--native_client_sdk/doc_generated/images/nacl-in-a-web-app.pngbin29254 -> 11666 bytes
-rw-r--r--native_client_sdk/doc_generated/images/nacl-pnacl-component-diagram.pngbin25884 -> 27795 bytes
-rw-r--r--native_client_sdk/doc_generated/images/web-app-with-nacl.pngbin18361 -> 13902 bytes
-rw-r--r--native_client_sdk/doc_generated/index.html76
-rw-r--r--native_client_sdk/doc_generated/nacl-and-pnacl.html145
-rw-r--r--native_client_sdk/doc_generated/overview.html310
-rw-r--r--native_client_sdk/doc_generated/pepper_stable/c-api.html171
-rw-r--r--native_client_sdk/doc_generated/pepper_stable/cpp-api.html130
-rw-r--r--native_client_sdk/doc_generated/pepper_stable/index.html4
-rw-r--r--native_client_sdk/doc_generated/sdk/download.html294
-rw-r--r--native_client_sdk/doc_generated/sdk/examples.html272
-rw-r--r--native_client_sdk/doc_generated/sdk/release-notes.html49
-rw-r--r--native_client_sdk/doc_generated/sitemap.html44
-rw-r--r--native_client_sdk/src/README5
-rwxr-xr-xnative_client_sdk/src/build_tools/build_sdk.py48
-rwxr-xr-xnative_client_sdk/src/build_tools/build_updater.py5
-rw-r--r--native_client_sdk/src/build_tools/build_version.py77
-rw-r--r--native_client_sdk/src/build_tools/buildbot_common.py5
-rw-r--r--native_client_sdk/src/build_tools/generate_make.py17
-rw-r--r--native_client_sdk/src/build_tools/json/naclsdk_manifest2.json12
-rw-r--r--native_client_sdk/src/build_tools/sdk_files.list38
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/build_version_test.py113
-rw-r--r--native_client_sdk/src/build_tools/whitespace.txt1
-rw-r--r--native_client_sdk/src/doc/Makefile5
-rw-r--r--native_client_sdk/src/doc/_static/css/nacl.css17
-rw-r--r--native_client_sdk/src/doc/c-api.rst3
-rw-r--r--native_client_sdk/src/doc/community/index.rst7
-rw-r--r--native_client_sdk/src/doc/community/security-contest/contest-terms.rst8
-rw-r--r--native_client_sdk/src/doc/cpp-api.rst3
-rw-r--r--native_client_sdk/src/doc/devguide/coding/application-structure.rst6
-rw-r--r--native_client_sdk/src/doc/devguide/coding/audio.rst4
-rw-r--r--native_client_sdk/src/doc/devguide/coding/file-io.rst4
-rw-r--r--native_client_sdk/src/doc/devguide/coding/message-system.rst6
-rw-r--r--native_client_sdk/src/doc/devguide/coding/progress-events.rst174
-rw-r--r--native_client_sdk/src/doc/devguide/coding/url-loading.rst6
-rw-r--r--native_client_sdk/src/doc/devguide/coding/view-focus-input-events.rst122
-rw-r--r--native_client_sdk/src/doc/devguide/devcycle/debugging.rst66
-rw-r--r--native_client_sdk/src/doc/devguide/devcycle/dynamic-loading.rst52
-rw-r--r--native_client_sdk/src/doc/devguide/devcycle/running.rst98
-rw-r--r--native_client_sdk/src/doc/devguide/devcycle/vs-addin.rst8
-rw-r--r--native_client_sdk/src/doc/devguide/tutorial/tutorial-part1.rst37
-rw-r--r--native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst15
-rw-r--r--native_client_sdk/src/doc/glossary.rst2
-rw-r--r--native_client_sdk/src/doc/images/nacl-in-a-web-app.pngbin29254 -> 11666 bytes
-rw-r--r--native_client_sdk/src/doc/images/nacl-pnacl-component-diagram.pngbin25884 -> 27795 bytes
-rw-r--r--native_client_sdk/src/doc/images/web-app-with-nacl.pngbin18361 -> 13902 bytes
-rw-r--r--native_client_sdk/src/doc/index.rst99
-rw-r--r--native_client_sdk/src/doc/nacl-and-pnacl.rst149
-rw-r--r--native_client_sdk/src/doc/overview.rst322
-rw-r--r--native_client_sdk/src/doc/sdk/download.rst353
-rw-r--r--native_client_sdk/src/doc/sdk/examples.rst319
-rw-r--r--native_client_sdk/src/doc/sdk/release-notes.rst10
-rw-r--r--native_client_sdk/src/doc/sitemap.rst2
-rw-r--r--native_client_sdk/src/examples/api/gamepad/gamepad.cc1
-rw-r--r--native_client_sdk/src/examples/api/url_loader/url_loader_handler.cc1
-rw-r--r--native_client_sdk/src/examples/api/video_decode/video_decode.cc2
-rw-r--r--native_client_sdk/src/examples/tutorial/testing/testing.cc35
-rw-r--r--native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c6
-rw-r--r--native_client_sdk/src/gonacl_appengine/static/frame.js38
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc18
-rw-r--r--native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.h4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/dir_node.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/dir_node.h1
-rw-r--r--native_client_sdk/src/libraries/nacl_io/filesystem.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/filesystem.h20
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fuse.h142
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc55
-rw-r--r--native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.h6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/host_resolver.cc10
-rw-r--r--native_client_sdk/src/libraries/nacl_io/host_resolver.h7
-rw-r--r--native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc44
-rw-r--r--native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.h10
-rw-r--r--native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc16
-rw-r--r--native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc114
-rw-r--r--native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.h5
-rw-r--r--native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc8
-rw-r--r--native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.h3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/sys/poll.h9
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/sys/time.h22
-rw-r--r--native_client_sdk/src/libraries/nacl_io/include/utime.h20
-rw-r--r--native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.cc16
-rw-r--r--native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.h4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc56
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_intercept.h13
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_object.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_object.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc87
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_proxy.h15
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc24
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc34
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc25
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h2
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_wrap_win.cc6
-rw-r--r--native_client_sdk/src/libraries/nacl_io/library.dsc70
-rw-r--r--native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc23
-rw-r--r--native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.h4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc32
-rw-r--r--native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h1
-rw-r--r--native_client_sdk/src/libraries/nacl_io/nacl_io.cc12
-rw-r--r--native_client_sdk/src/libraries/nacl_io/nacl_io.h12
-rw-r--r--native_client_sdk/src/libraries/nacl_io/node.cc14
-rw-r--r--native_client_sdk/src/libraries/nacl_io/node.h3
-rw-r--r--native_client_sdk/src/libraries/nacl_io/ostime.h8
-rw-r--r--native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc10
-rw-r--r--native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.h4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc7
-rw-r--r--native_client_sdk/src/libraries/nacl_io/stream/stream_fs.h4
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/futimes.c11
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/accept.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/accept.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/bind.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/bind.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/connect.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/connect.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/freeaddrinfo.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/freeaddrinfo.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/gai_strerror.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/gai_strerror.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/getaddrinfo.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/getaddrinfo.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/gethostbyname.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/gethostbyname.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/getnameinfo.c20
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/getpeername.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/getpeername.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/getsockname.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/getsockname.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/getsockopt.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/getsockopt.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/herror.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/herror.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/hstrerror.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/hstrerror.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/htonl.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/htonl.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/htons.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/htons.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_addr.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/inet_addr.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_aton.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/inet_aton.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_ntoa.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntoa.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_ntop.cc (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_pton.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/inet_pton.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/listen.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/listen.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/ntohl.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/ntohl.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/ntohs.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/ntohs.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/recv.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/recv.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvfrom.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/recvfrom.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvmsg.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/recvmsg.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/send.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/send.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/sendmsg.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/sendmsg.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/sendto.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/sendto.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/setsockopt.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/setsockopt.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/shutdown.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/shutdown.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/socket.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/socket.c)0
-rw-r--r--native_client_sdk/src/libraries/nacl_io/syscalls/socket/socketpair.c (renamed from native_client_sdk/src/libraries/nacl_io/syscalls/socketpair.c)0
-rw-r--r--native_client_sdk/src/libraries/ppapi/library.dsc1
-rw-r--r--native_client_sdk/src/libraries/ppapi_cpp/library.dsc1
-rw-r--r--native_client_sdk/src/libraries/ppapi_simple/ps.h24
-rw-r--r--native_client_sdk/src/libraries/ppapi_simple/ps_instance.h2
-rw-r--r--native_client_sdk/src/libraries/ppapi_simple/ps_main.cc39
-rw-r--r--native_client_sdk/src/libraries/ppapi_simple/ps_main.h19
-rw-r--r--native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium1
-rw-r--r--native_client_sdk/src/libraries/third_party/newlib-extras/sys/select.h6
-rw-r--r--native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h16
-rw-r--r--native_client_sdk/src/resources/Makefile.example.template14
-rwxr-xr-xnative_client_sdk/src/test_all.py1
-rw-r--r--native_client_sdk/src/tests/nacl_io_socket_test/main.cc18
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/dev_fs_for_testing.h9
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/event_test.cc12
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/filesystem_test.cc67
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc163
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc84
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/http_fs_test.cc57
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/js_fs_test.cc21
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/jspipe_test.cc7
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/kernel_object_test.cc3
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc77
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/kernel_wrap_test.cc94
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/main.cc20
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/mem_fs_node_test.cc34
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/mock_fs.h1
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/mock_kernel_proxy.h14
-rw-r--r--native_client_sdk/src/tests/nacl_io_test/tty_test.cc17
-rw-r--r--native_client_sdk/src/tests/sdk_util_test/main.cc18
-rw-r--r--native_client_sdk/src/tools/common.mk7
-rwxr-xr-xnative_client_sdk/src/tools/genhttpfs.py36
-rwxr-xr-xnative_client_sdk/src/tools/getos.py43
-rwxr-xr-xnative_client_sdk/src/tools/tests/getos_test.py43
196 files changed, 4063 insertions, 2782 deletions
diff --git a/native_client_sdk/doc_generated/_static/css/nacl.css b/native_client_sdk/doc_generated/_static/css/nacl.css
index 9b3a36bd2c..49f8173026 100644
--- a/native_client_sdk/doc_generated/_static/css/nacl.css
+++ b/native_client_sdk/doc_generated/_static/css/nacl.css
@@ -81,6 +81,23 @@ blockquote.indent-only {font-style: normal; color: #000; }
display: block;
margin: 1em auto 0;
}
+#home .left-side {
+ float: left;
+ width: 54%;
+ background-color: #FFF;
+ }
+#home .left-side-inner {
+ padding-right: 40px;
+ }
+#home .pull-quote {
+ background-color: #f5f5f5;
+ border-bottom: 1px solid;
+ border-top: 1px solid;
+ font-size: 14px;
+ float: right;
+ margin: .5em 2em 2em 2em;
+ padding: 1em;
+}
#home .right-side {
float: right;
width: 54%;
diff --git a/native_client_sdk/doc_generated/_static/pygments.css b/native_client_sdk/doc_generated/_static/pygments.css
index d79caa151c..1a14f2ae1a 100644
--- a/native_client_sdk/doc_generated/_static/pygments.css
+++ b/native_client_sdk/doc_generated/_static/pygments.css
@@ -13,11 +13,11 @@
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
-.highlight .go { color: #333333 } /* Generic.Output */
+.highlight .go { color: #303030 } /* Generic.Output */
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-.highlight .gt { color: #0044DD } /* Generic.Traceback */
+.highlight .gt { color: #0040D0 } /* Generic.Traceback */
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
diff --git a/native_client_sdk/doc_generated/c-api.html b/native_client_sdk/doc_generated/c-api.html
new file mode 100644
index 0000000000..42ea3c32f2
--- /dev/null
+++ b/native_client_sdk/doc_generated/c-api.html
@@ -0,0 +1,164 @@
+{{+bindTo:partials.standard_nacl_article}}
+
+<span class="target" id="pepper-stable-c-index"><span id="c-api"></span></span><section id="pepper-c-api-reference-stable">
+<h1 id="pepper-c-api-reference-stable">Pepper C API Reference (Stable)</h1>
+<p>This page lists the C API for Pepper 35. Apps that use this API can
+run in Chrome 35 or higher.</p>
+<h2 id="id1"><a class="reference external" href="group___interfaces.html">Interfaces</a></h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="struct_p_p_b___audio__1__1.html">PPB_Audio</a></li>
+<li><a class="reference external" href="struct_p_p_b___audio_buffer__0__1.html">PPB_AudioBuffer</a></li>
+<li><a class="reference external" href="struct_p_p_b___audio_config__1__1.html">PPB_AudioConfig</a></li>
+<li><a class="reference external" href="struct_p_p_b___console__1__0.html">PPB_Console</a></li>
+<li><a class="reference external" href="struct_p_p_b___core__1__0.html">PPB_Core</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_i_o__1__1.html">PPB_FileIO</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_mapping__0__1.html">PPB_FileMapping</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_ref__1__2.html">PPB_FileRef</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_system__1__0.html">PPB_FileSystem</a></li>
+<li><a class="reference external" href="struct_p_p_b___fullscreen__1__0.html">PPB_Fullscreen</a></li>
+<li><a class="reference external" href="struct_p_p_b___gamepad__1__0.html">PPB_Gamepad</a></li>
+<li><a class="reference external" href="struct_p_p_b___graphics2_d__1__1.html">PPB_Graphics2D</a></li>
+<li><a class="reference external" href="struct_p_p_b___graphics3_d__1__0.html">PPB_Graphics3D</a></li>
+<li><a class="reference external" href="struct_p_p_b___host_resolver__1__0.html">PPB_HostResolver</a></li>
+<li><a class="reference external" href="struct_p_p_b___i_m_e_input_event__1__0.html">PPB_IMEInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___image_data__1__0.html">PPB_ImageData</a></li>
+<li><a class="reference external" href="struct_p_p_b___input_event__1__0.html">PPB_InputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___instance__1__0.html">PPB_Instance</a></li>
+<li><a class="reference external" href="struct_p_p_b___keyboard_input_event__1__2.html">PPB_KeyboardInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___media_stream_audio_track__0__1.html">PPB_MediaStreamAudioTrack</a></li>
+<li><a class="reference external" href="struct_p_p_b___media_stream_video_track__0__1.html">PPB_MediaStreamVideoTrack</a></li>
+<li><a class="reference external" href="struct_p_p_b___message_loop__1__0.html">PPB_MessageLoop</a></li>
+<li><a class="reference external" href="struct_p_p_b___messaging__1__0.html">PPB_Messaging</a></li>
+<li><a class="reference external" href="struct_p_p_b___mouse_cursor__1__0.html">PPB_MouseCursor</a></li>
+<li><a class="reference external" href="struct_p_p_b___mouse_input_event__1__1.html">PPB_MouseInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___mouse_lock__1__0.html">PPB_MouseLock</a></li>
+<li><a class="reference external" href="struct_p_p_b___net_address__1__0.html">PPB_NetAddress</a></li>
+<li><a class="reference external" href="struct_p_p_b___network_list__1__0.html">PPB_NetworkList</a></li>
+<li><a class="reference external" href="struct_p_p_b___network_monitor__1__0.html">PPB_NetworkMonitor</a></li>
+<li><a class="reference external" href="struct_p_p_b___network_proxy__1__0.html">PPB_NetworkProxy</a></li>
+<li><a class="reference external" href="struct_p_p_b___t_c_p_socket__1__1.html">PPB_TCPSocket</a></li>
+<li><a class="reference external" href="struct_p_p_b___text_input_controller__1__0.html">PPB_TextInputController</a></li>
+<li><a class="reference external" href="struct_p_p_b___touch_input_event__1__0.html">PPB_TouchInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_d_p_socket__1__0.html">PPB_UDPSocket</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_r_l_loader__1__0.html">PPB_URLLoader</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_r_l_request_info__1__0.html">PPB_URLRequestInfo</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_r_l_response_info__1__0.html">PPB_URLResponseInfo</a></li>
+<li><a class="reference external" href="struct_p_p_b___var__1__2.html">PPB_Var</a></li>
+<li><a class="reference external" href="struct_p_p_b___var_array__1__0.html">PPB_VarArray</a></li>
+<li><a class="reference external" href="struct_p_p_b___var_array_buffer__1__0.html">PPB_VarArrayBuffer</a></li>
+<li><a class="reference external" href="struct_p_p_b___var_dictionary__1__0.html">PPB_VarDictionary</a></li>
+<li><a class="reference external" href="struct_p_p_b___video_frame__0__1.html">PPB_VideoFrame</a></li>
+<li><a class="reference external" href="struct_p_p_b___view__1__1.html">PPB_View</a></li>
+<li><a class="reference external" href="struct_p_p_b___web_socket__1__0.html">PPB_WebSocket</a></li>
+<li><a class="reference external" href="struct_p_p_b___wheel_input_event__1__0.html">PPB_WheelInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_p___graphics3_d__1__0.html">PPP_Graphics3D</a></li>
+<li><a class="reference external" href="struct_p_p_p___input_event__0__1.html">PPP_InputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_p___instance__1__1.html">PPP_Instance</a></li>
+<li><a class="reference external" href="struct_p_p_p___messaging__1__0.html">PPP_Messaging</a></li>
+<li><a class="reference external" href="struct_p_p_p___mouse_lock__1__0.html">PPP_MouseLock</a></li>
+</ul>
+</div></blockquote>
+<h2 id="id2"><a class="reference external" href="group___structs.html">Structures</a></h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="struct_p_p___array_output.html">PP_ArrayOutput</a></li>
+<li><a class="reference external" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a></li>
+<li><a class="reference external" href="struct_p_p___directory_entry.html">PP_DirectoryEntry</a></li>
+<li><a class="reference external" href="struct_p_p___file_info.html">PP_FileInfo</a></li>
+<li><a class="reference external" href="struct_p_p___float_point.html">PP_FloatPoint</a></li>
+<li><a class="reference external" href="struct_p_p___gamepad_sample_data.html">PP_GamepadSampleData</a></li>
+<li><a class="reference external" href="struct_p_p___gamepads_sample_data.html">PP_GamepadsSampleData</a></li>
+<li><a class="reference external" href="struct_p_p___host_resolver___hint.html">PP_HostResolver_Hint</a></li>
+<li><a class="reference external" href="struct_p_p___image_data_desc.html">PP_ImageDataDesc</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___character.html">PP_InputEvent_Character</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___key.html">PP_InputEvent_Key</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___mouse.html">PP_InputEvent_Mouse</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___wheel.html">PP_InputEvent_Wheel</a></li>
+<li><a class="reference external" href="struct_p_p___net_address___i_pv4.html">PP_NetAddress_IPv4</a></li>
+<li><a class="reference external" href="struct_p_p___net_address___i_pv6.html">PP_NetAddress_IPv6</a></li>
+<li><a class="reference external" href="struct_p_p___point.html">PP_Point</a></li>
+<li><a class="reference external" href="struct_p_p___rect.html">PP_Rect</a></li>
+<li><a class="reference external" href="struct_p_p___size.html">PP_Size</a></li>
+<li><a class="reference external" href="struct_p_p___touch_point.html">PP_TouchPoint</a></li>
+<li><a class="reference external" href="struct_p_p___var.html">PP_Var</a></li>
+<li><a class="reference external" href="union_p_p___var_value.html">PP_VarValue</a></li>
+</ul>
+</div></blockquote>
+<h2 id="id3"><a class="reference external" href="group___functions.html">Functions</a></h2>
+<h2 id="id4"><a class="reference external" href="group___enums.html">Enums</a></h2>
+<h2 id="id5"><a class="reference external" href="group___typedefs.html">Typedefs</a></h2>
+<h2 id="id6"><a class="reference external" href="globals_defs.html">Macros</a></h2>
+<h2 id="files">Files</h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="pp__array__output_8h.html">pp_array_output.h</a></li>
+<li><a class="reference external" href="pp__bool_8h.html">pp_bool.h</a></li>
+<li><a class="reference external" href="pp__completion__callback_8h.html">pp_completion_callback.h</a></li>
+<li><a class="reference external" href="pp__directory__entry_8h.html">pp_directory_entry.h</a></li>
+<li><a class="reference external" href="pp__errors_8h.html">pp_errors.h</a></li>
+<li><a class="reference external" href="pp__file__info_8h.html">pp_file_info.h</a></li>
+<li><a class="reference external" href="pp__graphics__3d_8h.html">pp_graphics_3d.h</a></li>
+<li><a class="reference external" href="pp__input__event_8h.html">pp_input_event.h</a></li>
+<li><a class="reference external" href="pp__instance_8h.html">pp_instance.h</a></li>
+<li><a class="reference external" href="pp__module_8h.html">pp_module.h</a></li>
+<li><a class="reference external" href="pp__point_8h.html">pp_point.h</a></li>
+<li><a class="reference external" href="pp__rect_8h.html">pp_rect.h</a></li>
+<li><a class="reference external" href="pp__resource_8h.html">pp_resource.h</a></li>
+<li><a class="reference external" href="pp__size_8h.html">pp_size.h</a></li>
+<li><a class="reference external" href="pp__stdint_8h.html">pp_stdint.h</a></li>
+<li><a class="reference external" href="pp__time_8h.html">pp_time.h</a></li>
+<li><a class="reference external" href="pp__touch__point_8h.html">pp_touch_point.h</a></li>
+<li><a class="reference external" href="pp__var_8h.html">pp_var.h</a></li>
+<li><a class="reference external" href="ppb_8h.html">ppb.h</a></li>
+<li><a class="reference external" href="ppb__audio_8h.html">ppb_audio.h</a></li>
+<li><a class="reference external" href="ppb__audio__buffer_8h.html">ppb_audio_buffer.h</a></li>
+<li><a class="reference external" href="ppb__audio__config_8h.html">ppb_audio_config.h</a></li>
+<li><a class="reference external" href="ppb__console_8h.html">ppb_console.h</a></li>
+<li><a class="reference external" href="ppb__core_8h.html">ppb_core.h</a></li>
+<li><a class="reference external" href="ppb__file__io_8h.html">ppb_file_io.h</a></li>
+<li><a class="reference external" href="ppb__file__mapping_8h.html">ppb_file_mapping.h</a></li>
+<li><a class="reference external" href="ppb__file__ref_8h.html">ppb_file_ref.h</a></li>
+<li><a class="reference external" href="ppb__file__system_8h.html">ppb_file_system.h</a></li>
+<li><a class="reference external" href="ppb__fullscreen_8h.html">ppb_fullscreen.h</a></li>
+<li><a class="reference external" href="ppb__gamepad_8h.html">ppb_gamepad.h</a></li>
+<li><a class="reference external" href="ppb__graphics__2d_8h.html">ppb_graphics_2d.h</a></li>
+<li><a class="reference external" href="ppb__graphics__3d_8h.html">ppb_graphics_3d.h</a></li>
+<li><a class="reference external" href="ppb__host__resolver_8h.html">ppb_host_resolver.h</a></li>
+<li><a class="reference external" href="ppb__image__data_8h.html">ppb_image_data.h</a></li>
+<li><a class="reference external" href="ppb__input__event_8h.html">ppb_input_event.h</a></li>
+<li><a class="reference external" href="ppb__instance_8h.html">ppb_instance.h</a></li>
+<li><a class="reference external" href="ppb__media__stream__audio__track_8h.html">ppb_media_stream_audio_track.h</a></li>
+<li><a class="reference external" href="ppb__media__stream__video__track_8h.html">ppb_media_stream_video_track.h</a></li>
+<li><a class="reference external" href="ppb__message__loop_8h.html">ppb_message_loop.h</a></li>
+<li><a class="reference external" href="ppb__messaging_8h.html">ppb_messaging.h</a></li>
+<li><a class="reference external" href="ppb__mouse__cursor_8h.html">ppb_mouse_cursor.h</a></li>
+<li><a class="reference external" href="ppb__mouse__lock_8h.html">ppb_mouse_lock.h</a></li>
+<li><a class="reference external" href="ppb__net__address_8h.html">ppb_net_address.h</a></li>
+<li><a class="reference external" href="ppb__network__list_8h.html">ppb_network_list.h</a></li>
+<li><a class="reference external" href="ppb__network__monitor_8h.html">ppb_network_monitor.h</a></li>
+<li><a class="reference external" href="ppb__network__proxy_8h.html">ppb_network_proxy.h</a></li>
+<li><a class="reference external" href="ppb__tcp__socket_8h.html">ppb_tcp_socket.h</a></li>
+<li><a class="reference external" href="ppb__text__input__controller_8h.html">ppb_text_input_controller.h</a></li>
+<li><a class="reference external" href="ppb__udp__socket_8h.html">ppb_udp_socket.h</a></li>
+<li><a class="reference external" href="ppb__url__loader_8h.html">ppb_url_loader.h</a></li>
+<li><a class="reference external" href="ppb__url__request__info_8h.html">ppb_url_request_info.h</a></li>
+<li><a class="reference external" href="ppb__url__response__info_8h.html">ppb_url_response_info.h</a></li>
+<li><a class="reference external" href="ppb__var_8h.html">ppb_var.h</a></li>
+<li><a class="reference external" href="ppb__var__array_8h.html">ppb_var_array.h</a></li>
+<li><a class="reference external" href="ppb__var__array__buffer_8h.html">ppb_var_array_buffer.h</a></li>
+<li><a class="reference external" href="ppb__var__dictionary_8h.html">ppb_var_dictionary.h</a></li>
+<li><a class="reference external" href="ppb__video__frame_8h.html">ppb_video_frame.h</a></li>
+<li><a class="reference external" href="ppb__view_8h.html">ppb_view.h</a></li>
+<li><a class="reference external" href="ppb__websocket_8h.html">ppb_websocket.h</a></li>
+<li><a class="reference external" href="ppp_8h.html">ppp.h</a></li>
+<li><a class="reference external" href="ppp__graphics__3d_8h.html">ppp_graphics_3d.h</a></li>
+<li><a class="reference external" href="ppp__input__event_8h.html">ppp_input_event.h</a></li>
+<li><a class="reference external" href="ppp__instance_8h.html">ppp_instance.h</a></li>
+<li><a class="reference external" href="ppp__messaging_8h.html">ppp_messaging.h</a></li>
+<li><a class="reference external" href="ppp__mouse__lock_8h.html">ppp_mouse_lock.h</a></li>
+</ul>
+</div></blockquote>
+</section>
+
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/community/index.html b/native_client_sdk/doc_generated/community/index.html
index e8bb5031bb..9f7cfb677e 100644
--- a/native_client_sdk/doc_generated/community/index.html
+++ b/native_client_sdk/doc_generated/community/index.html
@@ -3,8 +3,8 @@
<section id="community">
<span id="id1"></span><h1 id="community"><span id="id1"></span>Community</h1>
<p>This section contains pages related to the Native Client <em>community</em> - both
-<strong>implementors</strong> (contributors to the <a class="reference external" href="nacl_project_">open-source Native Client project</a>) and <strong>developers</strong>, who use Native Client to develop web
-applications.</p>
+<strong>implementors</strong> (contributors to the <a class="reference external" href="https://code.google.com/p/nativeclient/">open-source Native Client project</a>) and
+<strong>developers</strong>, who use Native Client to develop web applications.</p>
<p>For a list of active forums where you can ask questions, check the
<a class="reference internal" href="/native-client/help.html#help"><em>help page</em></a>.</p>
</section>
diff --git a/native_client_sdk/doc_generated/community/security-contest/contest-terms.html b/native_client_sdk/doc_generated/community/security-contest/contest-terms.html
index d18b617bc3..d3b92bc603 100644
--- a/native_client_sdk/doc_generated/community/security-contest/contest-terms.html
+++ b/native_client_sdk/doc_generated/community/security-contest/contest-terms.html
@@ -55,7 +55,7 @@ evaluated as a winning exploit by the Judges.</p>
will be asked to identify security Exploits in Google’s Native
Client Software and enter those Exploits on Google’s <a class="reference external" href="http://code.google.com/p/nativeclient/issues/list">Native Client
Issue Tracker</a>
-web site using the &#8220;Security Contest Template.&#8221; At this point, the
+website using the &#8220;Security Contest Template.&#8221; At this point, the
Exploit will become an Issue and will no longer be able to be
identified by another Participant. Google will then verify that the
Issue is reproducible. If so, that Issue will become a Verified
@@ -714,14 +714,14 @@ applicable local law in Participant&#8217;s country of residence.</p>
<p>Google further reserves the right to disqualify any Participant
who tampers with the submission process or any other part of the
Contest. Any attempt by a Participant to deliberately damage any
-web site or undermine the legitimate operation of the Contest is
+website or undermine the legitimate operation of the Contest is
a violation of criminal and civil laws and should such an
attempt be made, Google reserves the right to seek damages from
any such Participant to the fullest extent of the applicable
law.</p>
</li>
<li><p class="first">Internet Disclaimer. Google is not responsible for any
-malfunction of the entire Contest, the web site displaying the
+malfunction of the entire Contest, the website displaying the
Contest terms and entry information, or any late, lost, damaged,
misdirected, incomplete, illegible, undeliverable, or destroyed
Exploits, Issues or Summaries due to system errors, failed,
@@ -731,7 +731,7 @@ kind, lost or unavailable network connections, typographical or
system/human errors and failures, technical malfunction(s) of
any telephone network or lines, cable connections, satellite
transmissions, servers or providers, or computer equipment,
-traffic congestion on the Internet or at the web site displaying
+traffic congestion on the Internet or at the website displaying
the Contest or any combination thereof, including other
telecommunication, cable, digital or satellite malfunctions
which may limit an entrant’s ability to participate. Google is
diff --git a/native_client_sdk/doc_generated/cpp-api.html b/native_client_sdk/doc_generated/cpp-api.html
new file mode 100644
index 0000000000..f262379e13
--- /dev/null
+++ b/native_client_sdk/doc_generated/cpp-api.html
@@ -0,0 +1,128 @@
+{{+bindTo:partials.standard_nacl_article}}
+
+<span class="target" id="pepper-stable-cpp-index"><span id="cpp-api"></span></span><section id="pepper-c-api-reference-stable">
+<h1 id="pepper-c-api-reference-stable">Pepper C++ API Reference (Stable)</h1>
+<p>This page lists the C++ API for Pepper 35. Apps that use this API can
+run in Chrome 35 or higher.</p>
+<h2 id="id1"><a class="reference external" href="inherits.html">Classes</a></h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="classpp_1_1_audio.html">Audio</a></li>
+<li><a class="reference external" href="classpp_1_1_audio_buffer.html">AudioBuffer</a></li>
+<li><a class="reference external" href="classpp_1_1_audio_config.html">AudioConfig</a></li>
+<li><a class="reference external" href="classpp_1_1_completion_callback.html">CompletionCallback</a></li>
+<li><a class="reference external" href="classpp_1_1_completion_callback_factory.html">CompletionCallbackFactory</a></li>
+<li><a class="reference external" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a></li>
+<li><a class="reference external" href="classpp_1_1_core.html">Core</a></li>
+<li><a class="reference external" href="classpp_1_1_directory_entry.html">DirectoryEntry</a></li>
+<li><a class="reference external" href="classpp_1_1_file_i_o.html">FileIO</a></li>
+<li><a class="reference external" href="classpp_1_1_file_ref.html">FileRef</a></li>
+<li><a class="reference external" href="classpp_1_1_file_system.html">FileSystem</a></li>
+<li><a class="reference external" href="classpp_1_1_float_point.html">FloatPoint</a></li>
+<li><a class="reference external" href="classpp_1_1_fullscreen.html">Fullscreen</a></li>
+<li><a class="reference external" href="classpp_1_1_graphics2_d.html">Graphics2D</a></li>
+<li><a class="reference external" href="classpp_1_1_graphics3_d.html">Graphics3D</a></li>
+<li><a class="reference external" href="classpp_1_1_graphics3_d_client.html">Graphics3DClient</a></li>
+<li><a class="reference external" href="classpp_1_1_host_resolver.html">HostResolver</a></li>
+<li><a class="reference external" href="classpp_1_1_i_m_e_input_event.html">IMEInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_image_data.html">ImageData</a></li>
+<li><a class="reference external" href="classpp_1_1_input_event.html">InputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_instance.html">Instance</a></li>
+<li><a class="reference external" href="classpp_1_1_instance_handle.html">InstanceHandle</a></li>
+<li><a class="reference external" href="classpp_1_1_keyboard_input_event.html">KeyboardInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_media_stream_audio_track.html">MediaStreamAudioTrack</a></li>
+<li><a class="reference external" href="classpp_1_1_media_stream_video_track.html">MediaStreamVideoTrack</a></li>
+<li><a class="reference external" href="classpp_1_1_message_loop.html">MessageLoop</a></li>
+<li><a class="reference external" href="classpp_1_1_module.html">Module</a></li>
+<li><a class="reference external" href="classpp_1_1_mouse_cursor.html">MouseCursor</a></li>
+<li><a class="reference external" href="classpp_1_1_mouse_input_event.html">MouseInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_mouse_lock.html">MouseLock</a></li>
+<li><a class="reference external" href="classpp_1_1_net_address.html">NetAddress</a></li>
+<li><a class="reference external" href="classpp_1_1_network_list.html">NetworkList</a></li>
+<li><a class="reference external" href="classpp_1_1_network_monitor.html">NetworkMonitor</a></li>
+<li><a class="reference external" href="classpp_1_1_network_proxy.html">NetworkProxy</a></li>
+<li><a class="reference external" href="classpp_1_1_point.html">Point</a></li>
+<li><a class="reference external" href="classpp_1_1_rect.html">Rect</a></li>
+<li><a class="reference external" href="classpp_1_1_resource.html">Resource</a></li>
+<li><a class="reference external" href="classpp_1_1_size.html">Size</a></li>
+<li><a class="reference external" href="classpp_1_1_t_c_p_socket.html">TCPSocket</a></li>
+<li><a class="reference external" href="classpp_1_1_text_input_controller.html">TextInputController</a></li>
+<li><a class="reference external" href="classpp_1_1_touch_input_event.html">TouchInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_touch_point.html">TouchPoint</a></li>
+<li><a class="reference external" href="classpp_1_1_u_d_p_socket.html">UDPSocket</a></li>
+<li><a class="reference external" href="classpp_1_1_u_r_l_loader.html">URLLoader</a></li>
+<li><a class="reference external" href="classpp_1_1_u_r_l_request_info.html">URLRequestInfo</a></li>
+<li><a class="reference external" href="classpp_1_1_u_r_l_response_info.html">URLResponseInfo</a></li>
+<li><a class="reference external" href="classpp_1_1_var.html">Var</a></li>
+<li><a class="reference external" href="classpp_1_1_var_1_1_out_exception.html">Var11OutException</a></li>
+<li><a class="reference external" href="classpp_1_1_var_array.html">VarArray</a></li>
+<li><a class="reference external" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a></li>
+<li><a class="reference external" href="classpp_1_1_var_dictionary.html">VarDictionary</a></li>
+<li><a class="reference external" href="classpp_1_1_video_frame.html">VideoFrame</a></li>
+<li><a class="reference external" href="classpp_1_1_view.html">View</a></li>
+<li><a class="reference external" href="classpp_1_1_web_socket.html">WebSocket</a></li>
+<li><a class="reference external" href="classpp_1_1_wheel_input_event.html">WheelInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1ext_1_1_ext_completion_callback_with_output.html">Ext::ExtCompletionCallbackWithOutput</a></li>
+<li><a class="reference external" href="classpp_1_1internal_1_1_completion_callback_with_output_base.html">Internal::CompletionCallbackWithOutputBase</a></li>
+<li><a class="reference external" href="classpp_1_1internal_1_1_directory_entry_array_output_adapter_with_storage.html">Internal::DirectoryEntryArrayOutputAdapterWithStorage</a></li>
+</ul>
+</div></blockquote>
+<h2 id="files">Files</h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="audio_8h.html">audio.h</a></li>
+<li><a class="reference external" href="audio__buffer_8h.html">audio_buffer.h</a></li>
+<li><a class="reference external" href="audio__config_8h.html">audio_config.h</a></li>
+<li><a class="reference external" href="completion__callback_8h.html">completion_callback.h</a></li>
+<li><a class="reference external" href="completion__callback__factory_8h.html">completion_callback_factory.h</a></li>
+<li><a class="reference external" href="core_8h.html">core.h</a></li>
+<li><a class="reference external" href="directory__entry_8h.html">directory_entry.h</a></li>
+<li><a class="reference external" href="file__io_8h.html">file_io.h</a></li>
+<li><a class="reference external" href="file__ref_8h.html">file_ref.h</a></li>
+<li><a class="reference external" href="file__system_8h.html">file_system.h</a></li>
+<li><a class="reference external" href="fullscreen_8h.html">fullscreen.h</a></li>
+<li><a class="reference external" href="graphics__2d_8h.html">graphics_2d.h</a></li>
+<li><a class="reference external" href="graphics__3d_8h.html">graphics_3d.h</a></li>
+<li><a class="reference external" href="graphics__3d__client_8h.html">graphics_3d_client.h</a></li>
+<li><a class="reference external" href="host__resolver_8h.html">host_resolver.h</a></li>
+<li><a class="reference external" href="image__data_8h.html">image_data.h</a></li>
+<li><a class="reference external" href="input__event_8h.html">input_event.h</a></li>
+<li><a class="reference external" href="instance_8h.html">instance.h</a></li>
+<li><a class="reference external" href="instance__handle_8h.html">instance_handle.h</a></li>
+<li><a class="reference external" href="logging_8h.html">logging.h</a></li>
+<li><a class="reference external" href="media__stream__audio__track_8h.html">media_stream_audio_track.h</a></li>
+<li><a class="reference external" href="media__stream__video__track_8h.html">media_stream_video_track.h</a></li>
+<li><a class="reference external" href="message__loop_8h.html">message_loop.h</a></li>
+<li><a class="reference external" href="module_8h.html">module.h</a></li>
+<li><a class="reference external" href="module__embedder_8h.html">module_embedder.h</a></li>
+<li><a class="reference external" href="module__impl_8h.html">module_impl.h</a></li>
+<li><a class="reference external" href="mouse__cursor_8h.html">mouse_cursor.h</a></li>
+<li><a class="reference external" href="mouse__lock_8h.html">mouse_lock.h</a></li>
+<li><a class="reference external" href="net__address_8h.html">net_address.h</a></li>
+<li><a class="reference external" href="network__list_8h.html">network_list.h</a></li>
+<li><a class="reference external" href="network__monitor_8h.html">network_monitor.h</a></li>
+<li><a class="reference external" href="network__proxy_8h.html">network_proxy.h</a></li>
+<li><a class="reference external" href="pass__ref_8h.html">pass_ref.h</a></li>
+<li><a class="reference external" href="point_8h.html">point.h</a></li>
+<li><a class="reference external" href="rect_8h.html">rect.h</a></li>
+<li><a class="reference external" href="resource_8h.html">resource.h</a></li>
+<li><a class="reference external" href="size_8h.html">size.h</a></li>
+<li><a class="reference external" href="tcp__socket_8h.html">tcp_socket.h</a></li>
+<li><a class="reference external" href="text__input__controller_8h.html">text_input_controller.h</a></li>
+<li><a class="reference external" href="touch__point_8h.html">touch_point.h</a></li>
+<li><a class="reference external" href="udp__socket_8h.html">udp_socket.h</a></li>
+<li><a class="reference external" href="url__loader_8h.html">url_loader.h</a></li>
+<li><a class="reference external" href="url__request__info_8h.html">url_request_info.h</a></li>
+<li><a class="reference external" href="url__response__info_8h.html">url_response_info.h</a></li>
+<li><a class="reference external" href="var_8h.html">var.h</a></li>
+<li><a class="reference external" href="var__array_8h.html">var_array.h</a></li>
+<li><a class="reference external" href="var__array__buffer_8h.html">var_array_buffer.h</a></li>
+<li><a class="reference external" href="var__dictionary_8h.html">var_dictionary.h</a></li>
+<li><a class="reference external" href="video__frame_8h.html">video_frame.h</a></li>
+<li><a class="reference external" href="view_8h.html">view.h</a></li>
+<li><a class="reference external" href="websocket_8h.html">websocket.h</a></li>
+</ul>
+</div></blockquote>
+</section>
+
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/devguide/coding/application-structure.html b/native_client_sdk/doc_generated/devguide/coding/application-structure.html
index 33912745ad..f53fd4e18b 100644
--- a/native_client_sdk/doc_generated/devguide/coding/application-structure.html
+++ b/native_client_sdk/doc_generated/devguide/coding/application-structure.html
@@ -11,8 +11,8 @@
<li><a class="reference internal" href="#native-client-modules-a-closer-look" id="id5">Native Client modules: A closer look</a></li>
</ul>
-</div><p>This chapter of the Developer&#8217;s Guide describes the general structure of a
-Native Client application. The chapter assumes you are familiar with the
+</div><p>This section of the Developer&#8217;s Guide describes the general structure of a
+Native Client application. The section assumes you are familiar with the
material presented in the <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a>.</p>
<aside class="note">
The &#8220;Hello, World&#8221; example is used here to illustrate basic
@@ -204,7 +204,7 @@ issue a <code>crash</code> event
<a class="reference internal" href="/native-client/devguide/coding/progress-events.html"><em>which can be handled in Javascript</em></a>.</p>
<p>While the <code>CreateModule()</code> factory function, the <code>Module</code> class, and the
<code>Instance</code> class are required for a Native Client application, the code
-samples shown above don&#8217;t actually do anything. Subsequent chapters in the
+samples shown above don&#8217;t actually do anything. Subsequent sections in the
Developer&#8217;s Guide build on these code samples and add more interesting
functionality.</p>
</section>
diff --git a/native_client_sdk/doc_generated/devguide/coding/audio.html b/native_client_sdk/doc_generated/devguide/coding/audio.html
index 875ae1526f..6177b5c1c0 100644
--- a/native_client_sdk/doc_generated/devguide/coding/audio.html
+++ b/native_client_sdk/doc_generated/devguide/coding/audio.html
@@ -24,7 +24,7 @@
<li><a class="reference internal" href="#starting-and-stopping-playback" id="id12">Starting and stopping playback</a></li>
</ul>
-</div><p>This chapter describes how to use the Pepper audio API to play an audio
+</div><p>This section describes how to use the Pepper audio API to play an audio
stream. The Pepper audio API provides a low-level means of playing a stream of
audio samples generated by a Native Client module. The API generally works as
follows: A Native Client module creates an audio resource that represents an
@@ -32,7 +32,7 @@ audio stream, and tells the browser to start or stop playing the audio
resource. The browser calls a function in the Native Client module to fill a
buffer with audio samples every time it needs data to play from the audio
stream.</p>
-<p>The code examples in this chapter describe a simple Native Client module that
+<p>The code examples in this section describe a simple Native Client module that
generates audio samples using a sine wave with a frequency of 440 Hz. The module
starts playing the audio samples as soon as it is loaded into the browser. For a
slightly more sophisticated example, see the <code>audio</code> example (source code in
diff --git a/native_client_sdk/doc_generated/devguide/coding/file-io.html b/native_client_sdk/doc_generated/devguide/coding/file-io.html
index ac784c51d4..571415f2c2 100644
--- a/native_client_sdk/doc_generated/devguide/coding/file-io.html
+++ b/native_client_sdk/doc_generated/devguide/coding/file-io.html
@@ -36,7 +36,7 @@
</ul>
</div><h2 id="introduction">Introduction</h2>
-<p>This chapter describes how to use the <a class="reference external" href="/native-client/pepper_stable/cpp/classpp_1_1_file_i_o">FileIO API</a> to read and write
+<p>This section describes how to use the <a class="reference external" href="/native-client/pepper_stable/cpp/classpp_1_1_file_i_o">FileIO API</a> to read and write
files using a local secure data store.</p>
<p>You might use the File IO API with the URL Loading APIs to create an overall
data download and caching solution for your NaCl applications. For example:</p>
@@ -50,7 +50,7 @@ file from the server.</li>
<li>Load the file into memory using the File IO API when needed by your
application.</li>
</ol>
-<p>The example discussed in this chapter is included in the SDK in the directory
+<p>The example discussed in this section is included in the SDK in the directory
<code>examples/api/file_io</code>.</p>
<h2 id="reference-information">Reference information</h2>
<p>For reference information related to FileIO, see the following documentation:</p>
diff --git a/native_client_sdk/doc_generated/devguide/coding/message-system.html b/native_client_sdk/doc_generated/devguide/coding/message-system.html
index a93ab07751..f3013ae295 100644
--- a/native_client_sdk/doc_generated/devguide/coding/message-system.html
+++ b/native_client_sdk/doc_generated/devguide/coding/message-system.html
@@ -31,13 +31,13 @@
</li>
</ul>
-</div><p>This chapter describes the messaging system used to communicate between the
+</div><p>This section describes the messaging system used to communicate between the
JavaScript code and the Native Client module&#8217;s C or C++ code in a
Native Client application. It introduces the concept of asynchronous
programming and the basic steps required to set up a Native Client module
-that sends messages to and receive messages from JavaScript. This chapter
+that sends messages to and receive messages from JavaScript. This section
assumes you are familiar with the material presented in the
-<a class="reference internal" href="/native-client/devguide/coding/application-structure.html"><em>Application Structure</em></a> chapter.</p>
+<a class="reference internal" href="/native-client/devguide/coding/application-structure.html"><em>Application Structure</em></a> section.</p>
<aside class="note">
The &#8220;Hello, World&#8221; example for getting started with NaCl is used here to
illustrate basic programming techniques. You can find this code in
diff --git a/native_client_sdk/doc_generated/devguide/coding/progress-events.html b/native_client_sdk/doc_generated/devguide/coding/progress-events.html
index afca37c2da..70adb6cf8d 100644
--- a/native_client_sdk/doc_generated/devguide/coding/progress-events.html
+++ b/native_client_sdk/doc_generated/devguide/coding/progress-events.html
@@ -1,7 +1,7 @@
-{{+bindTo:partials.standard_nacl_api}}
+{{+bindTo:partials.standard_nacl_article}}
<section id="progress-events">
-<h1 id="progress-events">Progress Events</h1>
+<span id="devcycle-progress-events"></span><h1 id="progress-events"><span id="devcycle-progress-events"></span>Progress Events</h1>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
<li><a class="reference internal" href="#module-loading-and-progress-events" id="id3">Module loading and progress events</a></li>
@@ -14,9 +14,9 @@
</div><p>There are five types of events that developers can respond to in Native Client:
progress, message, view change, focus, and input events (each described in the
-glossary below). This chapter describes how to monitor progress events (events
+glossary below). This section describes how to monitor progress events (events
that occur during the loading and execution of a Native Client module). This
-chapter assumes you are familiar with the material presented in the
+section assumes you are familiar with the material presented in the
<a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a>.</p>
<aside class="note">
The load_progress example illustrates progress event handling. You can find
@@ -34,29 +34,26 @@ events types reported by the Native Client runtime:</p>
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Event</th>
-<th class="head">Description</th>
-<th class="head">Number of
-times
+<th class="head">Times
triggered</th>
-<th class="head">When event is
+<th class="head">When
triggered</th>
<th class="head">How you might
-react to
-event</th>
+respond</th>
</tr>
</thead>
<tbody valign="top">
-<tr class="row-even"><td><code>loadstart</code></td>
-<td>Native Client has
-started to load a
-Native Client
-module.</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>loadstart</code></dt>
+<dd>Native Client has started to
+load a Native Client module.</dd>
+</dl>
+</td>
<td>once</td>
-<td>This is the
+<td>The
first
progress
event
-triggered
after the
Native Client
module is
@@ -69,9 +66,12 @@ message, such
as
&#8220;Loading...&#8221;</td>
</tr>
-<tr class="row-odd"><td><code>progress</code></td>
-<td>Part of the module
-has been loaded.</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>progress</code></dt>
+<dd>Part of the module has been
+loaded.</dd>
+</dl>
+</td>
<td>zero or
more</td>
<td>After
@@ -81,31 +81,24 @@ dispatched.</td>
<td>Display a
progress bar.</td>
</tr>
-<tr class="row-even"><td><code>error</code></td>
-<td>The Native Client
-module failed to
-start execution
-(includes any
-error before or
-during
-initialization of
-the module). The
-<code>lastError</code>
-attribute
-(mentioned later)
-provides details
-on the error
-(initialization
-failed, sel_ldr
-did not start,
-and so on).</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>error</code></dt>
+<dd>The Native Client module failed
+to start execution (includes any
+error before or during
+initialization of the module).
+The <code>lastError</code> attribute
+(mentioned later) provides
+details on the error
+(initialization failed, sel_ldr
+did not start, and so on).</dd>
+</dl>
+</td>
<td>zero or
once</td>
-<td>After the
-last
+<td>After the last
<code>progress</code>
-event has
-been
+event has been
dispatched,
or after
<code>loadstart</code>
@@ -119,21 +112,19 @@ application
failed to
load.</td>
</tr>
-<tr class="row-odd"><td><code>abort</code></td>
-<td>Loading of the
-Native Client
-module was
-aborted by the
-user.</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>abort</code></dt>
+<dd>Loading of the NativeClient
+module was aborted by the user.</dd>
+</dl>
+</td>
<td>zero or
once</td>
-<td>After the
-last
+<td>After the last
<code>progress</code>
-event has
-been
-dispatched,
-or after
+event has been
+dispatched, or
+after
<code>loadstart</code>
if no
<code>progress</code>
@@ -145,25 +136,23 @@ will want to
respond to
this event.</td>
</tr>
-<tr class="row-even"><td><code>load</code></td>
-<td>The Native Client
-module was
-successfully
-loaded, and
-execution was
-started. (The
-module was
-initialized
-successfully.)</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>load</code></dt>
+<dd>The Native Client module was
+successfully loaded, and
+execution was started.
+(The module was initialized
+successfully.)</dd>
+</dl>
+</td>
<td>zero or
once</td>
<td>After the
last
<code>progress</code>
-event has
-been
-dispatched,
-or after
+event has been
+dispatched, or
+after
<code>loadstart</code>
if no
<code>progress</code>
@@ -172,17 +161,15 @@ dispatched.</td>
<td>Remove the
progress bar.</td>
</tr>
-<tr class="row-odd"><td><code>loadend</code></td>
-<td>Loading of the
-Native Client
-module has
-stopped. Load
-succeeded
-(<code>load</code>),
-failed
-(<code>error</code>), or
-was aborted
-(<code>abort</code>).</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>loadend</code></dt>
+<dd>Loading of the Native Client
+module has stopped. Load
+succeeded (<code>load</code>), failed
+(<code>error</code>), or was aborted
+(<code>abort</code>).</dd>
+</dl>
+</td>
<td>once</td>
<td>After an
<code>error</code>,
@@ -193,28 +180,24 @@ dispatched.</td>
<td>Indicate
loading is
over
-(regardless
-of failure or
+(regardless of
+failure or
not).</td>
</tr>
-<tr class="row-even"><td><code>crash</code></td>
-<td>The Native Client
-module is not
-responding (died
-on an
-<code>assert()</code> or
-<code>exit()</code>) after
-a successful
-load. This event
-is unique to
-Native Client and
-is not part of
-the W3C Progress
-Events standard.
-The <code>exitStatus</code>
-attribute provides
-the numeric exit
-status value.</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>crash</code></dt>
+<dd>The Native Client module is not
+responding (died on an
+<code>assert()</code> or <code>exit()</code>)
+after a successful load. This
+event is unique to Native Client
+and is not part of the W3C
+Progress Events standard. The
+<code>exitStatus</code> attribute
+provides the numeric exit
+status.</dd>
+</dl>
+</td>
<td>zero or
once</td>
<td>After a
@@ -425,4 +408,4 @@ may nevertheless be useful for temporary debugging.</li>
</ul>
</section>
-{{/partials.standard_nacl_api}}
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/devguide/coding/url-loading.html b/native_client_sdk/doc_generated/devguide/coding/url-loading.html
index 6465d5edac..895dc004b0 100644
--- a/native_client_sdk/doc_generated/devguide/coding/url-loading.html
+++ b/native_client_sdk/doc_generated/devguide/coding/url-loading.html
@@ -22,9 +22,9 @@
</ul>
</div><h2 id="introduction">Introduction</h2>
-<p>This chapter describes how to use the <a class="reference external" href="/native-client/pepper_stable/cpp/classpp_1_1_u_r_l_loader">URLLoader API</a> to load resources
+<p>This section describes how to use the <a class="reference external" href="/native-client/pepper_stable/cpp/classpp_1_1_u_r_l_loader">URLLoader API</a> to load resources
such as images and sound files from a server into your application.</p>
-<p>The example discussed in this chapter is included in the SDK in the directory
+<p>The example discussed in this section is included in the SDK in the directory
<code>examples/api/url_loader</code>.</p>
<h2 id="reference-information">Reference information</h2>
<p>For reference information related to loading data from URLs, see the
@@ -42,7 +42,7 @@ following documentation:</p>
caches your application&#8217;s HTML file, manifest file (.nmf), and Native Client
module (.pexe or .nexe). If your application needs additional assets, such as
images and sound files, it must explicitly load those assets. You can use the
-Pepper APIs described in this chapter to load assets from a URL into your
+Pepper APIs described in this section to load assets from a URL into your
application.</p>
<p>After you&#8217;ve loaded assets into your application, Chrome will cache those
assets. To avoid being at the whim of the Chrome cache, however, you may want
diff --git a/native_client_sdk/doc_generated/devguide/coding/view-focus-input-events.html b/native_client_sdk/doc_generated/devguide/coding/view-focus-input-events.html
index fd2daede25..2b32e79ecd 100644
--- a/native_client_sdk/doc_generated/devguide/coding/view-focus-input-events.html
+++ b/native_client_sdk/doc_generated/devguide/coding/view-focus-input-events.html
@@ -1,7 +1,7 @@
-{{+bindTo:partials.standard_nacl_api}}
+{{+bindTo:partials.standard_nacl_article}}
<section id="view-change-focus-and-input-events">
-<h1 id="view-change-focus-and-input-events">View Change, Focus, and Input Events</h1>
+<span id="view-focus-input-events"></span><h1 id="view-change-focus-and-input-events"><span id="view-focus-input-events"></span>View Change, Focus, and Input Events</h1>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
<li><a class="reference internal" href="#overview" id="id2">Overview</a></li>
@@ -20,10 +20,10 @@
</li>
</ul>
-</div><p>This chapter describes view change, focus, and input event handling for a
-Native Client module. The chapter assumes you are familiar with the
+</div><p>This section describes view change, focus, and input event handling for a
+Native Client module. The section assumes you are familiar with the
material presented in the <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a>.</p>
-<p>There are two examples used in this chapter to illustrate basic
+<p>There are two examples used in this section to illustrate basic
programming techniques. The <code>input_events</code> example is used to
illustrate how your module can react to keyboard and mouse input
event. The <code>mouse_lock</code> example is used to illustrate how your module
@@ -50,105 +50,83 @@ and browser events. These functions are listed in the table below:</p>
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Function</th>
-<th class="head">Event</th>
<th class="head">Use</th>
</tr>
</thead>
<tbody valign="top">
-<tr class="row-even"><td><code>DidChangeView</code></td>
-<td>Called when the position,
-size, or clip rectangle
-of the module&#8217;s instance in
-the browser has changed.
-This event also occurs
-when browser window is
-resized or mouse wheel
-is scrolled.</td>
-<td>An implementation
-of this function
-might check the size
-of the module
-instance&#8217;s rectangle
-has changed and
-reallocate the
-graphics context
-when a different
-size is received.</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>DidChangeView</code></dt>
+<dd>Called when the position, size, or
+clip rectangle of the module&#8217;s
+instance in the browser has
+changed. This event also occurs
+when the browser window is resized
+or the mouse wheel is scrolled.</dd>
+</dl>
+</td>
+<td>An implementation of this function might
+check the size of the module instance&#8217;s
+rectangle has changed and reallocate the
+graphcs context when a different size is
+received.</td>
</tr>
-<tr class="row-odd"><td><code>DidChangeFocus</code></td>
-<td>Called when the module&#8217;s
-instance in the browser
-has gone in or out of
-focus (usually by
-clicking inside or
-outside the module
-instance). Having focus
-means that keyboard
-events will be sent to
-the module instance.
-An instance&#8217;s default
-condition is that it
-does not have focus.</td>
-<td>An implementation
-of this function
-might start or stop
-an animation or a
-blinking cursor.</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>DidChangeFocus</code></dt>
+<dd>Called when the module&#8217;s instance
+in the browser has gone in or out
+of focus (usually by clicking
+inside or outside the module
+instance). Having focus means that
+keyboard events will be sent to the
+module instance. An instance&#8217;s
+default condition is that it does
+not have focus.</dd>
+</dl>
+</td>
+<td>An implementation of this function might
+start or stop an animation or a blinking
+cursor.</td>
</tr>
-<tr class="row-even"><td><code>HandleDocumentLoad</code></td>
-<td>Called after
-<code>pp::Instance::Init()</code>
-for a full-frame module
-instance that was
-instantiated based on
-the MIME type of a
-DOMWindow navigation.
-This situation only
-applies to modules that
-are pre-registered to
-handle certain MIME
-types. If you haven&#8217;t
-specifically registered
-to handle a MIME type or
-aren&#8217;t positive this
-applies to you, your
-implementation of this
-function can just return
-false.</td>
-<td>This API is only
-applicable when you
-are writing an
-extension to enhance
-the abilities of
-the Chrome web
-browser. For
-example, a PDF
-viewer might
-implement this
-function to download
-and display a PDF
-file.</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt><code>HandleDocumentLoad</code></dt>
+<dd><code>pp::Instance::Init()</code> for a
+full-frame module instance that was
+instantiated based on the MIME
+type of a DOMWindow navigation.
+This situation only applies to
+modules that are pre-registered to
+handle certain MIME types. If you
+haven&#8217;t specifically registered to
+handle a MIME type or aren&#8217;t
+positive this applies to you, your
+implementation of this function can
+just return false.</dd>
+</dl>
+</td>
+<td>This API is only applicable when you are
+writing an extension to enhance the
+abilities of the Chrome web browser. For
+example, a PDF viewer might implement
+this function to download and display a
+PDF file.</td>
</tr>
-<tr class="row-odd"><td><code>HandleInputEvent</code></td>
-<td>Called when a user
-interacts with the
-module&#8217;s instance in the
-browser using an input
-device such as a mouse
-or keyboard. You must
-register your module to
-accept input events
-using
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt><code>HandleInputEvent</code></dt>
+<dd>Called when a user interacts with
+the module&#8217;s instance in the
+browser using an input device such
+as a mouse or keyboard. You must
+register your module to accept
+input events using
<code>RequestInputEvents()</code>
for mouse events and
-<code>RequestFilteringInputEvents</code>
-for keyboard events
-prior to overriding this
-function.</td>
-<td>An implementation of
-this function
-examines the input
-event type and
+<code>RequestFilteringInputEvents()</code>
+for keyboard events prior to
+overriding this function.</dd>
+</dl>
+</td>
+<td>An implementation of this function
+examines the input event type and
branches accordingly.</td>
</tr>
</tbody>
@@ -332,4 +310,4 @@ the <code>event_queue_</code> and the worker thread takes events from the
thread, so as not to slow down the browser.</p>
</section>
-{{/partials.standard_nacl_api}}
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/devguide/devcycle/debugging.html b/native_client_sdk/doc_generated/devguide/devcycle/debugging.html
index 3dfbfbf43e..7de0906288 100644
--- a/native_client_sdk/doc_generated/devguide/devcycle/debugging.html
+++ b/native_client_sdk/doc_generated/devguide/devcycle/debugging.html
@@ -19,25 +19,20 @@ and measure your application&#8217;s performance.</p>
<li><p class="first"><a class="reference internal" href="#debugging-with-printf" id="id7">Debugging with printf</a></p>
<ul class="small-gap">
<li><a class="reference internal" href="#redirecting-output-to-log-files" id="id8">Redirecting output to log files</a></li>
-<li><a class="reference internal" href="#redirecting-output-to-the-javascript-console" id="id9">Redirecting output to the JavaScript console</a></li>
</ul>
</li>
-<li><a class="reference internal" href="#logging-calls-to-pepper-interfaces" id="id10">Logging calls to Pepper interfaces</a></li>
-<li><a class="reference internal" href="#debugging-with-visual-studio" id="id11">Debugging with Visual Studio</a></li>
-<li><p class="first"><a class="reference internal" href="#debugging-with-nacl-gdb" id="id12">Debugging with nacl-gdb</a></p>
+<li><a class="reference internal" href="#logging-calls-to-pepper-interfaces" id="id9">Logging calls to Pepper interfaces</a></li>
+<li><a class="reference internal" href="#debugging-with-visual-studio" id="id10">Debugging with Visual Studio</a></li>
+<li><p class="first"><a class="reference internal" href="#debugging-with-nacl-gdb" id="id11">Debugging with nacl-gdb</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#debugging-pnacl-pexes-pepper-35-or-later" id="id13">Debugging PNaCl pexes (Pepper 35 or later)</a></li>
-<li><a class="reference internal" href="#debugging-pnacl-pexes-with-older-pepper-toolchains" id="id14">Debugging PNaCl pexes (with older Pepper toolchains)</a></li>
-<li><a class="reference internal" href="#running-nacl-gdb" id="id15">Running nacl-gdb</a></li>
+<li><a class="reference internal" href="#debugging-pnacl-pexes-pepper-35-or-later" id="id12">Debugging PNaCl pexes (Pepper 35 or later)</a></li>
+<li><a class="reference internal" href="#debugging-pnacl-pexes-with-older-pepper-toolchains" id="id13">Debugging PNaCl pexes (with older Pepper toolchains)</a></li>
+<li><a class="reference internal" href="#running-nacl-gdb" id="id14">Running nacl-gdb</a></li>
</ul>
</li>
</ul>
</li>
-<li><p class="first"><a class="reference internal" href="#debugging-with-other-tools" id="id16">Debugging with other tools</a></p>
-<ul class="small-gap">
-<li><a class="reference internal" href="#open-source-profiling-tools" id="id17">Open source profiling tools</a></li>
-</ul>
-</li>
+<li><a class="reference internal" href="#debugging-with-other-tools" id="id15">Debugging with other tools</a></li>
</ul>
</div><h2 id="diagnostic-information">Diagnostic information</h2>
@@ -116,58 +111,6 @@ variable as follows:</p>
the <code>--no-sandbox</code> flag. You must also be careful that each variable points
to a different file.
</aside>
-<h4 id="redirecting-output-to-the-javascript-console">Redirecting output to the JavaScript console</h4>
-<p>You can also cause output from printf statements in your C/C++ code to be
-relayed to the JavaScript side of your application through the Pepper messaging
-system, where you can then write the output to the JavaScript console. Follow
-these steps:</p>
-<ol class="arabic">
-<li><p class="first">Set the <code>NACL_EXE_STDOUT</code> and <code>NACL_EXE_STDERR</code> environment variables as
-follows:</p>
-<ul class="small-gap">
-<li><p class="first"><code>NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage</code></p>
-</li>
-<li><p class="first"><code>NACL_EXE_STDERR=DEBUG_ONLY:dev://postmessage</code></p>
-</li>
-</ul>
-<p>These settings tell Native Client to use <code>PostMessage()</code> to send output
-that your Native Client module writes to stdout and stderr to the JavaScript
-side of your application.</p>
-</li>
-<li><p class="first">Register a JavaScript handler to receive messages from your Native Client
-module:</p>
-<pre class="prettyprint">
-&lt;div id=&quot;nacl_container&quot;&gt;
- &lt;script type=&quot;text/javascript&quot;&gt;
- var container = document.getElementById('nacl_container');
- container.addEventListener('message', handleMessage, true);
- &lt;/script&gt;
- &lt;embed id=&quot;nacl_module&quot;
- src=&quot;my_application.nmf&quot;
- type=&quot;application/x-nacl&quot; /&gt;
-&lt;/div&gt;
-</pre>
-</li>
-<li><p class="first">Implement a simple JavaScript handler that logs the messages it receives to
-the JavaScript console:</p>
-<pre class="prettyprint">
-function handleMessage(message_event) {
- console.log(message_event.data);
-}
-</pre>
-<p>This handler works in the simple case where the only messages your Native
-Client module sends to JavaScript are messages with the output from stdout
-and stderr. If your Native Client module also sends other messages to
-JavaScript, your handler will need to be more complex.</p>
-<p>Once you&#8217;ve implemented a message handler and set up the environment
-variables as described above, you can check the JavaScript console to see
-output that your Native Client module prints to stdout and stderr. Keep in
-mind that your module makes a call to <code>PostMessage()</code> every time it flushes
-stdout or stderr. Your application&#8217;s performance will degrade considerably
-if your module prints and flushes frequently, or if it makes frequent Pepper
-calls to begin with (e.g., to render).</p>
-</li>
-</ol>
<h3 id="logging-calls-to-pepper-interfaces">Logging calls to Pepper interfaces</h3>
<p>You can log all Pepper calls your module makes by passing the following flags
to Chrome on startup:</p>
@@ -530,11 +473,6 @@ Plugin</a>.
Note that starting with the <code>pepper_22</code> bundle, the NaCl SDK for Windows
includes pre-built libraries and library source code, making it much easier to
build a module into a .DLL.</p>
-<h3 id="open-source-profiling-tools">Open source profiling tools</h3>
-<p>For the brave-hearted there are open source tools at <a class="reference external" href="http://www.chromium.org/nativeclient">Chromium.org</a> that describe how to do profiling on
-<a class="reference external" href="https://sites.google.com/a/chromium.org/dev/nativeclient/how-tos/profiling-nacl-apps-on-64-bit-windows">64-bit Windows</a>
-and <a class="reference external" href="http://www.chromium.org/nativeclient/how-tos/limited-profiling-with-oprofile-on-x86-64">Linux</a>
-machines.</p>
</section>
{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/devguide/devcycle/dynamic-loading.html b/native_client_sdk/doc_generated/devguide/devcycle/dynamic-loading.html
index 003a20d3d5..1123f9e915 100644
--- a/native_client_sdk/doc_generated/devguide/devcycle/dynamic-loading.html
+++ b/native_client_sdk/doc_generated/devguide/devcycle/dynamic-loading.html
@@ -4,22 +4,20 @@
<h1 id="dynamic-linking-and-loading-with-glibc">Dynamic Linking and Loading with glibc</h1>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
-<li><p class="first"><a class="reference internal" href="#introduction" id="id1">Introduction</a></p>
+<li><a class="reference internal" href="#c-standard-libraries-glibc-and-newlib" id="id1">C standard libraries: glibc and newlib</a></li>
+<li><a class="reference internal" href="#sdk-toolchains" id="id2">SDK toolchains</a></li>
+<li><p class="first"><a class="reference internal" href="#specifying-and-delivering-shared-libraries" id="id3">Specifying and delivering shared libraries</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#c-standard-libraries-glibc-and-newlib" id="id2">C standard libraries: glibc and newlib</a></li>
-<li><a class="reference internal" href="#sdk-toolchains" id="id3">SDK toolchains</a></li>
-<li><a class="reference internal" href="#specifying-and-delivering-shared-libraries" id="id4">Specifying and delivering shared libraries</a></li>
+<li><a class="reference internal" href="#building-a-dynamically-linked-application" id="id4">Building a dynamically linked application</a></li>
+<li><a class="reference internal" href="#generating-a-native-client-manifest-file-for-a-dynamically-linked-application" id="id5">Generating a Native Client manifest file for a dynamically linked application</a></li>
+<li><a class="reference internal" href="#deploying-a-dynamically-linked-application" id="id6">Deploying a dynamically linked application</a></li>
+<li><a class="reference internal" href="#opening-a-shared-library-at-runtime" id="id7">Opening a shared library at runtime</a></li>
+<li><a class="reference internal" href="#troubleshooting" id="id8">Troubleshooting</a></li>
</ul>
</li>
-<li><a class="reference internal" href="#building-a-dynamically-linked-application" id="id5">Building a dynamically linked application</a></li>
-<li><a class="reference internal" href="#generating-a-native-client-manifest-file-for-a-dynamically-linked-application" id="id6">Generating a Native Client manifest file for a dynamically linked application</a></li>
-<li><a class="reference internal" href="#deploying-a-dynamically-linked-application" id="id7">Deploying a dynamically linked application</a></li>
-<li><a class="reference internal" href="#opening-a-shared-library-at-runtime" id="id8">Opening a shared library at runtime</a></li>
-<li><a class="reference internal" href="#troubleshooting" id="id9">Troubleshooting</a></li>
</ul>
-</div><h2 id="introduction">Introduction</h2>
-<aside class="caution">
+</div><aside class="caution">
Portable Native Client currently only supports static linking, and the
only C library available for it is newlib. This page is only valid for
Native Client, though PNaCl will eventually support some form of
@@ -28,7 +26,7 @@ dynamic linking.
<p>This document describes how to create and deploy dynamically linked and loaded
applications with the glibc library in the Native Client SDK. Before reading
this document, we recommend reading <a class="reference internal" href="/native-client/devguide/devcycle/building.html"><em>Building Native Client Modules</em></a></p>
-<h3 id="c-standard-libraries-glibc-and-newlib"><span id="c-libraries"></span>C standard libraries: glibc and newlib</h3>
+<h2 id="c-standard-libraries-glibc-and-newlib"><span id="c-libraries"></span>C standard libraries: glibc and newlib</h2>
<p>The Native Client SDK comes with two C standard libraries &#8212; glibc and
newlib. These libraries are described in the table below.</p>
<table border="1" class="docutils">
@@ -38,11 +36,21 @@ newlib. These libraries are described in the table below.</p>
<tr class="row-odd"><th class="head">Library</th>
<th class="head">Linking</th>
<th class="head">License</th>
-<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
-<tr class="row-even"><td>glibc</td>
+<tr class="row-even"><td><dl class="first last docutils">
+<dt>glibc</dt>
+<dd>The GNU implementation of the <a class="reference external" href="http://en.wikipedia.org/wiki/POSIX">POSIX</a> standard
+runtime library for the C programming language.
+Designed for portability and performance, glibc is
+one of the most popular implementations of the C
+library. It is comprised of a set of interdependent
+libraries including libc, libpthreads, libdl, and
+others. For documentation, FAQs, and additional
+information about glibc, see <a class="reference external" href="http://www.gnu.org/software/libc/index.html">GLIBC</a>.</dd>
+</dl>
+</td>
<td>dynamic
or static</td>
<td>GNU Lesser
@@ -50,18 +58,19 @@ General
Public
License
(LGPL)</td>
-<td>glibc is the GNU implementation of the
-<a class="reference external" href="http://en.wikipedia.org/wiki/POSIX">POSIX</a> standard runtime library for the C
-programming language. Designed for
-portability and performance, glibc is one
-of the most popular implementations of the
-C library. It is comprised of a set of
-interdependent libraries including libc,
-libpthreads, libdl, and others. For
-documentation, FAQs, and additional
-information about glibc, see <a class="reference external" href="http://www.gnu.org/software/libc/index.html">GLIBC</a></td>
</tr>
-<tr class="row-odd"><td>newlib</td>
+<tr class="row-odd"><td><dl class="first last docutils">
+<dt>newlib</dt>
+<dd>newlib is a C library intended for use in embedded
+systems. Like glibc, newlib is a conglomeration of
+several libraries. It is available for use under
+BSD-type free software licenses, which generally
+makes it more suitable to link statically in
+commercial, closed-source applications. For
+documentation, FAQs, and additional information
+about newlib, see <a class="reference external" href="http://sourceware.org/newlib/">newlib</a>.</dd>
+</dl>
+</td>
<td>static</td>
<td>Berkeley
Software
@@ -70,16 +79,6 @@ Distribution
free
software
licenses</td>
-<td>newlib is a C library intended for use in
-embedded systems. Like glibc, newlib is a
-conglomeration of several library parts.
-It is available for use under BSD-type free
-software licenses, which generally makes it
-more suitable to link statically in
-commercial, closed-source applications. For
-documentation, FAQs, and additional
-information about newlib, see the <a class="reference external" href="http://sourceware.org/newlib/">newlib</a>
-documentation.</td>
</tr>
</tbody>
</table>
@@ -127,7 +126,7 @@ uses, even if the rest of an application is dynamically linked.</li>
</ul>
</aside>
-<h3 id="sdk-toolchains">SDK toolchains</h3>
+<h2 id="sdk-toolchains">SDK toolchains</h2>
<p>The Native Client SDK contains multiple toolchains, which are differentiated by
<a class="reference internal" href="/native-client/devguide/devcycle/building.html#target-architectures"><em>target architecture</em></a> and C library:</p>
<table border="1" class="docutils">
@@ -168,7 +167,7 @@ toolchain that uses glibc is in <code>toolchain/win_x86_glibc</code>.</p>
use a glibc toolchain. (Currently the only glibc toolchain is
<code>&lt;platform&gt;_x86_glibc</code>.) Note that you must build all code in your application
with one toolchain. Code from multiple toolchains cannot be mixed.</p>
-<h3 id="specifying-and-delivering-shared-libraries">Specifying and delivering shared libraries</h3>
+<h2 id="specifying-and-delivering-shared-libraries">Specifying and delivering shared libraries</h2>
<p>One significant difference between newlib and glibc applications is that glibc
applications must explicitly list and deploy the shared libraries that they
use.</p>
@@ -188,7 +187,7 @@ those libraries in a Native Client <a class="reference internal" href="/native-c
deploy the libraries along with the application. Instructions for how to build
a dynamically linked Native Client application, generate a Native Client
manifest (.nmf) file, and deploy an application are provided below.</p>
-<h2 id="building-a-dynamically-linked-application">Building a dynamically linked application</h2>
+<h3 id="building-a-dynamically-linked-application">Building a dynamically linked application</h3>
<p>Applications built with the glibc toolchain will by dynamically linked by
default. Application that load shared libraries at runtime using <code>dlopen()</code>
must link with the libdl library (<code>-ldl</code>).</p>
@@ -235,7 +234,7 @@ as that is currently the only toolchain that supports glibc and thus dynamic
linking and loading. Take a look at the example Makefiles and the generated
.nmf files for details on how to build dynamically linked applications.
</aside>
-<h2 id="generating-a-native-client-manifest-file-for-a-dynamically-linked-application"><span id="dynamic-loading-manifest"></span>Generating a Native Client manifest file for a dynamically linked application</h2>
+<h3 id="generating-a-native-client-manifest-file-for-a-dynamically-linked-application"><span id="dynamic-loading-manifest"></span>Generating a Native Client manifest file for a dynamically linked application</h3>
<p>The Native Client manifest file specifies the name of the executable to run
and must also specify any shared libraries that the application directly
depends on. For indirect dependencies (such as libraries opened via
@@ -312,7 +311,7 @@ intend to dlopen() at runtime you must explcitly list them in your call to
</aside>
<p>As an alternative to using <code>create_nmf</code>, it is possible to manually calculate
the list of shared library dependencies using tools such as <code>objdump_</code>.</p>
-<h2 id="deploying-a-dynamically-linked-application">Deploying a dynamically linked application</h2>
+<h3 id="deploying-a-dynamically-linked-application">Deploying a dynamically linked application</h3>
<p>As described above, an application&#8217;s manifest file must explicitly list all the
executable code modules that the application directly depends on, including
modules from the application itself (.nexe and .so files), modules from the
@@ -343,7 +342,7 @@ rename modules, it may be easier to re-run <code>create_nmf.py</code> to generat
manifest file rather than edit the original manifest file. For hosted
applications, you can check for name mismatches during testing by watching the
request log of the web server hosting your test deployment.</p>
-<h2 id="opening-a-shared-library-at-runtime">Opening a shared library at runtime</h2>
+<h3 id="opening-a-shared-library-at-runtime">Opening a shared library at runtime</h3>
<p>Native Client supports a version of the POSIX standard <code>dlopen()</code> interface
for opening libraries explicitly, after an application is already running.
Calling <code>dlopen()</code> may cause a library download to occur, and automatically
@@ -380,7 +379,7 @@ functions using <code>dlsym()</code>. When a user types in a query and clicks th
button, the module calls <code>Magic8Ball()</code> to generate an answer, and returns
the result to the user. Likewise when the user clicks the &#8216;Reverse&#8217; button
it calls the <code>Reverse()</code> function to reverse the string.</p>
-<h2 id="troubleshooting">Troubleshooting</h2>
+<h3 id="troubleshooting">Troubleshooting</h3>
<p>If your .nexe isn&#8217;t loading, the best place to look for information that can
help you troubleshoot the JavaScript console and standard output from Chrome.
See <a class="reference internal" href="/native-client/devguide/devcycle/debugging.html#devcycle-debugging"><em>Debugging</em></a> for more information.</p>
diff --git a/native_client_sdk/doc_generated/devguide/devcycle/running.html b/native_client_sdk/doc_generated/devguide/devcycle/running.html
index c34060c34a..0cae390f45 100644
--- a/native_client_sdk/doc_generated/devguide/devcycle/running.html
+++ b/native_client_sdk/doc_generated/devguide/devcycle/running.html
@@ -1,7 +1,7 @@
-{{+bindTo:partials.standard_nacl_api}}
+{{+bindTo:partials.standard_nacl_article}}
<section id="running">
-<h1 id="running">Running</h1>
+<span id="devcycle-running"></span><h1 id="running"><span id="devcycle-running"></span>Running</h1>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
<li><a class="reference internal" href="#introduction" id="id5">Introduction</a></li>
@@ -71,52 +71,70 @@ section below.</p>
<colgroup>
</colgroup>
<thead valign="bottom">
-<tr class="row-odd"><th class="head">#</th>
-<th class="head">Technique</th>
-<th class="head">Requires NaCl flag</th>
-<th class="head">Requires Web Server</th>
-<th class="head">Requires CWS Metadata</th>
-<th class="head">Description</th>
+<tr class="row-odd"><th class="head" colspan="2">Technique</th>
+<th class="head">Requires
+Web
+Server</th>
+<th class="head">Requires
+CWS
+Metadata</th>
</tr>
</thead>
<tbody valign="top">
-<tr class="row-even"><td>1</td>
-<td>Local server</td>
-<td><img alt="CHK" src="/native-client/images/check-red.png" /></td>
+<tr class="row-even"><td colspan="2"><p class="first"><strong>1. Local server</strong></p>
+<blockquote class="last">
+<div><blockquote>
+<div><p>Run a local server and simply point your browser to
+your application on the server.</p>
+<aside class="note">
+This technique requires the NaCl flag.
+</aside>
+</div></blockquote>
+</div></blockquote>
+</td>
<td><img alt="CHK" src="/native-client/images/check-red.png" /></td>
<td>&nbsp;</td>
-<td>Run a local server and simply point your browser to your application on
-the server.</td>
</tr>
-<tr class="row-odd"><td>2</td>
-<td>Packaged application loaded as an unpacked extension</td>
-<td>&nbsp;</td>
+<tr class="row-odd"><td colspan="2"><p class="first"><strong>2. Packaged application loaded as an unpacked
+extension</strong></p>
+<blockquote class="last">
+<div><blockquote>
+<div>Load your packaged application into Chrome as an
+unpacked extension and run it without a server. An
+unpacked extension is an application whose source and
+metadata files are located in an unzipped folder on
+your development machine. The CWS manifest file
+(explained below) must specify a local_path field.</div></blockquote>
+</div></blockquote>
+</td>
<td>&nbsp;</td>
<td><img alt="CHK" src="/native-client/images/check-red.png" /></td>
-<td>Load your packaged application into Chrome as an unpacked extension and
-run it without a server. An unpacked extension is simply an application
-whose source and metadata files are located in a plain (unzipped) folder
-on your development machine. The CWS manifest file (explained below) must
-specify a <code>local_path</code> field.</td>
</tr>
-<tr class="row-even"><td>3</td>
-<td>Hosted application loaded as an unpacked extension</td>
-<td>&nbsp;</td>
+<tr class="row-even"><td colspan="2"><p class="first"><strong>3. Hosted application loaded as an unpacked
+extension</strong></p>
+<blockquote class="last">
+<div><blockquote>
+<div>Load your hosted application into Chrome as an
+unpacked extension and run it from a server (which can
+be a local server). The CWS manifest file must specify
+a web_url field.</div></blockquote>
+</div></blockquote>
+</td>
<td><img alt="CHK" src="/native-client/images/check-red.png" /></td>
<td><img alt="CHK" src="/native-client/images/check-red.png" /></td>
-<td>Load your hosted application into Chrome as an unpacked extension and run
-it from a server (which can be a local server). The CWS manifest file
-must specify a <code>web_url</code> field.</td>
</tr>
-<tr class="row-odd"><td>4</td>
-<td>CWS application with untrusted testers</td>
-<td>&nbsp;</td>
+<tr class="row-odd"><td colspan="2"><p class="first"><strong>4. CWS application with untrusted testers</strong></p>
+<blockquote class="last">
+<div><blockquote>
+<div>The standard technique for distributing a packaged or
+hosted application in the CWS. You can limit the
+application to trusted testers. This technique
+requires a server if your application is a hosted
+application.</div></blockquote>
+</div></blockquote>
+</td>
<td>&nbsp;</td>
<td><img alt="CHK" src="/native-client/images/check-red.png" /></td>
-<td>This is the standard technique for distributing a packaged or hosted
-application in the CWS, but you can limit the application to a few
-trusted testers. This technique requires a server if your application is
-a hosted application.</td>
</tr>
</tbody>
</table>
@@ -191,7 +209,7 @@ to run most applications under the <code>examples</code> directory where you sta
server. For example, to run the <code>flock</code> example in the SDK, start the server
and point your browser to <code>http://localhost:5103/demo/flock/</code>.</p>
<p>Some of the applications need special flags to Chrome, and must be run with the
-<code>make run</code> command. See <a class="reference internal" href="/native-client/sdk/examples.html#id1"><em>Run the SDK examples</em></a> for more details.</p>
+<code>make run</code> command. See <a class="reference internal" href="/native-client/sdk/examples.html#running-the-sdk-examples"><em>Run the SDK examples</em></a> for more details.</p>
<h4 id="chrome-web-store-metadata"><span id="metadata"></span>Chrome Web Store metadata</h4>
<p>Applications published in the Chrome Web Store must be accompanied by CWS
metadata; specifically, a Chrome Web Store manifest file named
@@ -372,7 +390,7 @@ etc.)</li>
<li>Upload the application files (.html, .nmf, .nexe, .css, .js, image files,
etc.) to the server on which the application is being hosted.</li>
<li>Use <a class="reference external" href="http://www.google.com/webmasters/tools/">Google Webmaster Tools</a> to
-verify ownership of the web site on which the application runs.</li>
+verify ownership of the website on which the application runs.</li>
</ul>
</li>
<li>Log in to the <a class="reference external" href="https://chrome.google.com/webstore/developer/dashboard">Chrome Web Store Developer Dashboard</a>.<ul class="small-gap">
@@ -424,4 +442,4 @@ you must first unpublish the application. For additional information see
to test accounts</a>.</p>
</section>
-{{/partials.standard_nacl_api}}
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/devguide/devcycle/vs-addin.html b/native_client_sdk/doc_generated/devguide/devcycle/vs-addin.html
index e77b0e2cf9..d1306eaf43 100644
--- a/native_client_sdk/doc_generated/devguide/devcycle/vs-addin.html
+++ b/native_client_sdk/doc_generated/devguide/devcycle/vs-addin.html
@@ -1,7 +1,7 @@
-{{+bindTo:partials.standard_nacl_api}}
+{{+bindTo:partials.standard_nacl_article}}
<section id="debugging-with-visual-studio">
-<h1 id="debugging-with-visual-studio">Debugging With Visual Studio</h1>
+<span id="devcycle-vs-addin"></span><h1 id="debugging-with-visual-studio"><span id="devcycle-vs-addin"></span>Debugging with Visual Studio</h1>
<div class="contents local" id="table-of-contents" style="display: none">
<p class="topic-title first">Table Of Contents</p>
<ul class="small-gap">
@@ -179,11 +179,11 @@ example):</p>
</tr>
</thead>
<tbody valign="top">
-<tr class="row-even"><td>NACL_SDK_ROOT</td>
+<tr class="row-even"><td><code>NACL_SDK_ROOT</code></td>
<td>The path to the pepper directory in the SDK.
For example: <code>C:\nacl_sdk\pepper_23</code></td>
</tr>
-<tr class="row-odd"><td>CHROME_PATH</td>
+<tr class="row-odd"><td><code>CHROME_PATH</code></td>
<td>The path to the .exe file for the version of Chrome you
are testing with. For example:
<code>C:\Users\fred\AppData\Local\Google\Chrome
@@ -513,4 +513,4 @@ than a Pepper plugin.</dd>
</dl>
</section>
-{{/partials.standard_nacl_api}}
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part1.html b/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part1.html
index 8664bb8af3..1634c484d1 100644
--- a/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part1.html
+++ b/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part1.html
@@ -27,19 +27,19 @@
Client (PNaCl). This is a client-side application that uses HTML, JavaScript and
a Native Client module written in C++. The PNaCl toolchain is used to enable
running the Native Client module directly from a web page.</p>
-<p>It&#8217;s recommended to read the <a class="reference internal" href="/native-client/overview.html"><em>Native Client Technical Overview</em></a> prior to going through this tutorial.</p>
+<p>It&#8217;s recommended that you read the <a class="reference internal" href="/native-client/overview.html"><em>Native Client Technical Overview</em></a> prior to going through this tutorial.</p>
<h3 id="what-the-application-in-this-tutorial-does">What the application in this tutorial does</h3>
<p>The application in this tutorial shows how to load a Native Client module in a
-web page, and how to send messages between JavaScript and the C++ code in the
-Native Client module. In this simple application, the JavaScript code in the web
-page sends a <code>'hello'</code> message to the Native Client module. When the Native
-Client module receives a message, it checks whether the message is equal to the
-string <code>'hello'</code>. If it is, the Native Client module returns a message saying
-<code>'hello from NaCl'</code>. A JavaScript alert panel displays the message received
-from the Native Client module.</p>
+web page, and how to send messages between JavaScript and the Native Client
+module. In this simple application, the JavaScript sends a <code>'hello'</code> message
+to the Native Client module. When the Native Client module receives a message,
+it checks whether the message is equal to the string <code>'hello'</code>. If it is, the
+Native Client module returns a message saying <code>'hello from NaCl'</code>. A
+JavaScript alert panel displays the message received from the Native Client
+module.</p>
<h3 id="communication-between-javascript-and-native-client-modules">Communication between JavaScript and Native Client modules</h3>
<p>The Native Client programming model supports bidirectional communication between
-JavaScript and the Native Client module (C/C++ code). Both sides can initiate
+JavaScript and the Native Client module. Both sides can initiate
and respond to messages. In all cases, the communication is asynchronous: The
caller (JavaScript or the Native Client module) sends a message, but the caller
does not wait for, or may not even expect, a response. This behavior is
@@ -65,8 +65,8 @@ The SDK may consist of several &#8220;bundles&#8221;, one per Chrome/Pepper vers
<a class="reference internal" href="/native-client/version.html"><em>versioning information</em></a>). In the sample invocation above
<code>pepper_$(VERSION)</code> refers to the specific version you want to use. For
example, <code>pepper_31</code>. If you don&#8217;t know which version you need, use the
-one labeled <code>(stable)</code> by <code>naclsdk list</code>. See <a class="reference internal" href="/native-client/sdk/download.html"><em>Download the Native
-Client SDK</em></a> for more details.
+one labeled <code>(stable)</code> by the <code>naclsdk list</code> command. See
+<a class="reference internal" href="/native-client/sdk/download.html"><em>Download the Native Client SDK</em></a> for more details.
</aside>
<p>If no port number is specified, the server defaults to port 5103, and can be
accessed at <code>http://localhost:5103</code>.</p>
@@ -191,10 +191,17 @@ virtual void HandleMessage(const pp::Var&amp; var_message) {
and <a class="reference external" href="/native-client/pepper_stable/cpp/classpp_1_1_instance.html#a67e888a4e4e23effe7a09625e73ecae9">pp::Instance.PostMessage</a>
member functions.</p>
<h2 id="step-8-compile-the-native-client-module-and-run-the-application-again">Step 8: Compile the Native Client module and run the application again</h2>
-<p>Compile the Native Client module by running the <code>make</code> command again.</p>
-<p>Re-run the application by reloading <code>http://localhost:5103/part1</code> in Chrome.</p>
-<p>After Chrome loads the Native Client module, you should see an alert panel
-appear with the message sent from the module.</p>
+<ol class="arabic">
+<li><p class="first">Compile the Native Client module by running the <code>make</code> command again.</p>
+</li>
+<li><p class="first">Start the SDK web server by running <code>make server</code>.</p>
+</li>
+<li><p class="first">Re-run the application by reloading <code>http://localhost:5103/part1</code> in
+Chrome.</p>
+<p>After Chrome loads the Native Client module, you should see the message sent
+from the module.</p>
+</li>
+</ol>
<h2 id="troubleshooting"><span id="tutorial-troubleshooting"></span>Troubleshooting</h2>
<p>If your application doesn&#8217;t run, see <a class="reference internal" href="#tutorial-step-3"><em>Step 3</em></a> above to
verify that you&#8217;ve set up your environment correctly, including both the Chrome
@@ -214,7 +221,7 @@ contains some useful information about handling error events.</li>
<h2 id="next-steps">Next steps</h2>
<ul class="small-gap">
<li>See the <a class="reference internal" href="/native-client/devguide/coding/application-structure.html"><em>Application Structure</em></a>
-chapter in the Developer&#8217;s Guide for information about how to structure a
+section in the Developer&#8217;s Guide for information about how to structure a
Native Client module.</li>
<li>Check the <a class="reference external" href="/native-client/pepper_stable/cpp">C++ Reference</a> for details
about how to use the Pepper APIs.</li>
diff --git a/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html b/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html
index 72c33bed0c..08a753b6ed 100644
--- a/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html
+++ b/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html
@@ -26,6 +26,7 @@
</ul>
</li>
<li><a class="reference internal" href="#example-specific-behavior-with-example-js" id="id13">Example-specific behavior with example.js</a></li>
+<li><a class="reference internal" href="#compile-the-native-client-module-and-run-the-application-again" id="id14">Compile the Native Client module and run the application again</a></li>
</ul>
</div><h2 id="overview">Overview</h2>
@@ -36,7 +37,7 @@ application <a class="reference external" href="/apps/contentSecurityPolicy">Con
<p>Using the Native Client SDK build system makes it easy to build with all of the
SDK toolchains, and switch between the Debug and Release configurations. It
also simplifies the makefiles for your project, as we&#8217;ll see in the next
-section. Finally, it adds some useful commands for <a class="reference internal" href="/native-client/sdk/examples.html#id1"><em>running</em></a> and <a class="reference internal" href="/native-client/sdk/examples.html#debugging-the-sdk-examples"><em>debugging</em></a>
+section. Finally, it adds some useful commands for <a class="reference internal" href="/native-client/sdk/examples.html#running-the-sdk-examples"><em>running</em></a> and <a class="reference internal" href="/native-client/sdk/examples.html#debugging-the-sdk-examples"><em>debugging</em></a>
your application.</p>
<p>The finished code for this example can be found in the
<code>pepper_$(VERSION)/getting_started/part2</code> directory in the Native Client SDK
@@ -252,7 +253,9 @@ configurations, and path to the <code>.nmf</code> file:</p>
<p><code>common.js</code> will read these data attributes to allow you to load the same
example with different toolchains by changing the URL&#8217;s <a class="reference external" href="http://en.wikipedia.org/wiki/Query_string">query string</a>. For example, you can load the
glibc Debug version of this example by navigating to
-<code>index.html?tc=glibc&amp;config=Debug</code>.</p>
+<code>index.html?tc=glibc&amp;config=Debug</code>. Path URI&#8217;s such as <code>../</code>, for example
+do not work for either the data-path parameter or its corresponding query
+string.</p>
<p>Next, we remove the <code>embed</code> element that is described in HTML. This will be
automatically added for us by <code>common.js</code>, based on the current
toolchain/configuration combination:</p>
@@ -423,6 +426,18 @@ function handleMessage(message) {
logEl.textContent += message.data;
}
</pre>
+<h2 id="compile-the-native-client-module-and-run-the-application-again">Compile the Native Client module and run the application again</h2>
+<ol class="arabic">
+<li><p class="first">Compile the Native Client module by running the <code>make</code> command again.</p>
+</li>
+<li><p class="first">Start the SDK web server by running <code>make server</code>.</p>
+</li>
+<li><p class="first">Re-run the application by reloading <code>http://localhost:5103/part2</code> in
+Chrome.</p>
+<p>After Chrome loads the Native Client module, you should see the message sent
+from the module.</p>
+</li>
+</ol>
</section>
{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/glossary.html b/native_client_sdk/doc_generated/glossary.html
index 3e8bda0e1a..0fc2865ae0 100644
--- a/native_client_sdk/doc_generated/glossary.html
+++ b/native_client_sdk/doc_generated/glossary.html
@@ -25,7 +25,7 @@ drawn on the page).</dd>
<dd>A file containing metadata or information about accompanying files.</dd>
<dt>message events</dt>
<dd>Events used to pass data between JavaScript and the Native Client
-module (see the <a class="reference internal" href="/native-client/devguide/coding/message-system.html"><em>Messaging System</em></a> chapter).</dd>
+module (see the <a class="reference internal" href="/native-client/devguide/coding/message-system.html"><em>Messaging System</em></a> section).</dd>
<dt>module</dt>
<dd>Depending on context, &#8220;module&#8221; may mean one of two things. First, it may be a
general short-term for for &#8220;Native Client module&#8221;&#8212;compiled C/C++ code
diff --git a/native_client_sdk/doc_generated/images/nacl-in-a-web-app.png b/native_client_sdk/doc_generated/images/nacl-in-a-web-app.png
index 1ffed33833..44c8b1d5f1 100644
--- a/native_client_sdk/doc_generated/images/nacl-in-a-web-app.png
+++ b/native_client_sdk/doc_generated/images/nacl-in-a-web-app.png
Binary files differ
diff --git a/native_client_sdk/doc_generated/images/nacl-pnacl-component-diagram.png b/native_client_sdk/doc_generated/images/nacl-pnacl-component-diagram.png
index 338be194e5..da9cd7e9ab 100644
--- a/native_client_sdk/doc_generated/images/nacl-pnacl-component-diagram.png
+++ b/native_client_sdk/doc_generated/images/nacl-pnacl-component-diagram.png
Binary files differ
diff --git a/native_client_sdk/doc_generated/images/web-app-with-nacl.png b/native_client_sdk/doc_generated/images/web-app-with-nacl.png
index 46d5ca6778..7661fc3b6f 100644
--- a/native_client_sdk/doc_generated/images/web-app-with-nacl.png
+++ b/native_client_sdk/doc_generated/images/web-app-with-nacl.png
Binary files differ
diff --git a/native_client_sdk/doc_generated/index.html b/native_client_sdk/doc_generated/index.html
index e46695cb81..a3528c8a99 100644
--- a/native_client_sdk/doc_generated/index.html
+++ b/native_client_sdk/doc_generated/index.html
@@ -3,44 +3,72 @@
<section id="welcome-to-native-client">
<h1 id="welcome-to-native-client">Welcome to Native Client</h1>
<div id="home">
-<a class="button-nacl button-download" href="/native-client/sdk/download.html">Download SDK</a>
+<div class="pull-quote">To get the SDK and<br/>installation instructions<br/>
+<a href="/native-client/sdk/download.html">visit the SDK Download page</a>.
+</div>
<div class="big-intro"><p><strong>Native Client</strong> is a sandbox for running compiled C and C++ code in the
browser efficiently and securely, independent of the user&#8217;s operating system.
<strong>Portable Native Client</strong> extends that technology with
architecture independence, letting developers compile their code once to run
-in any website and on any architecture.</p>
+in any website and on any architecture with ahead-of-time (AOT) translation.</p>
<p>In short, Native Client brings the <strong>performance</strong> and <strong>low-level control</strong>
of native code to modern web browsers, without sacrificing the <strong>security</strong> and
<strong>portability</strong> of the web. Watch the video below for an overview of
Native Client, including its goals, how it works, and how
Portable Native Client lets developers run native compiled code on the web.</p>
+<aside class="note">
+This site uses several examples of Native Client. For the best experience,
+consider downloading the <a class="reference external" href="http://www.google.com/chrome/">latest version of Chrome</a>. When you come back, be sure to <a class="reference external" href="https://gonativeclient.appspot.com/demo">check out
+our demos</a>.
+</aside>
</div>
-<iframe class="video" width="640" height="360"
+<iframe class="video" width="600" height="337"
src="//www.youtube.com/embed/MvKEomoiKBA?rel=0" frameborder="0"></iframe>
+<div class="big-intro"><h2 id="two-types-of-modules">Two Types of Modules</h2>
+<p>Native Client comes in two flavors.</p>
+<ul class="small-gap">
+<li><strong>Portable Native Client (PNaCl)</strong>: Pronounced &#8216;pinnacle&#8217;, PNaCl runs single,
+portable (<strong>pexe</strong>) executables and is available in most implementations of
+Chrome. A translator built into Chrome translates the pexe into native code
+for the client hardware. The entire module is translated before any code is
+executed rather than as the code is executed. PNaCl modules can be hosted from
+any web server.</li>
+<li><strong>Native Client (NaCl)</strong>: Also called traditional or non-portable Native
+Client, NaCl runs architecture-dependent (<strong>nexe</strong>) modules, which are
+packaged into an application. At runtime, the browser decides which nexe to
+load based on the architecture of the client machine. NaCl modules must be run
+from the <a class="reference external" href="https://chrome.google.com/webstore/category/apps">Chrome Web Store (CWS)</a>. Fortunately, work from
+PNaCl modules can be used to create NaCl modules.</li>
+</ul>
+<p>These flavors are described in more depth in <a class="reference internal" href="/native-client/nacl-and-pnacl.html"><em>PNaCl and NaCl</em></a></p>
+<div class="left-side">
+<div class="left-side-inner">
+<h2>Hello World</h2>
+<div class="big-intro"><p>To jump right in <a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part1.html"><em>take the tutorial</em></a>
+that walks you through a basic web application for Portable Native Client
+(PNaCl). This is a client-side application that uses HTML, JavaScript, and a
+Native Client module written in C++.</p>
+</div>
+</div>
+</div>
+<h2>A Little More Advanced</h2>
+<div class="big-intro"><p>If you&#8217;ve already got the basics down, you&#8217;re probably trying to get a real
+application ready for production. You&#8217;re <a class="reference internal" href="/native-client/devguide/devcycle/building.html"><em>building</em></a>, <a class="reference internal" href="/native-client/devguide/devcycle/debugging.html"><em>debugging</em></a>
+or <a class="reference internal" href="/native-client/devguide/distributing.html"><em>ready to distribute</em></a>.</p>
+</div>
-<div class="right-side">
-<div class="right-side-inner">
-<h2>Guiding principles of Native Client</h2>
-<div class="big-intro">
-<ul>
- <li>Developer flexibility to program in any language.</li>
- <li>Running close to the metal to allow access to performance gains.</li>
- <li>Protecting users from malicious code and malware.</li>
- <li>Write-once, run-anywhere code portability across all user architectures.</li>
-</ul></div>
-</div>
-</div><h2 id="get-started-with-native-client">Get started with Native Client</h2>
-<div class="big-intro"><ol class="arabic simple">
-<li><a class="reference internal" href="/native-client/sdk/download.html"><em>Download the Native Client SDK</em></a>.</li>
-<li>Read the <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a>.</li>
-<li>Learn how to use the SDK and build both a web app and a Chrome app in the
-<a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part1.html"><em>Getting Started Tutorial</em></a>.</li>
-</ol>
-</div>
-<div class="big-intro" style="clear: both;"><p>Send us questions, comments, and feedback:
-<a class="reference external" href="https://groups.google.com/forum/#!forum/native-client-discuss">native-client-discuss</a>.</p>
+<div class="left-side">
+<div class="left-side-inner">
+<h2>Nuts and Bolts</h2>
+<div class="big-intro"><p>You&#8217;ve been working on a Native Client module for a while now and you&#8217;ve run
+into an arcane problem. You may need to refer to the <a class="reference internal" href="/native-client/reference/pnacl-bitcode-abi.html"><em>PNaCl Bitcode
+Reference</em></a> or the <a class="reference internal" href="/native-client/reference/sandbox_internals/index.html"><em>Sandbox internals</em></a>.</p>
+</div>
</div>
+</div><h2 id="i-want-to-know-everything">I Want to Know Everything</h2>
+<p>So, you like to read now and try later. Start with our <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a></p>
+<div class="big-intro" style="clear: both;"><p>Send us questions, comments, and feedback: <a class="reference external" href="https://groups.google.com/forum/#!forum/native-client-discuss">native-client-discuss</a>.</p>
</div></section>
{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/nacl-and-pnacl.html b/native_client_sdk/doc_generated/nacl-and-pnacl.html
index 283296d88f..b884cc78ae 100644
--- a/native_client_sdk/doc_generated/nacl-and-pnacl.html
+++ b/native_client_sdk/doc_generated/nacl-and-pnacl.html
@@ -6,97 +6,84 @@
<strong>Portable Native Client</strong>, and provides recommendations for when to use each.</p>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
-<li><a class="reference internal" href="#native-client-nacl" id="id3">Native Client (NaCl)</a></li>
-<li><a class="reference internal" href="#portable-native-client-pnacl" id="id4">Portable Native Client (PNaCl)</a></li>
-<li><a class="reference internal" href="#when-to-use-pnacl" id="id5">When to use PNaCl</a></li>
-<li><a class="reference internal" href="#when-to-use-nacl" id="id6">When to use NaCl</a></li>
+<li><a class="reference internal" href="#native-client-nacl" id="id6">Native Client (NaCl)</a></li>
+<li><a class="reference internal" href="#portable-native-client-pnacl" id="id7">Portable Native Client (PNaCl)</a></li>
+<li><a class="reference internal" href="#when-to-use-pnacl" id="id8">When to use PNaCl</a></li>
+<li><a class="reference internal" href="#when-to-use-nacl" id="id9">When to use NaCl</a></li>
</ul>
-</div><h2 id="native-client-nacl">Native Client (NaCl)</h2>
+</div><h2 id="native-client-nacl"><span id="id2"></span>Native Client (NaCl)</h2>
<p>Native Client enables the execution of native code securely inside web
-applications through the use of advanced <a class="reference external" href="/native-client/community/talks#research">Software Fault Isolation (SFI)
-techniques</a>. Since its launch in
-2011, Native Client has provided developers with the ability to harness a
-client machine&#8217;s computational power to a much fuller extent than traditional
-web technologies, by running compiled C and C++ code at near-native speeds and
-taking advantage of multiple cores with shared memory.</p>
-<p>While Native Client provides operating system independence, it requires
-developers to generate architecture-specific executable modules
-(<strong>nexe</strong> modules) for each hardware platform. This is not only inconvenient
-for developers, but architecture-specific machine code is not portable and thus
-not well-suited for the open web. The traditional method of application
-distribution on the web is through a self-contained bundle of HTML, CSS,
-JavaScript, and other resources (images, etc.) that can be hosted on a server
-and run inside a web browser. With this type of distribution, a website
-created today should still work years later, on all platforms.
-Architecture-specific executables are clearly not a good fit for distribution
-on the web. As a consequence, Native Client has been restricted to
-applications and browser extensions that are installed through the
+applications through the use of advanced <a class="reference external" href="http://research.google.com/pubs/pub35649.html">Software Fault Isolation (SFI)
+techniques</a>. Native Client
+allows you to harness a client machine&#8217;s computational power to a fuller extent
+than traditional web technologies. It does this by running compiled C and C++
+code at near-native speeds, and exposing a CPU&#8217;s full capabilities, including
+SIMD vectors and multiple-core processing with shared memory.</p>
+<p>While Native Client provides operating system independence, it requires you to
+generate architecture-specific executables (<strong>nexe</strong>) for each hardware
+platform. This is neither portable nor convenient, making it ill-suited for the
+open web.</p>
+<p>The traditional method of application distribution on the web is through self-
+contained bundles of HTML, CSS, JavaScript, and other resources (images, etc.)
+that can be hosted on a server and run inside a web browser. With this type of
+distribution, a website created today should still work years later, on all
+platforms. Architecture-specific executables are clearly not a good fit for
+distribution on the web. Consequently, Native Client has been until recently
+restricted to applications and browser extensions that are installed through the
Chrome Web Store.</p>
-<h2 id="portable-native-client-pnacl">Portable Native Client (PNaCl)</h2>
+<h2 id="portable-native-client-pnacl"><span id="id3"></span>Portable Native Client (PNaCl)</h2>
<p>PNaCl solves the portability problem by splitting the compilation process
into two parts:</p>
<ol class="arabic simple">
-<li>compiling the source code to a portable bitcode format, and</li>
-<li>translating the bitcode to a host-specific executable.</li>
+<li>compiling the source code to a bitcode executable (pexe), and</li>
+<li>translating the bitcode to a host-specific executable as soon as the module
+loads in the browser but before any code execution.</li>
</ol>
-<p>PNaCl enables developers
-to distribute <strong>portable executables</strong> (<strong>pexe</strong> modules) that the hosting
-environment (e.g., the Chrome browser) can translate to native code before
-executing. This portability aligns Native Client with existing open web
-technologies such as JavaScript: A developer can distribute a <strong>pexe</strong>
-as part of an application (along with HTML, CSS, and JavaScript),
-and the user&#8217;s machine is simply able to run it.</p>
-<p>With PNaCl, a developer generates a single <strong>pexe</strong> from source code,
-rather than multiple platform-specific nexes. The <strong>pexe</strong> provides both
-architecture- and OS-independence. Since the <strong>pexe</strong> uses an abstract,
-architecture-independent format, it does not suffer from the portability
-problem described above. Future versions of hosting environments should
-have no problem executing the <strong>pexe</strong>, even on new architectures.
-Moreover, if an existing architecture is subsequently enhanced, the
-<strong>pexe</strong> doesn&#8217;t even have to be recompiled&#8212;in some cases the
-client-side translation will automatically be able to take advantage of
-the new capabilities.</p>
-<p><strong>In short, PNaCl combines the portability of existing web technologies with
-the performance and security benefits of Native Client.</strong></p>
-<p>With the advent of PNaCl, the distribution restriction of Native Client
-can be lifted. Specifically, a <strong>pexe</strong> module can be part of any web
-application&#8212;it does not have to be distributed through the Chrome Web
-Store.</p>
+<p>This portability aligns Native Client with existing open web technologies such
+as JavaScript. You can distribute a pexe as part of an application (along with
+HTML, CSS, and JavaScript), and the user&#8217;s machine is simply able to run it.</p>
+<p>With PNaCl, you&#8217;ll generate a single pexe, rather than multiple platform-
+specific nexes. Since the pexe uses an abstract, architecture- and OS-
+independent format, it does not suffer from the portability problem described
+above. Although, PNaCl can be more efficient on some operating systems than on
+others. PNaCl boasts the same level of security as NaCl. Future versions of
+hosting environments should have no problem executing the pexe, even on new
+architectures. Moreover, if an existing architecture is enhanced, the pexe
+doesn&#8217;t need to be recompiled. In some cases the client-side translation will
+automatically take advantage of new capabilities. A pexe can be part of any web
+application. It does not have to be distributed through the Chrome Web Store. In
+short, PNaCl combines the portability of existing web technologies with the
+performance and security benefits of Native Client.</p>
<p>PNaCl is a new technology, and as such it still has a few limitations
as compared to NaCl. These limitations are described below.</p>
-<h2 id="when-to-use-pnacl">When to use PNaCl</h2>
+<h2 id="when-to-use-pnacl"><span id="id4"></span>When to use PNaCl</h2>
<p>PNaCl is the preferred toolchain for Native Client, and the only way to deploy
-Native Client modules on the open web. Unless your project is subject to one
-of the narrow limitations described below
-(see <a class="reference internal" href="#when-to-use-nacl"><em>When to use NaCl</em></a>), you should use PNaCl.</p>
-<p>Beginning with version 31, the Chrome browser supports translation of
-<strong>pexe</strong> modules and their use in web applications, without requiring
-any installation (either of a browser plugin or of the applications
-themselves). Native Client and PNaCl are open-source technologies, and
-our hope is that they will be added to other hosting platforms in the
-future.</p>
-<p>If controlled distribution through the Chrome Web Store is an important part
-of your product plan, the benefits of PNaCl are less critical for you. But
-you can still use the PNaCl toolchain and distribute your application
-through the Chrome Web Store, and thereby take advantage of the
-conveniences of PNaCl, such as not having to explicitly compile your application
-for all supported architectures.</p>
-<h2 id="when-to-use-nacl"><span id="id2"></span>When to use NaCl</h2>
-<p>The limitations below apply to the current release of PNaCl. If any of
-these limitations are critical for your application, you should use
-non-portable NaCl:</p>
+Native Client modules without the Google Web Store. Unless your project is
+subject to one of the narrow limitations described under &#8220;<a class="reference internal" href="#when-to-use-nacl"><em>When to use
+NaCl</em></a>&#8221;, you should use PNaCl.</p>
+<p>Since version 31, Chrome supports translation of pexe
+modules and their use in web applications without requiring installation either
+of a browser plug-in or of the applications themselves. Native Client and PNaCl
+are open-source technologies, and our hope is that they will be added to other
+hosting platforms in the future.</p>
+<p>If controlled distribution through the Chrome Web Store is an important part of
+your product plan, the benefits of PNaCl are less critical for you. But you can
+still use the PNaCl toolchain and distribute your application through the Chrome
+Web Store, and thereby take advantage of the conveniences of PNaCl, such as not
+having to explicitly compile your application for all supported architectures.</p>
+<h2 id="when-to-use-nacl"><span id="id5"></span>When to use NaCl</h2>
+<p>Use NaCl if any of the following apply to your application:</p>
<ul class="small-gap">
-<li>By its nature, PNaCl does not support architecture-specific
-instructions in an application (i.e., inline assembly), but tries to
-offer high-performance portable equivalents. One such example is
-PNaCl&#8217;s <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a>.</li>
-<li>Currently PNaCl only supports static linking with the <code>newlib</code>
-C standard library (the Native Client SDK provides a PNaCl port of
-<code>newlib</code>). Dynamic linking and <code>glibc</code> are not yet supported.
-Work is under way to enable dynamic linking in future versions of PNaCl.</li>
-<li>In the initial release, PNaCl does not support some GNU extensions
-like taking the address of a label for computed <code>goto</code>, or nested
+<li>Your application requires architecture-specific instructions such as, for
+example, inline assembly. PNaCl tries to offer high-performance portable
+equivalents. One such example is PNaCl&#8217;s <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a>.</li>
+<li>Your application uses dynamic linking. PNaCl only supports static linking
+with a PNaCl port of the <code>newlib</code> C standard library. Dynamic linking and
+<code>glibc</code> are not yet supported in PNaCl. Work is under way to enable dynamic
+linking in future versions of PNaCl.</li>
+<li>Your application uses certain GNU extensions not supported by PNaCl&#8217;s LLVM
+toolchain, like taking the address of a label for computed <code>goto</code>, or nested
functions.</li>
</ul>
</section>
diff --git a/native_client_sdk/doc_generated/overview.html b/native_client_sdk/doc_generated/overview.html
index b9d48dbcb1..edda38877d 100644
--- a/native_client_sdk/doc_generated/overview.html
+++ b/native_client_sdk/doc_generated/overview.html
@@ -4,93 +4,102 @@
<span id="overview"></span><h1 id="technical-overview"><span id="overview"></span>Technical Overview</h1>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
-<li><a class="reference internal" href="#introduction" id="id2">Introduction</a></li>
-<li><a class="reference internal" href="#why-use-native-client" id="id3">Why use Native Client?</a></li>
-<li><a class="reference internal" href="#common-use-cases" id="id4">Common use cases</a></li>
-<li><p class="first"><a class="reference internal" href="#how-native-client-works" id="id5">How Native Client works</a></p>
+<li><a class="reference internal" href="#why-use-native-client" id="id7">Why use Native Client?</a></li>
+<li><a class="reference internal" href="#benefits-of-native-client" id="id8">Benefits of Native Client</a></li>
+<li><a class="reference internal" href="#common-use-cases" id="id9">Common use cases</a></li>
+<li><p class="first"><a class="reference internal" href="#how-native-client-works" id="id10">How Native Client works</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#security" id="id6">Security</a></li>
-<li><a class="reference internal" href="#portability" id="id7">Portability</a></li>
-<li><a class="reference internal" href="#toolchains" id="id8">Toolchains</a></li>
+<li><a class="reference internal" href="#toolchains" id="id11">Toolchains</a></li>
+<li><a class="reference internal" href="#security" id="id12">Security</a></li>
+<li><a class="reference internal" href="#portability" id="id13">Portability</a></li>
</ul>
</li>
-<li><p class="first"><a class="reference internal" href="#native-client-in-a-web-application" id="id9">Native Client in a web application</a></p>
+<li><p class="first"><a class="reference internal" href="#structure-of-a-web-application" id="id14">Structure of a web application</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#pepper-plugin-api" id="id10">Pepper Plugin API</a></li>
+<li><a class="reference internal" href="#pepper-plug-in-api" id="id15">Pepper plug-in API</a></li>
</ul>
</li>
-<li><a class="reference internal" href="#versioning" id="id11">Versioning</a></li>
-<li><a class="reference internal" href="#where-to-start" id="id12">Where to start</a></li>
+<li><a class="reference internal" href="#where-to-start" id="id16">Where to start</a></li>
</ul>
-</div><h2 id="introduction">Introduction</h2>
-<p><strong>Native Client</strong> (NaCl) is an open-source technology for running native
+</div><p><strong>Native Client</strong> (NaCl) is an open-source technology for running native
compiled code in the browser, with the goal of maintaining the portability
and safety that users expect from web applications. Native Client expands web
-programming beyond JavaScript, enabling developers to enhance their web
-applications using their preferred language. This document describes some of
-the key benefits and common use cases of Native Client.</p>
+programming beyond JavaScript, enabling you to enhance your web applications
+using your preferred language. This document describes some of the key benefits
+and common use cases of Native Client.</p>
<p>Google has implemented the open-source <a class="reference external" href="http://www.chromium.org/nativeclient">Native Client project</a> in the Chrome browser on Windows, Mac,
-Linux, and Chrome OS. The <a class="reference internal" href="/native-client/sdk/download.html"><em>Native Client Software Development Kit (SDK)</em></a>, itself an open-source project, lets developers create web
-applications that use NaCl and run in Chrome across multiple platforms.</p>
-<p>A web application that uses Native Client generally consists of a combination of
-JavaScript, HTML, CSS, and a NaCl module that is written in a language supported
-by the SDK. The NaCl SDK currently supports C and C++; as compilers for
-additional languages are developed, the SDK will be updated to support those
-languages as well.</p>
-<img alt="/native-client/images/web-app-with-nacl.png" src="/native-client/images/web-app-with-nacl.png" />
-<h2 id="why-use-native-client">Why use Native Client?</h2>
+Linux, and Chrome OS. The <a class="reference internal" href="/native-client/sdk/download.html"><em>Native Client Software Development Kit (SDK)</em></a>, itself an open-source project, lets you create web applications
+that use NaCl and run in Chrome across multiple platforms.</p>
+<p>A Native Client web application consists of JavaScript, HTML, CSS, and a NaCl
+module written in a language supported by the SDK. The NaCl SDK currently
+supports C and C++; as compilers for additional languages are developed, the SDK
+will be updated.</p>
+<div class="figure">
+<img alt="A web application with and without Native Client" src="/native-client/images/web-app-with-nacl.png" />
+<p class="caption">A web application with and without Native Client</p>
+</div>
+<p>Native Client comes in two flavors: traditional (NaCl) and portable (PNaCl).
+Traditional, which must be distributed through the Chrome Web Store lets you
+target a specific hardware platform. Portable can run on the open web. A
+bitcode file that can be loaded from any web server is downloaded to a client
+machine and converted to hardware-specific code before any execution. For
+details, see <a class="reference internal" href="/native-client/nacl-and-pnacl.html"><em>NaCl and PNaCl</em></a>.</p>
+<h2 id="why-use-native-client"><span id="id1"></span>Why use Native Client?</h2>
<p>Native Client open-source technology is designed to run compiled code
-securely inside a browser at near-native speeds. Native Client puts web
-applications on the same playing field as traditional (locally-run)
-software&#8212;it provides the means to fully harness the client&#8217;s computational
-resources for applications such as 3D games, multimedia editors, CAD modeling,
-client-side data analytics, and interactive simulations.
-Native Client also aims to give C and C++ (and eventually other languages) the
-same level of portability and safety that JavaScript provides on the web today.</p>
-<p>Here are a few of the key benefits that Native Client offers:</p>
+securely inside a browser at near-native speeds. Native Client gives web
+applications some advantages of desktop software. Specifically, it provides the
+means to fully harness the client&#8217;s computational resources for applications
+such as:</p>
<ul class="small-gap">
-<li><strong>Graphics, audio, and much more:</strong> Run native code modules that render 2D
+<li>3D games</li>
+<li>multimedia editors</li>
+<li>CAD modeling</li>
+<li>client-side data analytics</li>
+<li>interactive simulations.</li>
+</ul>
+<p>Native Client gives C and C++ (and other languages targeting it) the same level
+of portability and safety as JavaScript.</p>
+<h2 id="benefits-of-native-client"><span id="id2"></span>Benefits of Native Client</h2>
+<p>Benefits of Native Client include:</p>
+<ul class="small-gap">
+<li><strong>Graphics, audio, and much more:</strong> Running native code modules that render 2D
and 3D graphics, play audio, respond to mouse and keyboard events, run on
-multiple threads, and access memory directly&#8212;all without requiring
-the user to install a plugin.</li>
-<li><strong>Portability:</strong> Write your applications once and you&#8217;ll be able to run them
-across operating systems (Windows, Linux, Mac, and Chrome OS) and CPU
-architectures (x86 and ARM).</li>
-<li><strong>Easy migration path to the web:</strong> Many developers and companies have years
-of work invested in existing desktop applications. Native Client makes the
-transition from the desktop to a web application significantly easier because
-it supports C and C++.</li>
-<li><strong>Security:</strong> Native Client uses a double sandbox model designed to protect
-the user&#8217;s system from malicious or buggy applications. This model offers the
-safety of traditional web applications without sacrificing performance and
-without requiring users to install a plugin.</li>
-<li><strong>Performance:</strong> Native Client allows web applications to run at speeds
-comparable to desktop applications (within 5-15% of native speed).
-Native Client also allows applications to harness all available CPU cores via
-a threading API; this enables demanding applications such as console-quality
-games to run inside the browser.</li>
+multiple threads, and access memory directly&#8212;all without requiring the user
+to install a plug-in.</li>
+<li><strong>Portability:</strong> Writing your applications once and running them on multiple
+operating systems (Windows, Linux, Mac, and Chrome OS) and CPU architectures
+(x86 and ARM).</li>
+<li><strong>Easy migration path to the web:</strong> Leveraging years of work in existing
+desktop applications. Native Client makes the transition from the desktop to
+a web application significantly easier because it supports C and C++.</li>
+<li><strong>Security:</strong> Protecting the user&#8217;s system from malicious or buggy
+applications through Native Client&#8217;s double sandbox model. This model offers
+the safety of traditional web applications without sacrificing performance
+and without requiring users to install a plug-in.</li>
+<li><strong>Performance:</strong> Running at speeds within 5% to 15% of a native desktop
+application. Native Client also allows applications to harness all available
+CPU cores via a threading API. This enables demanding applications such as
+console-quality games to run inside the browser.</li>
</ul>
-<h2 id="common-use-cases">Common use cases</h2>
+<h2 id="common-use-cases"><span id="id3"></span>Common use cases</h2>
<p>Typical use cases for Native Client include the following:</p>
<ul class="small-gap">
-<li><strong>Existing software components:</strong> With support for C and C++, Native
-Client enables you to reuse existing software modules in
-web applications&#8212;you don&#8217;t need to rewrite and debug code
-that&#8217;s already proven to work well.</li>
+<li><strong>Existing software components:</strong> Native Client lets you repurpose existing
+C and C++ software in web applications. You don&#8217;t need to rewrite and debug
+code that already works. It also lets your application take advantage of
+things the browser does well such as handling user interaction and processing
+events. You can also take advantage of the latest developments in HTML5.</li>
<li><strong>Legacy desktop applications:</strong> Native Client provides a smooth migration
path from desktop applications to the web. You can port and recompile existing
code for the computation engine of your application directly to Native Client,
-and need repurpose only the user interface and event handling portions to the
-new browser platform. Native Client allows you to embed existing functionality
-directly into the browser. At the same time, your application can take
-advantage of things the browser does well: handling user interaction and
-processing events, based on the latest developments in HTML5.</li>
+and need rebuild only the user interface and event handling portions for the
+browser.</li>
<li><strong>Heavy computation in enterprise applications:</strong> Native Client can handle the
number crunching required by large-scale enterprise applications. To ensure
-protection of user data, Native Client enables you to build complex
-cryptographic algorithms directly into the browser so that unencrypted data
-never goes out over the network.</li>
+protection of user data, Native Client lets you run complex cryptographic
+algorithms directly in the browser so that unencrypted data never goes out
+over the network.</li>
<li><strong>Multimedia applications:</strong> Codecs for processing sounds, images, and movies
can be added to the browser in a Native Client module.</li>
<li><strong>Games:</strong> Native Client lets web applications run at close to native
@@ -100,52 +109,64 @@ shaders. Native Client is a natural fit for running a physics engine or
artificial intelligence module that powers a sophisticated web game.
Native Client also enables applications to run unchanged across
many platforms.</li>
-<li><strong>Any application that requires acceleration</strong>: Native Client fits seamlessly
-into web applications&#8212;it&#8217;s up to you to decide to what extent to use it.
+<li><strong>Any application that requires acceleration:</strong> Native Client fits seamlessly
+into web applications. It&#8217;s up to you to decide to what extent to use it.
Use of Native Client covers the full spectrum from complete applications to
-small optimized routines that accelerate vital parts of web apps.</li>
+small optimized routines that accelerate vital parts of web applications.</li>
</ul>
<h2 id="how-native-client-works"><span id="link-how-nacl-works"></span>How Native Client works</h2>
-<p>Native Client is an umbrella name for a set of interrelated software components
-that work together to provide a way to develop C/C++ applications and run them
-securely on the web.</p>
-<p>At a high level, Native Client consists of:</p>
+<p>Native Client is an umbrella name for a set of related software components for
+developing C/C++ applications and running them securely on the web. At a high
+level, Native Client consists of:</p>
<ul class="small-gap">
-<li><strong>Toolchains</strong>: collections of development tools (compilers, linkers, etc.)
-that transform C/C++ code to Native Client modules.</li>
-<li><strong>Runtime components</strong>: components embedded in the browser or other
-host platforms that allow execution of Native Client modules
-securely and efficiently.</li>
+<li><strong>Toolchains:</strong> collections of development tools (compilers, linkers, etc.)
+that transform C/C++ code to Portable Native Client modules or Native Client
+modules.</li>
+<li><strong>Runtime components:</strong> components embedded in the browser or other host
+platforms that allow execution of Native Client modules securely and
+efficiently.</li>
</ul>
<p>The following diagram shows how these components interact:</p>
-<img alt="/native-client/images/nacl-pnacl-component-diagram.png" src="/native-client/images/nacl-pnacl-component-diagram.png" />
-<p>The left side of the diagram shows how to use Portable Native Client
-(PNaCl, pronounced &#8220;pinnacle&#8221;). Developers use the PNaCl toolchain
-to produce a single, portable (<strong>pexe</strong>) module. At runtime, a translator
-built into the browser translates the pexe into native code for the
-relevant client architecture.</p>
-<p>The right side of the diagram shows how to use traditional (non-portable)
-Native Client. Developers use a nacl-gcc based toolchain to produce multiple
-architecture-dependent (<strong>nexe</strong>) modules, which are packaged into an
-application. At runtime, the browser decides which nexe to load based
-on the architecture of the client machine.</p>
-<h3 id="security">Security</h3>
+<div class="figure">
+<img alt="The Native Client toolchains and their outputs" src="/native-client/images/nacl-pnacl-component-diagram.png" />
+<p class="caption">The Native Client toolchains and their outputs</p>
+</div>
+<h3 id="toolchains"><span id="id4"></span>Toolchains</h3>
+<p>A Native Client toolchain consists of a compiler, a linker, an assembler and
+other tools that are used to convert C/C++ source code into a module that is
+loadable by a browser.</p>
+<p>The Native Client SDK provides two toolchains:</p>
+<ul class="small-gap">
+<li>The left side of the diagram shows <strong>Portable Native Client</strong> (PNaCl,
+pronounced &#8220;pinnacle&#8221;). An LLVM based toolchain produces a single, portable
+(<strong>pexe</strong>) module. At runtime an ahead-of-time (AOT) translator, built into
+the browser, translates the pexe into native code for the relevant client
+architecture.</li>
+<li>The right side of the diagram shows <strong>(non-portable) Native Client</strong>. A GCC
+based toolchain produces multiple architecture-dependent (<strong>nexe</strong>) modules,
+which are packaged into an application. At runtime the browser determines
+which nexe to load based on the architecture of the client machine.</li>
+</ul>
+<p>The PNaCl toolchain is recommended for most applications. The NaCl-GCC
+toolchain should only be used for applications that won&#8217;t be distributed on the
+open web.</p>
+<h3 id="security"><span id="id5"></span>Security</h3>
<p>Since Native Client permits the execution of native code on client machines,
special security measures have to be implemented:</p>
<ul class="small-gap">
<li>The NaCl sandbox ensures that code accesses system resources only through
-safe, whitelisted APIs, and operates within its limits without attempting to
+safe, whitelisted APIs, and operates within its limits without attempting to
interfere with other code running either within the browser or outside it.</li>
-<li>The NaCl validator statically analyzes code prior to running it
-to make sure it only uses code and data patterns that are permitted and safe.</li>
+<li>The NaCl validator statically analyzes code before running it to make sure it
+only uses code and data patterns that are permitted and safe.</li>
</ul>
-<p>The above security measures are in addition to the existing sandbox in the
-Chrome browser&#8212;the Native Client module always executes in a process with
+<p>These security measures are in addition to the existing sandbox in the
+Chrome browser. The Native Client module always executes in a process with
restricted permissions. The only interaction between this process and the
-outside world is through sanctioned browser interfaces. Because of the
+outside world is through defined browser interfaces. Because of the
combination of the NaCl sandbox and the Chrome sandbox, we say that
-Native Client employs a double sandbox design.</p>
-<h3 id="portability">Portability</h3>
+Native Client employs a <strong>double sandbox</strong> design.</p>
+<h3 id="portability"><span id="id6"></span>Portability</h3>
<p>Portable Native Client (PNaCl, prounounced &#8220;pinnacle&#8221;) employs state-of-the-art
compiler technology to compile C/C++ source code to a portable bitcode
executable (<strong>pexe</strong>). PNaCl bitcode is an OS- and architecture-independent
@@ -153,53 +174,49 @@ format that can be freely distributed on the web and <a class="reference interna
applications</em></a>.</p>
<p>The PNaCl translator is a component embedded in the Chrome browser; its task is
to run pexe modules. Internally, the translator compiles a pexe to a nexe
-(a native executable for the client platform&#8217;s architecture), and then executes
-the nexe within the Native Client sandbox as described above. It also uses
-intelligent caching to avoid re-compiling the pexe if it was previously compiled
-on the client&#8217;s browser.</p>
+(described above), and then executes the nexe within the Native Client sandbox
+as described above. The translator uses intelligent caching to avoid
+re-compiling the pexe if it was previously compiled on the client&#8217;s browser.</p>
<p>Native Client also supports the execution of nexe modules directly in the
-browser. However, since nexes contain architecture-specific machine code,
-they are not allowed to be distributed on the open web&#8212;they can only be
-used as part of applications and extensions that are installed from the
-Chrome Web Store.</p>
+browser. However, since nexes contain architecture-specific machine code, they
+are not allowed to be distributed on the open web. They can only be used as part
+of applications and extensions that are installed from the Chrome Web Store.</p>
<p>For more details on the difference between NaCl and PNaCl, see
<a class="reference internal" href="/native-client/nacl-and-pnacl.html"><em>NaCl and PNaCl</em></a>.</p>
-<h3 id="toolchains"><span id="id1"></span>Toolchains</h3>
-<p>A toolchain is a set of tools used to create an application from a set of
-source files. In the case of Native Client, a toolchain consists of a compiler,
-linker, assembler and other tools that are used to convert an
-application written in C/C++ into a module that is loadable by the browser.</p>
-<p>The Native Client SDK provides two toolchains:</p>
-<ul class="small-gap">
-<li>a <strong>PNaCl toolchain</strong> for generating portable NaCl modules (pexe files)</li>
-<li>a <strong>gcc-based toolchain (nacl-gcc)</strong> for generating non-portable NaCl modules
-(nexe files)</li>
-</ul>
-<p>The PNaCl toolchain is recommended for most applications. The nacl-gcc
-toolchain should only be used for applications that will not be distributed
-on the open web.</p>
-<h2 id="native-client-in-a-web-application"><span id="link-nacl-in-web-apps"></span>Native Client in a web application</h2>
+<h2 id="structure-of-a-web-application"><span id="link-nacl-in-web-apps"></span>Structure of a web application</h2>
<p id="application-files">A Native Client application consists of a set of files:</p>
<ul class="small-gap">
-<li><strong>HTML</strong>, <strong>CSS</strong>, and <strong>JavaScript</strong> files, as in any modern web
-application. The JavaScript code is responsible for communicating with the
-NaCl module.</li>
-<li>A <strong>pexe</strong> (portable NaCl) file. This module uses the <a class="reference internal" href="#link-pepper"><em>Pepper</em></a> API, which provides the bridge to JavaScript and
-browser resources.</li>
-<li>A Native Client <strong>manifest</strong> file that specifies the pexe to load, along with
-some loading options. This manifest file is embedded into the HTML page
-through an <code>&lt;embed&gt;</code> tag, as shown in the figure below.</li>
+<li><p class="first"><strong>HTML and CSS:</strong> The HTML file tells the browser where to find the manifest
+(nmf file) through the embed tag.</p>
+<pre class="prettyprint">
+&lt;embed name=&quot;mygame&quot; src=&quot;mygame.nmf&quot; type=&quot;application/x-pnacl&quot; /&gt;
+</pre>
+</li>
+<li><p class="first"><strong>Manifest:</strong> The manifest identifies the module to load and specifies
+options. For example, &#8220;mygame.nmf&#8221; might look like this:</p>
+<pre class="prettyprint">
+{...
+ ...
+ &quot;url&quot;: &quot;mygame.pexe&quot;,
+}
+</pre>
+</li>
+<li><strong>pexe (portable NaCl file):</strong> A compiled Native Client module. It uses the
+<a class="reference internal" href="#link-pepper"><em>Pepper API</em></a>, which provides a bridge to JavaScript and
+other browser resources.</li>
</ul>
-<img alt="/native-client/images/nacl-in-a-web-app.png" src="/native-client/images/nacl-in-a-web-app.png" />
+<div class="figure">
+<img alt="Structure of a web application" src="/native-client/images/nacl-in-a-web-app.png" />
+<p class="caption">Structure of a web application</p>
+</div>
<p>For more details, see <a class="reference internal" href="/native-client/devguide/coding/application-structure.html"><em>Application Structure</em></a>.</p>
-<h3 id="pepper-plugin-api"><span id="link-pepper"></span>Pepper Plugin API</h3>
-<p>The Pepper Plugin API (PPAPI), called <strong>Pepper</strong> for convenience, is an
-open-source, cross-platform C/C++ API for web browser plugins. From the point
-of view of Native Client, Pepper allows a C/C++ module to communicate with
-the hosting browser and get access to system-level functions in a safe and
-portable way. One of the security constraints in Native Client is that modules
-cannot make any OS-level calls directly. Pepper provides analogous APIs that
-modules can target instead.</p>
+<h3 id="pepper-plug-in-api"><span id="link-pepper"></span>Pepper plug-in API</h3>
+<p>The Pepper plug-in API (PPAPI), called <strong>Pepper</strong> for convenience, is an
+open-source, cross-platform C/C++ API for web browser plug-ins. Pepper allows a
+C/C++ module to communicate with the hosting browser and to access system-level
+functions in a safe and portable way. One of the security constraints in Native
+Client is that modules cannot make OS-level calls. Pepper provides analogous
+APIs that modules can use instead.</p>
<p>You can use the Pepper APIs to gain access to the full array of browser
capabilities, including:</p>
<ul class="small-gap">
@@ -208,22 +225,13 @@ capabilities, including:</p>
<li><a class="reference internal" href="/native-client/devguide/coding/audio.html"><em>Playing audio</em></a>.</li>
<li><a class="reference internal" href="/native-client/devguide/coding/3D-graphics.html"><em>Rendering 3D graphics</em></a>.</li>
</ul>
-<p>Pepper includes both a C API and a C++ API. The C++ API is a set of bindings
-written on top of the C API. For additional information about Pepper, see
-<a class="reference external" href="http://code.google.com/p/ppapi/wiki/Concepts">Pepper Concepts</a>.</p>
-<h2 id="versioning">Versioning</h2>
-<p>Chrome is released on a six week cycle, and developer versions of Chrome are
-pushed to the public beta channel three weeks before each release. As with any
-software, each release of Chrome may include changes to Native Client and the
-Pepper interfaces that may require modification to existing applications.
-However, modules compiled for one version of Pepper/Chrome should work with
-subsequent versions of Pepper/Chrome. The SDK includes multiple versions of the
-Pepper APIs to help developers make adjustments to API changes and take
-advantage of new features: <a class="reference external" href="/native-client/pepper_stable">stable</a>, <a class="reference external" href="/native-client/pepper_beta">beta</a> and <a class="reference external" href="/native-client/pepper_dev">dev</a>.</p>
+<p>Pepper includes both a <a class="reference internal" href="/native-client/c-api.html"><em>C API</em></a> and a <a class="reference internal" href="/native-client/cpp-api.html"><em>C++ API</em></a>.
+The C++ API is a set of bindings written on top of the C API. For additional
+information about Pepper, see <a class="reference external" href="http://code.google.com/p/ppapi/wiki/Concepts">Pepper Concepts</a>.</p>
<h2 id="where-to-start">Where to start</h2>
<p>The <a class="reference internal" href="/native-client/quick-start.html"><em>Quick Start</em></a> document provides links to downloads and
-documentation that should help you get started with developing and distributing
-Native Client applications.</p>
+documentation to help you get started with developing and distributing Native
+Client applications.</p>
</section>
{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/pepper_stable/c-api.html b/native_client_sdk/doc_generated/pepper_stable/c-api.html
new file mode 100644
index 0000000000..3f24e52e0e
--- /dev/null
+++ b/native_client_sdk/doc_generated/pepper_stable/c-api.html
@@ -0,0 +1,171 @@
+{{+bindTo:partials.standard_nacl_article}}
+
+<span class="target" id="pepper-stable-c-index"><span id="c-api"></span></span><section id="pepper-c-api-reference-stable">
+<h1 id="pepper-c-api-reference-stable">Pepper C API Reference (Stable)</h1>
+<p>This page lists the C API for Pepper 35. Apps that use this API can
+run in Chrome 35 or higher.</p>
+<section id="id1">
+<h2 id="id1"><a class="reference external" href="group___interfaces.html">Interfaces</a></h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="struct_p_p_b___audio__1__1.html">PPB_Audio</a></li>
+<li><a class="reference external" href="struct_p_p_b___audio_buffer__0__1.html">PPB_AudioBuffer</a></li>
+<li><a class="reference external" href="struct_p_p_b___audio_config__1__1.html">PPB_AudioConfig</a></li>
+<li><a class="reference external" href="struct_p_p_b___console__1__0.html">PPB_Console</a></li>
+<li><a class="reference external" href="struct_p_p_b___core__1__0.html">PPB_Core</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_i_o__1__1.html">PPB_FileIO</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_mapping__0__1.html">PPB_FileMapping</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_ref__1__2.html">PPB_FileRef</a></li>
+<li><a class="reference external" href="struct_p_p_b___file_system__1__0.html">PPB_FileSystem</a></li>
+<li><a class="reference external" href="struct_p_p_b___fullscreen__1__0.html">PPB_Fullscreen</a></li>
+<li><a class="reference external" href="struct_p_p_b___gamepad__1__0.html">PPB_Gamepad</a></li>
+<li><a class="reference external" href="struct_p_p_b___graphics2_d__1__1.html">PPB_Graphics2D</a></li>
+<li><a class="reference external" href="struct_p_p_b___graphics3_d__1__0.html">PPB_Graphics3D</a></li>
+<li><a class="reference external" href="struct_p_p_b___host_resolver__1__0.html">PPB_HostResolver</a></li>
+<li><a class="reference external" href="struct_p_p_b___i_m_e_input_event__1__0.html">PPB_IMEInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___image_data__1__0.html">PPB_ImageData</a></li>
+<li><a class="reference external" href="struct_p_p_b___input_event__1__0.html">PPB_InputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___instance__1__0.html">PPB_Instance</a></li>
+<li><a class="reference external" href="struct_p_p_b___keyboard_input_event__1__2.html">PPB_KeyboardInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___media_stream_audio_track__0__1.html">PPB_MediaStreamAudioTrack</a></li>
+<li><a class="reference external" href="struct_p_p_b___media_stream_video_track__0__1.html">PPB_MediaStreamVideoTrack</a></li>
+<li><a class="reference external" href="struct_p_p_b___message_loop__1__0.html">PPB_MessageLoop</a></li>
+<li><a class="reference external" href="struct_p_p_b___messaging__1__0.html">PPB_Messaging</a></li>
+<li><a class="reference external" href="struct_p_p_b___mouse_cursor__1__0.html">PPB_MouseCursor</a></li>
+<li><a class="reference external" href="struct_p_p_b___mouse_input_event__1__1.html">PPB_MouseInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___mouse_lock__1__0.html">PPB_MouseLock</a></li>
+<li><a class="reference external" href="struct_p_p_b___net_address__1__0.html">PPB_NetAddress</a></li>
+<li><a class="reference external" href="struct_p_p_b___network_list__1__0.html">PPB_NetworkList</a></li>
+<li><a class="reference external" href="struct_p_p_b___network_monitor__1__0.html">PPB_NetworkMonitor</a></li>
+<li><a class="reference external" href="struct_p_p_b___network_proxy__1__0.html">PPB_NetworkProxy</a></li>
+<li><a class="reference external" href="struct_p_p_b___t_c_p_socket__1__1.html">PPB_TCPSocket</a></li>
+<li><a class="reference external" href="struct_p_p_b___text_input_controller__1__0.html">PPB_TextInputController</a></li>
+<li><a class="reference external" href="struct_p_p_b___touch_input_event__1__0.html">PPB_TouchInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_d_p_socket__1__0.html">PPB_UDPSocket</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_r_l_loader__1__0.html">PPB_URLLoader</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_r_l_request_info__1__0.html">PPB_URLRequestInfo</a></li>
+<li><a class="reference external" href="struct_p_p_b___u_r_l_response_info__1__0.html">PPB_URLResponseInfo</a></li>
+<li><a class="reference external" href="struct_p_p_b___var__1__2.html">PPB_Var</a></li>
+<li><a class="reference external" href="struct_p_p_b___var_array__1__0.html">PPB_VarArray</a></li>
+<li><a class="reference external" href="struct_p_p_b___var_array_buffer__1__0.html">PPB_VarArrayBuffer</a></li>
+<li><a class="reference external" href="struct_p_p_b___var_dictionary__1__0.html">PPB_VarDictionary</a></li>
+<li><a class="reference external" href="struct_p_p_b___video_frame__0__1.html">PPB_VideoFrame</a></li>
+<li><a class="reference external" href="struct_p_p_b___view__1__1.html">PPB_View</a></li>
+<li><a class="reference external" href="struct_p_p_b___web_socket__1__0.html">PPB_WebSocket</a></li>
+<li><a class="reference external" href="struct_p_p_b___wheel_input_event__1__0.html">PPB_WheelInputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_p___graphics3_d__1__0.html">PPP_Graphics3D</a></li>
+<li><a class="reference external" href="struct_p_p_p___input_event__0__1.html">PPP_InputEvent</a></li>
+<li><a class="reference external" href="struct_p_p_p___instance__1__1.html">PPP_Instance</a></li>
+<li><a class="reference external" href="struct_p_p_p___messaging__1__0.html">PPP_Messaging</a></li>
+<li><a class="reference external" href="struct_p_p_p___mouse_lock__1__0.html">PPP_MouseLock</a></li>
+</ul>
+</div></blockquote>
+</section><section id="id2">
+<h2 id="id2"><a class="reference external" href="group___structs.html">Structures</a></h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="struct_p_p___array_output.html">PP_ArrayOutput</a></li>
+<li><a class="reference external" href="struct_p_p___completion_callback.html">PP_CompletionCallback</a></li>
+<li><a class="reference external" href="struct_p_p___directory_entry.html">PP_DirectoryEntry</a></li>
+<li><a class="reference external" href="struct_p_p___file_info.html">PP_FileInfo</a></li>
+<li><a class="reference external" href="struct_p_p___float_point.html">PP_FloatPoint</a></li>
+<li><a class="reference external" href="struct_p_p___gamepad_sample_data.html">PP_GamepadSampleData</a></li>
+<li><a class="reference external" href="struct_p_p___gamepads_sample_data.html">PP_GamepadsSampleData</a></li>
+<li><a class="reference external" href="struct_p_p___host_resolver___hint.html">PP_HostResolver_Hint</a></li>
+<li><a class="reference external" href="struct_p_p___image_data_desc.html">PP_ImageDataDesc</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___character.html">PP_InputEvent_Character</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___key.html">PP_InputEvent_Key</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___mouse.html">PP_InputEvent_Mouse</a></li>
+<li><a class="reference external" href="struct_p_p___input_event___wheel.html">PP_InputEvent_Wheel</a></li>
+<li><a class="reference external" href="struct_p_p___net_address___i_pv4.html">PP_NetAddress_IPv4</a></li>
+<li><a class="reference external" href="struct_p_p___net_address___i_pv6.html">PP_NetAddress_IPv6</a></li>
+<li><a class="reference external" href="struct_p_p___point.html">PP_Point</a></li>
+<li><a class="reference external" href="struct_p_p___rect.html">PP_Rect</a></li>
+<li><a class="reference external" href="struct_p_p___size.html">PP_Size</a></li>
+<li><a class="reference external" href="struct_p_p___touch_point.html">PP_TouchPoint</a></li>
+<li><a class="reference external" href="struct_p_p___var.html">PP_Var</a></li>
+<li><a class="reference external" href="union_p_p___var_value.html">PP_VarValue</a></li>
+</ul>
+</div></blockquote>
+</section><section id="id3">
+<h2 id="id3"><a class="reference external" href="group___functions.html">Functions</a></h2>
+</section><section id="id4">
+<h2 id="id4"><a class="reference external" href="group___enums.html">Enums</a></h2>
+</section><section id="id5">
+<h2 id="id5"><a class="reference external" href="group___typedefs.html">Typedefs</a></h2>
+</section><section id="id6">
+<h2 id="id6"><a class="reference external" href="globals_defs.html">Macros</a></h2>
+</section><section id="files">
+<h2 id="files">Files</h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="pp__array__output_8h.html">pp_array_output.h</a></li>
+<li><a class="reference external" href="pp__bool_8h.html">pp_bool.h</a></li>
+<li><a class="reference external" href="pp__completion__callback_8h.html">pp_completion_callback.h</a></li>
+<li><a class="reference external" href="pp__directory__entry_8h.html">pp_directory_entry.h</a></li>
+<li><a class="reference external" href="pp__errors_8h.html">pp_errors.h</a></li>
+<li><a class="reference external" href="pp__file__info_8h.html">pp_file_info.h</a></li>
+<li><a class="reference external" href="pp__graphics__3d_8h.html">pp_graphics_3d.h</a></li>
+<li><a class="reference external" href="pp__input__event_8h.html">pp_input_event.h</a></li>
+<li><a class="reference external" href="pp__instance_8h.html">pp_instance.h</a></li>
+<li><a class="reference external" href="pp__module_8h.html">pp_module.h</a></li>
+<li><a class="reference external" href="pp__point_8h.html">pp_point.h</a></li>
+<li><a class="reference external" href="pp__rect_8h.html">pp_rect.h</a></li>
+<li><a class="reference external" href="pp__resource_8h.html">pp_resource.h</a></li>
+<li><a class="reference external" href="pp__size_8h.html">pp_size.h</a></li>
+<li><a class="reference external" href="pp__stdint_8h.html">pp_stdint.h</a></li>
+<li><a class="reference external" href="pp__time_8h.html">pp_time.h</a></li>
+<li><a class="reference external" href="pp__touch__point_8h.html">pp_touch_point.h</a></li>
+<li><a class="reference external" href="pp__var_8h.html">pp_var.h</a></li>
+<li><a class="reference external" href="ppb_8h.html">ppb.h</a></li>
+<li><a class="reference external" href="ppb__audio_8h.html">ppb_audio.h</a></li>
+<li><a class="reference external" href="ppb__audio__buffer_8h.html">ppb_audio_buffer.h</a></li>
+<li><a class="reference external" href="ppb__audio__config_8h.html">ppb_audio_config.h</a></li>
+<li><a class="reference external" href="ppb__console_8h.html">ppb_console.h</a></li>
+<li><a class="reference external" href="ppb__core_8h.html">ppb_core.h</a></li>
+<li><a class="reference external" href="ppb__file__io_8h.html">ppb_file_io.h</a></li>
+<li><a class="reference external" href="ppb__file__mapping_8h.html">ppb_file_mapping.h</a></li>
+<li><a class="reference external" href="ppb__file__ref_8h.html">ppb_file_ref.h</a></li>
+<li><a class="reference external" href="ppb__file__system_8h.html">ppb_file_system.h</a></li>
+<li><a class="reference external" href="ppb__fullscreen_8h.html">ppb_fullscreen.h</a></li>
+<li><a class="reference external" href="ppb__gamepad_8h.html">ppb_gamepad.h</a></li>
+<li><a class="reference external" href="ppb__graphics__2d_8h.html">ppb_graphics_2d.h</a></li>
+<li><a class="reference external" href="ppb__graphics__3d_8h.html">ppb_graphics_3d.h</a></li>
+<li><a class="reference external" href="ppb__host__resolver_8h.html">ppb_host_resolver.h</a></li>
+<li><a class="reference external" href="ppb__image__data_8h.html">ppb_image_data.h</a></li>
+<li><a class="reference external" href="ppb__input__event_8h.html">ppb_input_event.h</a></li>
+<li><a class="reference external" href="ppb__instance_8h.html">ppb_instance.h</a></li>
+<li><a class="reference external" href="ppb__media__stream__audio__track_8h.html">ppb_media_stream_audio_track.h</a></li>
+<li><a class="reference external" href="ppb__media__stream__video__track_8h.html">ppb_media_stream_video_track.h</a></li>
+<li><a class="reference external" href="ppb__message__loop_8h.html">ppb_message_loop.h</a></li>
+<li><a class="reference external" href="ppb__messaging_8h.html">ppb_messaging.h</a></li>
+<li><a class="reference external" href="ppb__mouse__cursor_8h.html">ppb_mouse_cursor.h</a></li>
+<li><a class="reference external" href="ppb__mouse__lock_8h.html">ppb_mouse_lock.h</a></li>
+<li><a class="reference external" href="ppb__net__address_8h.html">ppb_net_address.h</a></li>
+<li><a class="reference external" href="ppb__network__list_8h.html">ppb_network_list.h</a></li>
+<li><a class="reference external" href="ppb__network__monitor_8h.html">ppb_network_monitor.h</a></li>
+<li><a class="reference external" href="ppb__network__proxy_8h.html">ppb_network_proxy.h</a></li>
+<li><a class="reference external" href="ppb__tcp__socket_8h.html">ppb_tcp_socket.h</a></li>
+<li><a class="reference external" href="ppb__text__input__controller_8h.html">ppb_text_input_controller.h</a></li>
+<li><a class="reference external" href="ppb__udp__socket_8h.html">ppb_udp_socket.h</a></li>
+<li><a class="reference external" href="ppb__url__loader_8h.html">ppb_url_loader.h</a></li>
+<li><a class="reference external" href="ppb__url__request__info_8h.html">ppb_url_request_info.h</a></li>
+<li><a class="reference external" href="ppb__url__response__info_8h.html">ppb_url_response_info.h</a></li>
+<li><a class="reference external" href="ppb__var_8h.html">ppb_var.h</a></li>
+<li><a class="reference external" href="ppb__var__array_8h.html">ppb_var_array.h</a></li>
+<li><a class="reference external" href="ppb__var__array__buffer_8h.html">ppb_var_array_buffer.h</a></li>
+<li><a class="reference external" href="ppb__var__dictionary_8h.html">ppb_var_dictionary.h</a></li>
+<li><a class="reference external" href="ppb__video__frame_8h.html">ppb_video_frame.h</a></li>
+<li><a class="reference external" href="ppb__view_8h.html">ppb_view.h</a></li>
+<li><a class="reference external" href="ppb__websocket_8h.html">ppb_websocket.h</a></li>
+<li><a class="reference external" href="ppp_8h.html">ppp.h</a></li>
+<li><a class="reference external" href="ppp__graphics__3d_8h.html">ppp_graphics_3d.h</a></li>
+<li><a class="reference external" href="ppp__input__event_8h.html">ppp_input_event.h</a></li>
+<li><a class="reference external" href="ppp__instance_8h.html">ppp_instance.h</a></li>
+<li><a class="reference external" href="ppp__messaging_8h.html">ppp_messaging.h</a></li>
+<li><a class="reference external" href="ppp__mouse__lock_8h.html">ppp_mouse_lock.h</a></li>
+</ul>
+</div></blockquote>
+</section></section>
+
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/pepper_stable/cpp-api.html b/native_client_sdk/doc_generated/pepper_stable/cpp-api.html
new file mode 100644
index 0000000000..1fb5b380ee
--- /dev/null
+++ b/native_client_sdk/doc_generated/pepper_stable/cpp-api.html
@@ -0,0 +1,130 @@
+{{+bindTo:partials.standard_nacl_article}}
+
+<span class="target" id="pepper-stable-cpp-index"><span id="cpp-api"></span></span><section id="pepper-c-api-reference-stable">
+<h1 id="pepper-c-api-reference-stable">Pepper C++ API Reference (Stable)</h1>
+<p>This page lists the C++ API for Pepper 35. Apps that use this API can
+run in Chrome 35 or higher.</p>
+<section id="id1">
+<h2 id="id1"><a class="reference external" href="inherits.html">Classes</a></h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="classpp_1_1_audio.html">Audio</a></li>
+<li><a class="reference external" href="classpp_1_1_audio_buffer.html">AudioBuffer</a></li>
+<li><a class="reference external" href="classpp_1_1_audio_config.html">AudioConfig</a></li>
+<li><a class="reference external" href="classpp_1_1_completion_callback.html">CompletionCallback</a></li>
+<li><a class="reference external" href="classpp_1_1_completion_callback_factory.html">CompletionCallbackFactory</a></li>
+<li><a class="reference external" href="classpp_1_1_completion_callback_with_output.html">CompletionCallbackWithOutput</a></li>
+<li><a class="reference external" href="classpp_1_1_core.html">Core</a></li>
+<li><a class="reference external" href="classpp_1_1_directory_entry.html">DirectoryEntry</a></li>
+<li><a class="reference external" href="classpp_1_1_file_i_o.html">FileIO</a></li>
+<li><a class="reference external" href="classpp_1_1_file_ref.html">FileRef</a></li>
+<li><a class="reference external" href="classpp_1_1_file_system.html">FileSystem</a></li>
+<li><a class="reference external" href="classpp_1_1_float_point.html">FloatPoint</a></li>
+<li><a class="reference external" href="classpp_1_1_fullscreen.html">Fullscreen</a></li>
+<li><a class="reference external" href="classpp_1_1_graphics2_d.html">Graphics2D</a></li>
+<li><a class="reference external" href="classpp_1_1_graphics3_d.html">Graphics3D</a></li>
+<li><a class="reference external" href="classpp_1_1_graphics3_d_client.html">Graphics3DClient</a></li>
+<li><a class="reference external" href="classpp_1_1_host_resolver.html">HostResolver</a></li>
+<li><a class="reference external" href="classpp_1_1_i_m_e_input_event.html">IMEInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_image_data.html">ImageData</a></li>
+<li><a class="reference external" href="classpp_1_1_input_event.html">InputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_instance.html">Instance</a></li>
+<li><a class="reference external" href="classpp_1_1_instance_handle.html">InstanceHandle</a></li>
+<li><a class="reference external" href="classpp_1_1_keyboard_input_event.html">KeyboardInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_media_stream_audio_track.html">MediaStreamAudioTrack</a></li>
+<li><a class="reference external" href="classpp_1_1_media_stream_video_track.html">MediaStreamVideoTrack</a></li>
+<li><a class="reference external" href="classpp_1_1_message_loop.html">MessageLoop</a></li>
+<li><a class="reference external" href="classpp_1_1_module.html">Module</a></li>
+<li><a class="reference external" href="classpp_1_1_mouse_cursor.html">MouseCursor</a></li>
+<li><a class="reference external" href="classpp_1_1_mouse_input_event.html">MouseInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_mouse_lock.html">MouseLock</a></li>
+<li><a class="reference external" href="classpp_1_1_net_address.html">NetAddress</a></li>
+<li><a class="reference external" href="classpp_1_1_network_list.html">NetworkList</a></li>
+<li><a class="reference external" href="classpp_1_1_network_monitor.html">NetworkMonitor</a></li>
+<li><a class="reference external" href="classpp_1_1_network_proxy.html">NetworkProxy</a></li>
+<li><a class="reference external" href="classpp_1_1_point.html">Point</a></li>
+<li><a class="reference external" href="classpp_1_1_rect.html">Rect</a></li>
+<li><a class="reference external" href="classpp_1_1_resource.html">Resource</a></li>
+<li><a class="reference external" href="classpp_1_1_size.html">Size</a></li>
+<li><a class="reference external" href="classpp_1_1_t_c_p_socket.html">TCPSocket</a></li>
+<li><a class="reference external" href="classpp_1_1_text_input_controller.html">TextInputController</a></li>
+<li><a class="reference external" href="classpp_1_1_touch_input_event.html">TouchInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1_touch_point.html">TouchPoint</a></li>
+<li><a class="reference external" href="classpp_1_1_u_d_p_socket.html">UDPSocket</a></li>
+<li><a class="reference external" href="classpp_1_1_u_r_l_loader.html">URLLoader</a></li>
+<li><a class="reference external" href="classpp_1_1_u_r_l_request_info.html">URLRequestInfo</a></li>
+<li><a class="reference external" href="classpp_1_1_u_r_l_response_info.html">URLResponseInfo</a></li>
+<li><a class="reference external" href="classpp_1_1_var.html">Var</a></li>
+<li><a class="reference external" href="classpp_1_1_var_1_1_out_exception.html">Var11OutException</a></li>
+<li><a class="reference external" href="classpp_1_1_var_array.html">VarArray</a></li>
+<li><a class="reference external" href="classpp_1_1_var_array_buffer.html">VarArrayBuffer</a></li>
+<li><a class="reference external" href="classpp_1_1_var_dictionary.html">VarDictionary</a></li>
+<li><a class="reference external" href="classpp_1_1_video_frame.html">VideoFrame</a></li>
+<li><a class="reference external" href="classpp_1_1_view.html">View</a></li>
+<li><a class="reference external" href="classpp_1_1_web_socket.html">WebSocket</a></li>
+<li><a class="reference external" href="classpp_1_1_wheel_input_event.html">WheelInputEvent</a></li>
+<li><a class="reference external" href="classpp_1_1ext_1_1_ext_completion_callback_with_output.html">Ext::ExtCompletionCallbackWithOutput</a></li>
+<li><a class="reference external" href="classpp_1_1internal_1_1_completion_callback_with_output_base.html">Internal::CompletionCallbackWithOutputBase</a></li>
+<li><a class="reference external" href="classpp_1_1internal_1_1_directory_entry_array_output_adapter_with_storage.html">Internal::DirectoryEntryArrayOutputAdapterWithStorage</a></li>
+</ul>
+</div></blockquote>
+</section><section id="files">
+<h2 id="files">Files</h2>
+<blockquote>
+<div><ul class="small-gap">
+<li><a class="reference external" href="audio_8h.html">audio.h</a></li>
+<li><a class="reference external" href="audio__buffer_8h.html">audio_buffer.h</a></li>
+<li><a class="reference external" href="audio__config_8h.html">audio_config.h</a></li>
+<li><a class="reference external" href="completion__callback_8h.html">completion_callback.h</a></li>
+<li><a class="reference external" href="completion__callback__factory_8h.html">completion_callback_factory.h</a></li>
+<li><a class="reference external" href="core_8h.html">core.h</a></li>
+<li><a class="reference external" href="directory__entry_8h.html">directory_entry.h</a></li>
+<li><a class="reference external" href="file__io_8h.html">file_io.h</a></li>
+<li><a class="reference external" href="file__ref_8h.html">file_ref.h</a></li>
+<li><a class="reference external" href="file__system_8h.html">file_system.h</a></li>
+<li><a class="reference external" href="fullscreen_8h.html">fullscreen.h</a></li>
+<li><a class="reference external" href="graphics__2d_8h.html">graphics_2d.h</a></li>
+<li><a class="reference external" href="graphics__3d_8h.html">graphics_3d.h</a></li>
+<li><a class="reference external" href="graphics__3d__client_8h.html">graphics_3d_client.h</a></li>
+<li><a class="reference external" href="host__resolver_8h.html">host_resolver.h</a></li>
+<li><a class="reference external" href="image__data_8h.html">image_data.h</a></li>
+<li><a class="reference external" href="input__event_8h.html">input_event.h</a></li>
+<li><a class="reference external" href="instance_8h.html">instance.h</a></li>
+<li><a class="reference external" href="instance__handle_8h.html">instance_handle.h</a></li>
+<li><a class="reference external" href="logging_8h.html">logging.h</a></li>
+<li><a class="reference external" href="media__stream__audio__track_8h.html">media_stream_audio_track.h</a></li>
+<li><a class="reference external" href="media__stream__video__track_8h.html">media_stream_video_track.h</a></li>
+<li><a class="reference external" href="message__loop_8h.html">message_loop.h</a></li>
+<li><a class="reference external" href="module_8h.html">module.h</a></li>
+<li><a class="reference external" href="module__embedder_8h.html">module_embedder.h</a></li>
+<li><a class="reference external" href="module__impl_8h.html">module_impl.h</a></li>
+<li><a class="reference external" href="mouse__cursor_8h.html">mouse_cursor.h</a></li>
+<li><a class="reference external" href="mouse__lock_8h.html">mouse_lock.h</a></li>
+<li><a class="reference external" href="net__address_8h.html">net_address.h</a></li>
+<li><a class="reference external" href="network__list_8h.html">network_list.h</a></li>
+<li><a class="reference external" href="network__monitor_8h.html">network_monitor.h</a></li>
+<li><a class="reference external" href="network__proxy_8h.html">network_proxy.h</a></li>
+<li><a class="reference external" href="pass__ref_8h.html">pass_ref.h</a></li>
+<li><a class="reference external" href="point_8h.html">point.h</a></li>
+<li><a class="reference external" href="rect_8h.html">rect.h</a></li>
+<li><a class="reference external" href="resource_8h.html">resource.h</a></li>
+<li><a class="reference external" href="size_8h.html">size.h</a></li>
+<li><a class="reference external" href="tcp__socket_8h.html">tcp_socket.h</a></li>
+<li><a class="reference external" href="text__input__controller_8h.html">text_input_controller.h</a></li>
+<li><a class="reference external" href="touch__point_8h.html">touch_point.h</a></li>
+<li><a class="reference external" href="udp__socket_8h.html">udp_socket.h</a></li>
+<li><a class="reference external" href="url__loader_8h.html">url_loader.h</a></li>
+<li><a class="reference external" href="url__request__info_8h.html">url_request_info.h</a></li>
+<li><a class="reference external" href="url__response__info_8h.html">url_response_info.h</a></li>
+<li><a class="reference external" href="var_8h.html">var.h</a></li>
+<li><a class="reference external" href="var__array_8h.html">var_array.h</a></li>
+<li><a class="reference external" href="var__array__buffer_8h.html">var_array_buffer.h</a></li>
+<li><a class="reference external" href="var__dictionary_8h.html">var_dictionary.h</a></li>
+<li><a class="reference external" href="video__frame_8h.html">video_frame.h</a></li>
+<li><a class="reference external" href="view_8h.html">view.h</a></li>
+<li><a class="reference external" href="websocket_8h.html">websocket.h</a></li>
+</ul>
+</div></blockquote>
+</section></section>
+
+{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/pepper_stable/index.html b/native_client_sdk/doc_generated/pepper_stable/index.html
index 11a4fb0b02..eb2ac04763 100644
--- a/native_client_sdk/doc_generated/pepper_stable/index.html
+++ b/native_client_sdk/doc_generated/pepper_stable/index.html
@@ -4,8 +4,8 @@
<h1 id="pepper-api-reference-stable">Pepper API Reference (Stable)</h1>
<p>This page lists the API for Pepper 35. Apps that use this API can
run in Chrome 35 or higher.</p>
-<h2 id="pepper-c-api-reference"><a class="reference internal" href="/native-client/pepper_stable/c/index.html#pepper-stable-c-index"><em>Pepper C API Reference</em></a></h2>
-<h2 id="id1"><a class="reference internal" href="/native-client/pepper_stable/cpp/index.html#pepper-stable-cpp-index"><em>Pepper C++ API Reference</em></a></h2>
+<h2 id="pepper-c-api-reference"><a class="reference internal" href="/native-client/c-api.html#pepper-stable-c-index"><em>Pepper C API Reference</em></a></h2>
+<h2 id="id1"><a class="reference internal" href="/native-client/cpp-api.html#pepper-stable-cpp-index"><em>Pepper C++ API Reference</em></a></h2>
</section>
{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/sdk/download.html b/native_client_sdk/doc_generated/sdk/download.html
index 9961ec9b64..9045bb9c18 100644
--- a/native_client_sdk/doc_generated/sdk/download.html
+++ b/native_client_sdk/doc_generated/sdk/download.html
@@ -2,107 +2,93 @@
<section id="download-the-native-client-sdk">
<span id="download"></span><h1 id="download-the-native-client-sdk"><span id="download"></span>Download the Native Client SDK</h1>
-<p>To build Native Client modules, you must download and install the Native
-Client Software Development Kit (SDK). This page provides an overview
-of the Native Client SDK, and instructions for how to download and
-install the SDK.</p>
-<h2 id="overview">Overview</h2>
-<p>The Native Client SDK includes the following:</p>
-<dl class="docutils">
-<dt>support for multiple Pepper versions</dt>
-<dd>The SDK contains <strong>bundles</strong> that let you compile Native Client modules
-using different versions of the
-<a class="reference internal" href="/native-client/overview.html#link-pepper"><em>Pepper Plugin API</em></a> (e.g., Pepper 31 or Pepper Canary). Review the
-<a class="reference internal" href="/native-client/sdk/release-notes.html"><em>Release Notes</em></a> for a description of the new features
-included in each Pepper version to help you decide which bundle to
-use to develop your application. In general, Native Client modules
-compiled using a particular Pepper version will work in
-corresponding versions of Chrome and higher. For example, a module
-compiled using the Pepper 31 bundle will work in Chrome 31 and
-higher.</dd>
-<dt>update utility</dt>
-<dd>The <code>naclsdk</code> utility (<code>naclsdk.bat</code> on Windows) lets you download new
-bundles that are available, as well as new versions of existing bundles.</dd>
-<dt>toolchains</dt>
-<dd>Each platform includes three toolchains: one for compiling
-Portable Native Client (PNaCl) applications, one for compiling
-architecture-specific Native Client applications with newlib, and
-one for compiling architecture-specific Native Client applications with glibc.
-Newlib and glibc are two different implementations
-of the C standard library. All three toolchains contain
-Native Client-compatible versions of standard compilers, linkers,
-and other tools. See <a class="reference internal" href="/native-client/nacl-and-pnacl.html"><em>NaCl and PNaCl</em></a> to help
-you choose the right toolchain.</dd>
-<dt>examples</dt>
-<dd>Each example in the SDK includes C or C++ source files and header files
-illustrating how to use NaCl and Pepper, along with a Makefile to build
-the example using each of the toolchains.</dd>
-<dt>tools</dt>
-<dd>The SDK includes a number of additional tools that you can use for
-tasks such as validating Native Client modules and running modules
-from the command line.</dd>
-</dl>
-<p>Follow the steps below to download and install the Native Client SDK.</p>
-<h2 id="prerequisites">Prerequisites</h2>
+<p>This page provides an overview of the Native Client SDK, and instructions for
+downloading and installing the SDK.</p>
+<div id="home">
+<a class="button-nacl button-download" href="http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip">Download SDK Zip File</a>
+</div><h2 id="overview"><span id="sdk-overview"></span>Overview</h2>
+<p>The Native Client SDK includes:</p>
<ul class="small-gap">
-<li><p class="first"><strong>Python:</strong> Make sure you have Python 2.6 or 2.7 installed, and that the
-Python executable is in your path.</p>
+<li><strong>Support for multiple Pepper versions</strong> to compile for specific minimum
+versions of Chrome.</li>
+<li><strong>Update utility</strong> to download new bundles and updates to existing bundles.</li>
+<li><strong>Toolchains</strong> to compile for Portable Native Client (PNaCl), traditional
+Native Client (NaCl), and for compiling architecture-specific Native Client
+applications with glibc.</li>
+<li><strong>Examples</strong> Including C or C++ source files and header files illustrating
+how to use NaCl and Pepper, and Makefiles to build the example with each of
+the toolchains.</li>
+<li><strong>Tools</strong> for validating Native Client modules and running modules from the
+command line.</li>
+</ul>
+<p>Follow the steps below to download and install the Native Client SDK.</p>
+<h2 id="prerequisites"><span id="id1"></span>Prerequisites</h2>
+<h3 id="python-2-7"><span id="python26-27"></span>Python 2.7</h3>
+<p>Make sure that the Python executable is in your <code>PATH</code> variable. Python 3.x is
+not yet supported.</p>
<ul class="small-gap">
-<li>On Mac/Linux, Python is likely preinstalled. Run the command <code>&quot;python
--V</code>&#8221; in a terminal window, and make sure that the version of Python you
-have is 2.6.x or 2.7.x (if it&#8217;s not, upgrade to one of those versions).</li>
-<li>On Windows, you may need to install Python. Go to
-<a class="reference external" href="http://www.python.org/download/">http://www.python.org/download/</a> and
-select the latest 2.x version. In addition, be sure to add the Python
-directory (for example, <code>C:\python27</code>) to the PATH <a class="reference external" href="http://en.wikipedia.org/wiki/Environment_variable">environment
-variable</a>. After
-you&#8217;ve installed Python, run the command <code>&quot;python -V</code>&#8221; in a Command
-Prompt window and verify that the version of Python you have is 2.6.x or
+<li>On Mac and Linux, Python is likely preinstalled. Run the command <code>python -V</code>
+in a terminal window, and make sure that the version you have is 2.6.x or
2.7.x.</li>
-<li>Note that Python 3.x is not yet supported.</li>
+<li>On Windows, you may need to install Python. Go to <a class="reference external" href="http://www.python.org/download/">http://www.python.org/
+download/</a> and select the latest 2.x
+version. In addition, be sure to add the Python directory (for example,
+<code>C:\python27</code>) to the <code>PATH</code> <a class="reference external" href="http://en.wikipedia.org/wiki/Environment_variable">environment variable</a>. Run <code>python -V</code> from a command line to
+verify that you properly configured the PATH variable.</li>
</ul>
-</li>
-<li><strong>Make:</strong> On the Mac, you need to install the <code>make</code> command on your system
-before you can build and run the examples in the SDK. One easy way to get
-<code>make</code>, along with several other useful tools, is to install
-<a class="reference external" href="https://developer.apple.com/technologies/tools/">Xcode Developer Tools</a>.
-After installing Xcode, go to the Preferences menu, select
-Downloads and Components, and verify that Command Line Tools are installed.
-If you&#8217;d rather not install Xcode, you can download and build an
-<a class="reference external" href="http://mac.softpedia.com/dyn-postdownload.php?p=44632&amp;t=4&amp;i=1">open source version</a> of
-<code>make</code>. In order to build the command you may also need to download and
-install a copy of <a class="reference external" href="https://github.com/kennethreitz/osx-gcc-installer">gcc</a>.</li>
+<h3 id="make"><span id="id2"></span>Make</h3>
+<ul class="small-gap">
+<li>On the Mac, you need to install <code>make</code> on your system before you can build
+and run the examples in the SDK. One easy way to get <code>make</code>, along with
+several other useful tools, is to install <a class="reference external" href="https://developer.apple.com/technologies/tools/">Xcode Developer Tools</a>. After installing Xcode,
+go to the XCode menu, open the Preferences dialog box then select Downloads
+and Components. Verify that Command Line Tools are installed. If you&#8217;d rather
+not install Xcode, you can download and build an <a class="reference external" href="http://mac.softpedia.com/dyn-postdownload.php?p=44632&amp;t=4&amp;i=1">open source version</a> of <code>make</code>.
+To build the program you may also need to download and install <a class="reference external" href="https://github.com/kennethreitz/osx-gcc-installer">gcc</a>.</li>
+<li>On Windows, the Native Client SDK includes a copy of GNU Make.</li>
</ul>
-<h2 id="download-and-install-the-sdk">Download and install the SDK</h2>
+<h2 id="versioning"><span id="id3"></span>Versioning</h2>
+<p>Chrome is released on a six week cycle, and developer versions of Chrome are
+pushed to the public beta channel three weeks before each release. As with any
+software, each release of Chrome may include changes to Native Client and the
+Pepper interfaces that may require modification to existing applications.
+However, modules compiled for one version of Pepper/Chrome should work with
+subsequent versions of Pepper/Chrome. The SDK includes multiple versions of the
+Pepper APIs to help developers make adjustments to API changes and take
+advantage of new features: <a class="reference external" href="/native-client/pepper_stable">stable</a>, <a class="reference external" href="/native-client/pepper_beta">beta</a> and <a class="reference external" href="/native-client/pepper_dev">dev</a>.</p>
+<h2 id="installing-the-sdk"><span id="id4"></span>Installing the SDK</h2>
+<h3 id="downloading-and-unzipping"><span id="id5"></span>Downloading and Unzipping</h3>
<ol class="arabic">
-<li><p class="first">Download the SDK update utility: <a class="reference external" href="http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip">nacl_sdk.zip</a>.</p>
+<li><p class="first">Download the <a class="reference external" href="http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip">SDK update zip file</a>.</p>
</li>
-<li><p class="first">Unzip the SDK update utility:</p>
+<li><p class="first">Unzip the file:</p>
<ul class="small-gap">
-<li><p class="first">On Mac/Linux, run the command &#8220;<code>unzip nacl_sdk.zip</code>&#8221; in a terminal
+<li><p class="first">On Mac/Linux, run the command <code>unzip nacl_sdk.zip</code> in a terminal
window.</p>
</li>
<li><p class="first">On Windows, right-click on the .zip file and select &#8220;Extract All...&#8221;. A
-dialog box will open; enter a location and click &#8220;Extract&#8221;.</p>
+dialog box opens; enter a location and click &#8220;Extract&#8221;.</p>
</li>
</ul>
-<p>Unzipping the SDK update utility creates a directory called <code>nacl_sdk</code> with
-the following files and directories:</p>
+<p>A directory is created called <code>nacl_sdk</code> with the following files and
+directories:</p>
<ul class="small-gap">
-<li><p class="first"><code>naclsdk</code> (and <code>naclsdk.bat</code> for Windows) &#8212; the front end of the update
-utility, i.e., the command you run to download the latest bundles</p>
+<li><p class="first"><code>naclsdk</code> (and <code>naclsdk.bat</code> for Windows) &#8212; the update utility,
+which is the command you run to download and update bundles.</p>
</li>
<li><p class="first"><code>sdk_cache</code> &#8212; a directory with a manifest file that lists the bundles
-you have already downloaded</p>
+you have already downloaded.</p>
</li>
-<li><p class="first"><code>sdk_tools</code> &#8212; the back end of the update utility, also known as the
-&#8220;sdk_tools&#8221; bundle</p>
+<li><p class="first"><code>sdk_tools</code> &#8212; the code run by the <code>naclsdk</code> command.</p>
</li>
</ul>
</li>
-<li><p class="first">To see the SDK bundles that are available for download, go to the <code>nacl_sdk</code>
-directory and run <code>naclsdk</code> with the <code>&quot;list&quot;</code> command.
-The SDK includes a separate bundle for each version of Chrome/Pepper.</p>
+</ol>
+<h3 id="installing-the-stable-bundle"><span id="id6"></span>Installing the stable bundle</h3>
+<ol class="arabic">
+<li><p class="first">To see the SDK bundles that are available for download, go to the
+<code>nacl_sdk</code> directory and run <code>naclsdk</code> with the <code>list</code> command. The SDK
+includes a separate bundle for each version of Chrome/Pepper.</p>
<p>On Mac/Linux:</p>
<pre class="prettyprint">
$ cd nacl_sdk
@@ -121,28 +107,30 @@ Bundles:
I sdk_tools (stable)
vs_addin (dev)
- pepper_27 (post_stable)
- pepper_28 (post_stable)
- pepper_29 (post_stable)
- pepper_30 (post_stable)
- pepper_31 (stable)
- pepper_32 (beta)
+ pepper_31 (post_stable)
+ pepper_32 (post_stable)
+ pepper_33 (post_stable)
+ pepper_34 (post_stable)
+ pepper_35 (stable)
+ pepper_36 (beta)
+ pepper_37 (dev)
pepper_canary (canary)
-</pre>
-<p>The sample output above shows that there are a number of bundles available
-for download, and that you have already installed the latest revision of the
-<code>sdk_tools</code> bundle (it was included in the zip file you downloaded).
-Each bundle is labeled post-stable, stable, beta, dev, or canary.
-These labels usually correspond to the current versions of
-Chrome. (In the example above, Chrome 31 is stable, Chrome 32 is beta, etc.).
-We generally recommend that you download and use a &#8220;stable&#8221; bundle,
-as applications developed with &#8220;stable&#8221; bundles can be used by all current
-Chrome users. This is because Native Client is designed to be
-backward-compatible (for example, applications developed with the
-<code>pepper_31</code> bundle can run in Chrome 31, Chrome 32, etc.).
-Thus in the example above, <code>pepper_31</code> is the recommended bundle to use.</p>
+ bionic_canary (canary)
+</pre>
+<p>The sample output above shows that several bundles are available for
+download, and that you have already installed the latest revision of the
+<code>sdk_tools</code> bundle, which was included in the zip file. You never need to
+update the <code>sdk_tools</code> bundle. It is updated automatically (if necessary)
+whenever you run <code>naclsdk</code>.</p>
+<p>Bundles are labeled post-stable, stable, beta, dev, or canary. These labels
+usually correspond to the current versions of Chrome. We recommend that you
+develop against a &#8220;stable&#8221; bundle, because such bundles can be used by all
+current Chrome users. Native Client is designed to be backward-compatible.For
+example, applications developed with the <code>pepper_31</code> bundle can run in
+Chrome 31, Chrome 32, etc..</p>
</li>
-<li><p class="first">Run <code>naclsdk</code> with the &#8220;update&#8221; command to download recommended bundles.</p>
+<li><p class="first">Run <code>naclsdk</code> with the <code>update</code> command to download recommended bundles,
+including the current &#8220;stable&#8221; bundle.</p>
<p>On Mac/Linux:</p>
<pre class="prettyprint">
$ ./naclsdk update
@@ -151,25 +139,19 @@ $ ./naclsdk update
<pre class="prettyprint">
&gt; naclsdk update
</pre>
-<p>By default, <code>naclsdk</code> only downloads bundles that are
-recommended&#8212;generally those that are &#8220;stable.&#8221; Continuing with the earlier example, the
-&#8220;update&#8221; command would only download the <code>pepper_31</code>
-bundle, since the bundles <code>pepper_32</code> and greater are not yet stable.
-If you want the <code>pepper_32</code> bundle, you must ask for it explicitly:</p>
+<p>By default, <code>naclsdk</code> only downloads bundles that are recommended,
+generally those that are &#8220;stable.&#8221; For example, if the current &#8220;stable&#8221;
+bundle is <code>pepper_35</code>, then the <code>update</code> downloads that bundle. To
+download the <code>pepper_36</code> bundle you must ask for it explicitly:</p>
<pre class="prettyprint">
-$ ./naclsdk update pepper_32
+$ ./naclsdk update pepper_36
</pre>
-<p>Note that you never need to update the <code>sdk_tools</code> bundle&#8212;it is
-updated automatically (if necessary) whenever you run <code>naclsdk</code>.</p>
</li>
</ol>
-<aside class="note">
-The minimum SDK bundle that supports PNaCl is <code>pepper_31</code>.
-</aside>
-<h2 id="staying-up-to-date-and-getting-new-versions-of-bundles">Staying up-to-date and getting new versions of bundles</h2>
+<h2 id="updating-bundles"><span id="id7"></span>Updating bundles</h2>
<ol class="arabic">
-<li><p class="first">Run <code>naclsdk</code> with the &#8220;list&#8221; command again; this will show you the list of
-available bundles and verify which bundles you have installed.</p>
+<li><p class="first">Run <code>naclsdk</code> with the <code>list</code> command. This shows you the list of available
+bundles and verifies which bundles you have installed.</p>
<p>On Mac/Linux:</p>
<pre class="prettyprint">
$ ./naclsdk list
@@ -178,8 +160,8 @@ $ ./naclsdk list
<pre class="prettyprint">
&gt; naclsdk list
</pre>
-<p>Continuing with the earlier example, if you previously downloaded the
-<code>pepper_31</code> bundle, you should see output similar to this:</p>
+<p>An asterisk (*) next to a bundle indicates that there is an update available
+it. For example:</p>
<pre class="prettyprint">
Bundles:
I: installed
@@ -187,58 +169,25 @@ Bundles:
I sdk_tools (stable)
vs_addin (dev)
- pepper_27 (post_stable)
- pepper_28 (post_stable)
- pepper_29 (post_stable)
- pepper_30 (post_stable)
- I pepper_31 (stable)
- pepper_32 (beta)
+ pepper_31 (post_stable)
+ pepper_32 (post_stable)
+ pepper_33 (post_stable)
+ pepper_34 (post_stable)
+ I* pepper_35 (stable)
+ pepper_36 (beta)
+ pepper_37 (dev)
pepper_canary (canary)
+ bionic_canary (canary)
</pre>
-</li>
-<li><p class="first">Running <code>naclsdk</code> with the &#8220;update&#8221; command again will verify that your
-bundles are up-to-date, or warn if you there are new versions of previously
-installed bundles.</p>
-<p>On Mac/Linux:</p>
-<pre class="prettyprint">
-$ ./naclsdk update
-</pre>
-<p>On Windows:</p>
-<pre class="prettyprint">
-&gt; naclsdk update
-</pre>
-<p>Continuing with the earlier example, you should see output similar to this:</p>
+<p>If you run <code>naclsdk update</code> now, it warns you with a message similar to
+this:</p>
<pre class="prettyprint">
-pepper_31 is already up-to-date.
+WARNING: pepper_35 already exists, but has an update available. Run update
+with the --force option to overwrite the existing directory. Warning: This
+will overwrite any modifications you have made within this directory.
</pre>
</li>
-<li><p class="first">To check if there is a new version of a previously installed bundle, you can
-run the &#8220;list&#8221; command again:</p>
-<pre class="prettyprint">
-Bundles:
- I: installed
- *: update available
-
- I sdk_tools (stable)
- vs_addin (dev)
- pepper_27 (post_stable)
- pepper_28 (post_stable)
- pepper_29 (post_stable)
- pepper_30 (post_stable)
- I* pepper_31 (stable)
- pepper_32 (beta)
- pepper_canary (canary)
-</pre>
-<p>An asterisk next to a bundle indicates that there is an update
-available for that bundle. If you run the &#8220;update&#8221; command now,
-<code>naclsdk</code> will warn you with a message similar to this:</p>
-<pre class="prettyprint">
-WARNING: pepper_31 already exists, but has an update available.
-Run update with the --force option to overwrite the existing directory.
-Warning: This will overwrite any modifications you have made within this directory.
-</pre>
-<p>To dowload the new version of a bundle and overwrite the existing directory
-for that bundle, run <code>naclsdk</code> with the <code>--force</code> option.</p>
+<li><p class="first">To download and install the new bundle, run:</p>
<p>On Mac/Linux:</p>
<pre class="prettyprint">
$ ./naclsdk update --force
@@ -248,6 +197,9 @@ $ ./naclsdk update --force
&gt; naclsdk update --force
</pre>
</li>
+</ol>
+<h2 id="help-with-the-naclsdk-utility"><span id="id8"></span>Help with the <code>naclsdk</code> utility</h2>
+<ol class="arabic">
<li><p class="first">For more information about the <code>naclsdk</code> utility, run:</p>
<p>On Mac/Linux:</p>
<pre class="prettyprint">
@@ -259,15 +211,15 @@ $ ./naclsdk help
</pre>
</li>
</ol>
-<p>Next steps:</p>
+<h2 id="next-steps"><span id="id9"></span>Next steps</h2>
<ul class="small-gap">
-<li>Browse through the <a class="reference internal" href="/native-client/sdk/release-notes.html"><em>Release Notes</em></a> for important
+<li>Browse the <a class="reference external" href="release-notes">Release Notes</a> for important
information about the SDK and new bundles.</li>
-<li>If you&#8217;re just getting started with Native Client, we recommend reading
-the <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a> and walking through the
-<a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part1.html"><em>Getting Started Tutorial</em></a>.</li>
-<li>If you&#8217;d rather dive into information about the toolchains, see
-<a class="reference internal" href="/native-client/devguide/devcycle/building.html"><em>Building Native Client Modules</em></a>.</li>
+<li>If you&#8217;re just starting with Native Client, we recommend reading the
+<a class="reference external" href="../overview">Technical Overview</a> and walking through the
+<a class="reference external" href="devguide/tutorial/tutorial-part1">Getting Started Tutorial</a>.</li>
+<li>If you&#8217;d rather dive in, see
+<a class="reference external" href="devguide/devcycle/building">Building Native Client Modules</a>.</li>
</ul>
</section>
diff --git a/native_client_sdk/doc_generated/sdk/examples.html b/native_client_sdk/doc_generated/sdk/examples.html
index e6a6272b24..306031f5fc 100644
--- a/native_client_sdk/doc_generated/sdk/examples.html
+++ b/native_client_sdk/doc_generated/sdk/examples.html
@@ -1,147 +1,120 @@
{{+bindTo:partials.standard_nacl_article}}
-<section id="running-the-sdk-examples">
-<span id="sdk-examples-2"></span><h1 id="running-the-sdk-examples"><span id="sdk-examples-2"></span>Running the SDK Examples</h1>
+<span class="target" id="sdk-examples-2"></span><section id="examples">
+<h1 id="examples">Examples</h1>
<p>Every Native Client SDK bundle comes with a folder of example applications.
Each example demonstrates one or two key Native Client programming concepts.
After you&#8217;ve <a class="reference internal" href="/native-client/sdk/download.html"><em>downloaded the SDK</em></a>, follow the instructions
on this page to build and run the examples.</p>
-<h2 id="configure-the-google-chrome-browser">Configure the Google Chrome Browser</h2>
+<p>Your version of Chrome must be equal to or greater than the version of your SDK
+bundle. For example, if you&#8217;re developing with the <code>pepper_35</code> bundle, you
+must use Google Chrome version 35 or greater. To find out what version of Chrome
+you&#8217;re using, type <code>about:chrome</code> or <code>about:version</code> in the Chrome address
+bar.</p>
+<h2 id="enable-native-client"><span id="id1"></span>Enable Native Client</h2>
+<p>If you are using Chrome 31 or later, you can skip this section. To run Portable
+Native Client applications you must specifically enable Native Client in Chrome:</p>
<ol class="arabic">
-<li><p class="first">Your version of Chrome must be equal to or greater than the version of
-your SDK bundle. For example, if you&#8217;re developing with the <code>pepper_31</code>
-bundle, you must use Google Chrome version 31 or greater. To find out what
-version of Chrome you&#8217;re using, type <code>about:chrome</code> or <code>about:version</code>
-in the Chrome address bar.</p>
-</li>
-<li><p class="first">For Portable Native Client, no extra Chrome flags are needed as of
-Chrome version 31.</p>
-<p>For other Native Client applications, or to <strong>debug</strong> Portable Native
-Client applications by translating the <strong>pexe</strong> to a <strong>nexe</strong> ahead of
-time, enable the Native Client flag. Native Client is enabled by default
-only for applications distributed through the Chrome Web Store. To run
-Native Client applications that are not distributed through the Chrome
-Web Store, like the SDK examples, you must specifically enable the Native
-Client flag in Chrome:</p>
+<li><p class="first">Type <code>about:flags</code> in the Chrome address bar and scroll down to &#8220;Native
+Client&#8221;.</p>
<ul class="small-gap">
-<li><p class="first">Type <code>about:flags</code> in the Chrome address bar and scroll down to
-&#8220;Native Client&#8221;.</p>
-</li>
<li><p class="first">If the link below &#8220;Native Client&#8221; says &#8220;Disable&#8221;, then Native Client is
already enabled and you don&#8217;t need to do anything else.</p>
</li>
-<li><p class="first">If the link below &#8220;Native Client&#8221; says &#8220;Enable&#8221;, click the &#8220;Enable&#8221;
-link, scroll down to the bottom of the page, and click the &#8220;Relaunch
-Now&#8221; button. All browser windows will restart when you relaunch Chrome.</p>
-</li>
</ul>
-</li>
-<li><p class="first">Disable the Chrome cache. Chrome caches resources aggressively; when you
-are building a Native Client application you should disable the cache to
-make sure that Chrome loads the latest version:</p>
<ul class="small-gap">
-<li><p class="first">Open Chrome&#8217;s developer tools by clicking the menu icon <img alt="menu-icon" src="/native-client/images/menu-icon.png" /> and
-choosing Tools &gt; Developer tools.</p>
-</li>
-<li><p class="first">Click the gear icon <img alt="gear-icon" src="/native-client/images/gear-icon.png" /> in the bottom right corner of the
-Chrome window.</p>
-</li>
-<li><p class="first">Under the &#8220;General&#8221; settings, check the box next to &#8220;Disable cache&#8221;.</p>
+<li><p class="first">If the link below &#8220;Native Client&#8221; says &#8220;Enable&#8221;, click the &#8220;Enable&#8221;
+link.</p>
</li>
</ul>
</li>
+<li><p class="first">Scroll down to the bottom of the page, and click &#8220;Relaunch Now&#8221;. All browser
+windows will restart when you relaunch Chrome.</p>
+</li>
</ol>
-<h2 id="build-the-sdk-examples">Build the SDK examples</h2>
-<p>Starting with the <code>pepper_24</code> bundle, the Makefile scripts for the SDK
-examples build multiple versions of the examples using all three SDK
-toolchains (newlib, glibc, and PNaCl) and in both release and debug
-configurations. (Note that some examples build only with the particular
-toolchains).</p>
-<p>To build all the examples, go to the examples directory in a specific SDK
-bundle and run <code>make</code>:</p>
+<h2 id="build-the-sdk-examples"><span id="id2"></span>Build the SDK examples</h2>
+<p>The Makefile scripts for the SDK examples can build multiple versions of the
+examples using any of the three SDK toolchains (newlib, glibc, and PNaCl) and in
+both release and debug configurations. Note that some examples, <code>dlopen</code> for
+example, build only with particular toolchains.</p>
+<p>Find the toolchains for each example by looking at the <code>VALID_TOOLCHAINS</code>
+variable in the Makefile for a particular example. The first item listed is the
+default. It&#8217;s built when you run an example make file without parameters. for
+example running make in the <code>core</code> directory of pepper_35 builds the example
+using the <code>newlib</code> toolchain.</p>
<pre class="prettyprint">
-$ cd pepper_31/examples
+$ cd pepper_35/examples/api/core
$ make
-make -C api all
-make[1]: Entering directory `pepper_31/examples/api'
-make -C audio all
-make[2]: Entering directory `pepper_31/examples/api/audio'
- CXX newlib/Debug/audio_x86_32.o
- LINK newlib/Debug/audio_x86_32.nexe
- CXX newlib/Debug/audio_x86_64.o
- LINK newlib/Debug/audio_x86_64.nexe
- CXX newlib/Debug/audio_arm.o
- LINK newlib/Debug/audio_arm.nexe
- CREATE_NMF newlib/Debug/audio.nmf
-make[2]: Leaving directory `pepper_31/examples/api/audio'
-make -C url_loader all
-make[2]: Entering directory `pepper_31/examples/api/url_loader'
- CXX newlib/Debug/url_loader_x86_32.o
-...
+ CXX newlib/Release/core_x86_32.o
+ LINK newlib/Release/core_unstripped_x86_32.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_32.nexe
+ CXX newlib/Release/core_x86_64.o
+ LINK newlib/Release/core_unstripped_x86_64.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_64.nexe
+ CXX newlib/Release/core_arm.o
+ LINK newlib/Release/core_unstripped_arm.nexe
+ VALIDATE newlib/Release/core_unstripped_arm.nexe
+ STRIP newlib/Release/core_x86_32.nexe
+ STRIP newlib/Release/core_x86_64.nexe
+ STRIP newlib/Release/core_arm.nexe
+ CREATE_NMF newlib/Release/core.nmf
</pre>
-<p>Calling <code>make</code> from inside a particular example&#8217;s directory will build only
-that example:</p>
+<p>As you can see, this produces a number of architecture specific nexe files in
+the <code>pepper_35/examples/api/core/Release</code> directory. Create debug versions by
+using the <code>CONFIG</code> parameter of the make command.</p>
<pre class="prettyprint">
-$ cd pepper_31/examples/api/core
-$ make
- CXX newlib/Debug/core_x86_32.o
- LINK newlib/Debug/core_x86_32.nexe
- CXX newlib/Debug/core_x86_64.o
- LINK newlib/Debug/core_x86_64.nexe
- CXX newlib/Debug/core_arm.o
- LINK newlib/Debug/core_arm.nexe
- CREATE_NMF newlib/Debug/core.nmf
+$make CONFIG=Debug
</pre>
-<p>You can call <code>make</code> with the <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters to
-override the defaults:</p>
+<p>This creates similar output, but in <code>pepper_35/examples/api/core/Debug</code>.</p>
+<p>Select a different toolchain with the <code>TOOLCHAIN</code> parameter. For example:</p>
<pre class="prettyprint">
+$ cd pepper_35/examples/api/core
$ make TOOLCHAIN=pnacl CONFIG=Release
- CXX pnacl/Release/core_pnacl.o
- LINK pnacl/Release/core.bc
- FINALIZE pnacl/Release/core.pexe
+ CXX pnacl/Release/core.o
+ LINK pnacl/Release/core_unstripped.bc
+ FINALIZE pnacl/Release/core_unstripped.pexe
CREATE_NMF pnacl/Release/core.nmf
</pre>
-<p>You can also set <code>TOOLCHAIN</code> to &#8220;all&#8221; to build one or more examples with
-all available toolchains:</p>
+<p>You can also set <code>TOOLCHAIN</code> to <code>all</code> to build all Release versions with
+default toolchains.</p>
<pre class="prettyprint">
+$ cd pepper_35/examples/api/core
$ make TOOLCHAIN=all
make TOOLCHAIN=newlib
-make[1]: Entering directory `pepper_31/examples/api/core'
- CXX newlib/Debug/core_x86_32.o
- LINK newlib/Debug/core_x86_32.nexe
- CXX newlib/Debug/core_x86_64.o
- LINK newlib/Debug/core_x86_64.nexe
- CXX newlib/Debug/core_arm.o
- LINK newlib/Debug/core_arm.nexe
- CREATE_NMF newlib/Debug/core.nmf
-make[1]: Leaving directory `pepper_31/examples/api/core'
+make[1]: Entering directory 'pepper_35/examples/api/core'
+ CXX newlib/Release/core_x86_32.o
+ LINK newlib/Release/core_unstripped_x86_32.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_32.nexe
+ CXX newlib/Release/core_x86_64.o
+ LINK newlib/Release/core_unstripped_x86_64.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_64.nexe
+ CXX newlib/Release/core_arm.o
+ LINK newlib/Release/core_unstripped_arm.nexe
+ VALIDATE newlib/Release/core_unstripped_arm.nexe
+ STRIP newlib/Release/core_x86_32.nexe
+ STRIP newlib/Release/core_x86_64.nexe
+ STRIP newlib/Release/core_arm.nexe
+ CREATE_NMF newlib/Release/core.nmf
+make[1]: Leaving directory 'pepper_35/examples/api/core'
make TOOLCHAIN=glibc
-make[1]: Entering directory `pepper_31/examples/api/core'
- CXX glibc/Debug/core_x86_32.o
- LINK glibc/Debug/core_x86_32.nexe
- CXX glibc/Debug/core_x86_64.o
- LINK glibc/Debug/core_x86_64.nexe
- CREATE_NMF glibc/Debug/core.nmf
-make[1]: Leaving directory `pepper_31/examples/api/core'
-make TOOLCHAIN=pnacl
-make[1]: Entering directory `pepper_31/examples/api/core'
- CXX pnacl/Debug/core.o
- LINK pnacl/Debug/core_unstripped.bc
- FINALIZE pnacl/Debug/core_unstripped.pexe
- CREATE_NMF pnacl/Debug/core.nmf
-make[1]: Leaving directory `pepper_31/examples/api/core'
-make TOOLCHAIN=linux
-make[1]: Entering directory `pepper_31/examples/api/core'
- CXX linux/Debug/core.o
- LINK linux/Debug/core.so
-make[1]: Leaving directory `pepper_31/examples/api/core'
+make[1]: Entering directory 'pepper_35/examples/api/core'
+ CXX glibc/Release/core_x86_32.o
+ LINK glibc/Release/core_unstripped_x86_32.nexe
+ VALIDATE glibc/Release/core_unstripped_x86_32.nexe
+ CXX glibc/Release/core_x86_64.o
+ LINK glibc/Release/core_unstripped_x86_64.nexe
+ VALIDATE glibc/Release/core_unstripped_x86_64.nexe
+ ...
+ (content excerpted)
+ ...
</pre>
-<p>After running <code>make</code>, each example directory will contain one or more of
-the following subdirectories:</p>
+<h3 id="build-results"><span id="id3"></span>Build results</h3>
+<p>After running <code>make</code>, example directories will contain one or more of the
+following subdirectories, depending on which Makefile you run:</p>
<ul class="small-gap">
-<li>a <code>newlib</code> directory with subdirectories <code>Debug</code> and <code>Release</code>;</li>
-<li>a <code>glibc</code> directory with subdirectories <code>Debug</code> and <code>Release</code>;</li>
-<li>a <code>pnacl</code> directory with subdirectories <code>Debug</code> and <code>Release</code>;</li>
+<li><code>newlib</code> with subdirectories <code>Debug</code> and <code>Release</code>;</li>
+<li><code>glibc</code> with subdirectories <code>Debug</code> and <code>Release</code>;</li>
+<li><code>pnacl</code> with subdirectories <code>Debug</code> and <code>Release</code>;</li>
</ul>
<p>For the newlib and glibc toolchains the Debug and Release subdirectories
contain .nexe files for all target architectures. For the PNaCl toolchain
@@ -152,23 +125,36 @@ For information about Native Client manifest files, see the <a class="reference
Overview</em></a>.</p>
<p>For details on how to use <code>make</code>, see the <a class="reference external" href="http://www.gnu.org/software/make/manual/make.html">GNU &#8216;make&#8217; Manual</a>. For details on how to
use the SDK toolchain itself, see <a class="reference internal" href="/native-client/devguide/devcycle/building.html"><em>Building Native Client Modules</em></a>.</p>
-<h2 id="run-the-sdk-examples"><span id="id1"></span>Run the SDK examples</h2>
-<p>To run the SDK examples, you can use the <code>make run</code> command:</p>
+<h2 id="run-the-sdk-examples"><span id="running-the-sdk-examples"></span>Run the SDK examples</h2>
+<h3 id="disable-the-chrome-cache"><span id="disable-chrome-cache"></span>Disable the Chrome cache</h3>
+<p>Chrome&#8217;s intelligent caching caches resources aggressively. When building a
+Native Client application you should disable the cache to make sure that Chrome
+loads the latest version. Intelligent caching only remains inactive while
+Developer Tools are open. Otherwise, agressive caching continues.</p>
+<ol class="arabic simple">
+<li>Open Chrome&#8217;s developer tools by clicking the menu icon <img alt="menu-icon" src="/native-client/images/menu-icon.png" /> and
+choosing Tools &gt; Developer tools.</li>
+<li>Click the gear icon <img alt="gear-icon" src="/native-client/images/gear-icon.png" /> in the bottom right corner of the Chrome
+window.</li>
+<li>Under the &#8220;General&#8221; settings, check the box next to &#8220;Disable cache&#8221;.</li>
+</ol>
+<h3 id="run-the-examples"><span id="id4"></span>Run the examples</h3>
+<p>To run the SDK examples, use the <code>make run</code> command:</p>
<pre class="prettyprint">
-$ cd pepper_31/examples/api/core
+$ cd pepper_35/examples/api/core
$ make run
</pre>
-<p>This will launch a local HTTP server which will serve the data for the
-example. It then launches Chrome with the address of this server, usually
-<code>http://localhost:5103</code>. After you close Chrome, the local HTTP server is
-automatically shutdown.</p>
-<p>This command will try to find an executable named <code>google-chrome</code> in your
+<p>This launches a local HTTP server that serves the example. It then launches
+Chrome with the address of this server, usually <code>http://localhost:5103</code>.
+After you close Chrome, the local HTTP server automatically shuts down.</p>
+<p>This command tries to find an executable named <code>google-chrome</code> in your
<code>PATH</code> environment variable. If it can&#8217;t, you&#8217;ll get an error message like
this:</p>
<pre class="prettyprint">
-pepper_31/tools/common.mk:415: No valid Chrome found at CHROME_PATH=
-pepper_31/tools/common.mk:415: *** Set CHROME_PATH via an environment variable, or command-line.. Stop.
+pepper_35/tools/common.mk:415: No valid Chrome found at CHROME_PATH=
+pepper_35/tools/common.mk:415: *** Set CHROME_PATH via an environment variable, or command-line.. Stop.
</pre>
+<h3 id="add-an-environment-variable-for-chrome"><span id="add-an-env-variable-for-chrome"></span>Add an environment variable for Chrome</h3>
<p>Set the CHROME_PATH environment variable to the location of your Chrome
executable.</p>
<ul class="small-gap">
@@ -177,7 +163,7 @@ executable.</p>
<code>C:\Program Files (x86)\Google\Chrome\Application\chrome.exe</code> for Chrome
stable and
<code>C:\Users\&lt;username&gt;\AppData\Local\Google\Chrome SxS\Application\chrome.exe</code>
-for Chrome Canary; try looking in those directories first:</p>
+for Chrome Canary. Try looking in those directories first:</p>
<pre class="prettyprint">
&gt; set CHROME_PATH=&lt;Path to chrome.exe&gt;
</pre>
@@ -199,39 +185,36 @@ $ export CHROME_PATH=&lt;Path to Google Chrome&gt;
</pre>
</li>
</ul>
-<p>You can run via a different toolchain or configuration by using the
-<code>TOOLCHAIN</code> and <code>CONFIG</code> parameters to make:</p>
-<pre class="prettyprint">
-$ make run TOOLCHAIN=pnacl CONFIG=Debug
-</pre>
<h2 id="run-the-sdk-examples-as-packaged-apps"><span id="run-sdk-examples-as-packaged"></span>Run the SDK examples as packaged apps</h2>
-<p>Each example can also be launched as a packaged app. For more information about
-using Native Client for packaged apps, see <a class="reference internal" href="/native-client/devguide/distributing.html#distributing-packaged"><em>Packaged application</em></a>. For general information about packaged apps, see the
-<a class="reference external" href="/apps/about_apps">Chrome apps documentation</a>.</p>
+<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
+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
+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>
<p>Some Pepper features, such as TCP/UDP socket access, are only allowed in
-packaged apps. The examples that use these features must be run as packaged
-apps, by using the <code>make run_package</code> command:</p>
+packaged applications. The examples that use these features must be run as
+packaged applications, by using the following command:</p>
<pre class="prettyprint">
$ make run_package
</pre>
-<p>You can use <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters as above to run with a
-different toolchain or configuration.</p>
-<h2 id="debugging-the-sdk-examples"><span id="id2"></span>Debugging the SDK examples</h2>
+<p>You can use <code>TOOLCHAIN</code> and <code>CONFIG</code> parameters as described above to run
+with a different toolchain or configuration.</p>
+<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
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>
<pre class="prettyprint">
$ make debug
</pre>
-<p>This will launch Chrome with the <code>--enable-nacl-debug</code> flag set. This flag
-will cause Chrome to pause when a NaCl module is first loaded, waiting for a
-connection from gdb. The <code>make debug</code> command also simultaneously launches
-GDB and loads the symbols for that NEXE. To connect GDB to Chrome, in the GDB
-console, type:</p>
+<p>This launches Chrome with the <code>--enable-nacl-debug</code> flag set. This flag causes
+Chrome to pause when a NaCl module is first loaded, waiting for a connection
+from gdb. The <code>make debug</code> command also simultaneously launches GDB and loads
+the symbols for that NEXE. To connect GDB to Chrome, in the GDB console, type:</p>
<pre class="prettyprint">
(gdb) target remote :4014
</pre>
-<p>This tells GDB to connect to a TCP port on <code>localhost:4014</code>&#8211;the port that
+<p>This tells GDB to connect to a TCP port on <code>localhost:4014</code>, the port that
Chrome is listening on. GDB will respond:</p>
<pre class="prettyprint">
Remote debugging using :4014
@@ -239,8 +222,9 @@ Remote debugging using :4014
</pre>
<p>At this point, you can use the standard GDB commands to debug your NaCl module.
The most common commands you will use to debug are <code>continue</code>, <code>step</code>,
-<code>next</code>, <code>break</code> and <code>backtrace</code>. See <a class="reference internal" href="/native-client/devguide/devcycle/debugging.html"><em>Debugging</em></a> for more information about debugging a Native Client
-application.</p>
+<code>next</code>, <code>break</code> and <code>backtrace</code>. See
+<a class="reference internal" href="/native-client/devguide/devcycle/debugging.html"><em>Debugging</em></a> for more information about
+debugging a Native Client application.</p>
</section>
{{/partials.standard_nacl_article}}
diff --git a/native_client_sdk/doc_generated/sdk/release-notes.html b/native_client_sdk/doc_generated/sdk/release-notes.html
index 57b09e9fe2..32b8ac551d 100644
--- a/native_client_sdk/doc_generated/sdk/release-notes.html
+++ b/native_client_sdk/doc_generated/sdk/release-notes.html
@@ -2,9 +2,16 @@
<section id="release-notes">
<span id="sdk-release-notes"></span><h1 id="release-notes"><span id="sdk-release-notes"></span>Release Notes</h1>
-<h2 id="chrome-pepper-37-20-june-2014">Chrome/Pepper 37 (20 June 2014)</h2>
+<h2 id="chrome-pepper-38-15-august-2014">Chrome/Pepper 38 (15 August 2014)</h2>
<h3 id="pnacl">PNaCl</h3>
<ul class="small-gap">
+<li>Compilation speed improvements due to validation caching of the translator and
+linker.</li>
+<li>Performance improvement of SIMD vector shuffle.</li>
+</ul>
+<h2 id="chrome-pepper-37-20-june-2014">Chrome/Pepper 37 (20 June 2014)</h2>
+<h3 id="id1">PNaCl</h3>
+<ul class="small-gap">
<li>2–10% translation time improvement.</li>
<li>Improved vector load/store and shuffle performance.</li>
</ul>
@@ -20,7 +27,7 @@
<li>Demo of a <a class="reference internal" href="/native-client/io2014.html#io2014"><em>full development environment in the browser</em></a>.</li>
</ul>
<h2 id="chrome-pepper-36-09-may-2014">Chrome/Pepper 36 (09 May 2014)</h2>
-<h3 id="id1">PNaCl</h3>
+<h3 id="id2">PNaCl</h3>
<ul class="small-gap">
<li>Support <a class="reference external" href="http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors">LLVM vectors</a>
and <a class="reference external" href="http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html">GCC vectors</a> for SIMD
@@ -29,7 +36,7 @@ and performance is expected to become acceptable for version 37 of
Chrome. More SIMD instructions will be added in later releases.</li>
</ul>
<h2 id="chrome-pepper-35-31-mar-2014">Chrome/Pepper 35 (31 Mar 2014)</h2>
-<h3 id="id2">PNaCl</h3>
+<h3 id="id3">PNaCl</h3>
<ul class="small-gap">
<li>Upgraded LLVM to version 3.4.</li>
<li>Translation now uses dynamic load balancing, making translation time faster.</li>
@@ -37,7 +44,7 @@ Chrome. More SIMD instructions will be added in later releases.</li>
Chrome, simplifying debugging with PNaCl. See <a class="reference internal" href="/native-client/devguide/devcycle/debugging.html#debugging-pnacl-pexes"><em>Debugging PNaCl pexes</em></a></li>
</ul>
<h2 id="chrome-pepper-34-20-feb-2014">Chrome/Pepper 34 (20 Feb 2014)</h2>
-<h3 id="id3">Pepper</h3>
+<h3 id="id4">Pepper</h3>
<ul class="small-gap">
<li>Filesystems can now be passed from JavaScript to NaCl. The resulting
<code>pp::Var</code> will contain a <code>pp::Resource</code> that can be given to the
@@ -47,7 +54,7 @@ Chrome, simplifying debugging with PNaCl. See <a class="reference internal" href
<a class="reference external" href="/native-client/pepper_dev/cpp/classpp_1_1_media_stream_video_track">pp::MediaStreamVideoTrack</a> for
more details.</li>
</ul>
-<h3 id="id4">PNaCl</h3>
+<h3 id="id5">PNaCl</h3>
<ul class="small-gap">
<li>Parallel translation: at least 1.7x faster, even with older pexes.</li>
<li>Intelligent abbreviations in the bitcode: 20% reduction in binary size using
@@ -61,7 +68,7 @@ LLVM 3.3. This library now supports optional <code>setjmp</code>/<code>longjmp</
handling (see <a class="reference external" href="https://groups.google.com/forum/#!topic/native-client-discuss/0spfg6O04FM">announcement</a>
for details).</li>
</ul>
-<h3 id="id5">SDK</h3>
+<h3 id="id6">SDK</h3>
<ul class="small-gap">
<li>The <code>nacl_io</code> library now includes a FUSE mount.</li>
<li>In the SDK examples, <code>common.js</code> now loads the Release version of the
@@ -175,7 +182,7 @@ for an application can specify a source file to compile such as
<p>The Pepper 26 bundle includes a new HTTP filesystem type in the nacl_mounts
library (which has been renamed nacl_io), changes to the example Makefiles, a
simple new 3D example, and a threaded file IO example.</p>
-<h3 id="id6">Build tools and toolchains</h3>
+<h3 id="id7">Build tools and toolchains</h3>
<ul class="small-gap">
<li><p class="first">Makefiles have been changed significantly:</p>
<ul class="small-gap">
@@ -195,14 +202,14 @@ with all toolchains.</li>
the same set of header files as host builds. Previously host and NaCl builds
used different headers, which could cause build problems.</li>
</ul>
-<h3 id="id7">Libraries</h3>
+<h3 id="id8">Libraries</h3>
<ul class="small-gap">
<li>The nacl_mounts library has been renamed <strong>nacl_io</strong>, and has been expanded
with a new type of mount, httpfs, which can be used to read URLs via HTTP.
For details see <code>include/nacl_io/nacl_io.h</code>, as well as the
<code>hello_nacl_io</code> example.</li>
</ul>
-<h3 id="id8">Examples</h3>
+<h3 id="id9">Examples</h3>
<ul class="small-gap">
<li>A new example, <strong>hello_world_instance3d</strong>, has been added to demonstrate a
simplified 3D app.</li>
@@ -224,7 +231,7 @@ which provides a virtual file system that you can use with standard C file
operations, and ppapi_main, which lets you implement a Native Client module
using a simple ppapi_main function), and two new examples that demonstrate how
to use the nacl_mounts and ppapi_main libraries.</p>
-<h3 id="id9">Build tools and toolchains</h3>
+<h3 id="id10">Build tools and toolchains</h3>
<ul class="small-gap">
<li><p class="first">The SDK includes a new toolchain to build Native Client executables (.nexe
files) for <strong>ARM devices</strong>.</p>
@@ -261,7 +268,7 @@ For a C++ example of how to use the MessageLoop API, see
cannot make asynchronous PPAPI calls on a background thread without creating
and using a message loop.</li>
</ul>
-<h3 id="id10">Libraries</h3>
+<h3 id="id11">Libraries</h3>
<p>The SDK includes two new libraries:</p>
<ul class="small-gap">
<li><p class="first">The <strong>nacl_mounts</strong> library provides a virtual file system that your module
@@ -295,7 +302,7 @@ how to use ppapi_main, see examples/hello_world_stdio.</li>
<p>Header files for the new libraries are in the <code>include/</code> directory, source
files are in the <code>src/</code> directory, and compiled libraries are in the <code>lib/</code>
directory.</p>
-<h3 id="id11">Examples</h3>
+<h3 id="id12">Examples</h3>
<ul class="small-gap">
<li><p class="first">The SDK includes two new examples:</p>
<ul class="small-gap">
@@ -336,7 +343,7 @@ source dependencies, and invokes the build rules in a separate file
for &#8220;Portable Native Client&#8221;), a new library (pthreads-win32) for the Windows
SDK, and an expanded list of attributes for Pepper 3D contexts that lets
applications specify a GPU preference for low power or performance.</p>
-<h3 id="id12">Build tools and toolchains</h3>
+<h3 id="id13">Build tools and toolchains</h3>
<ul class="small-gap">
<li>The SDK includes a new, experimental toolchain called <a class="reference external" href="http://nativeclient.googlecode.com/svn/data/site/pnacl.pdf">PNaCl</a> (pronounced
&#8220;pinnacle&#8221;). The PNaCl toolchain produces architecture-independent executable
@@ -352,7 +359,7 @@ determine the architecture of .nexe files. That means you can change the
names of your .nexe files and <code>create_nmf.py</code> will still be able to
generate the appropriate Native Client manifest file for your application.</li>
</ul>
-<h3 id="id14">Examples</h3>
+<h3 id="id15">Examples</h3>
<ul class="small-gap">
<li>The SDK examples now build with four toolchains: the glibc and newlib
toolchains, the experimental PNaCl toolchain, and the hosted toolchain on
@@ -363,7 +370,7 @@ builds both a debug and a release version.</li>
drawing function is now set up as the Flush() callback, which allows 2D
drawing to occur as quickly as possible.</li>
</ul>
-<h3 id="id15">PPAPI</h3>
+<h3 id="id16">PPAPI</h3>
<ul class="small-gap">
<li>When creating a 3D rendering context, the <a class="reference external" href="/native-client/pepper_stable/c/group___enums#ga7df48e1c55f6401beea2a1b9c07967e8">attribute list</a>
for the context can specify whether to prefer low power or performance for
@@ -435,7 +442,7 @@ Note that you must set the <code>CHROME_PATH</code> environment variable and sta
</ul>
</li>
</ul>
-<h3 id="id16">Examples</h3>
+<h3 id="id17">Examples</h3>
<ul class="small-gap">
<li>On Linux and Windows systems, most of the examples now build with three
toolchains: the Native Client glibc and newlib toolchains, and the native
@@ -451,7 +458,7 @@ onclick=&quot;...&quot;&gt;</code>). See <a class="reference external" href="/e
a list of changes between version 1 and version 2 of the manifest file
format, and a support schedule for applications that use version 1.</li>
</ul>
-<h3 id="id17">PPAPI</h3>
+<h3 id="id18">PPAPI</h3>
<ul class="small-gap">
<li><a class="reference external" href="/native-client/pepper_stable/c/group___enums#ga21b811ac0484a214a8751aa3e1c959d9">PP_InputEvent_Modifier</a>
has two new enum values (_ISLEFT and _ISRIGHT).</li>
@@ -462,14 +469,14 @@ been fixed.</li>
<p>The Pepper 22 bundle includes a <strong>command-line debugger</strong>, resources to enable
<strong>hosted development on Windows</strong>, and changes to the example Makefiles (each
example now builds both a debug and a release version).</p>
-<h3 id="id18">Tools</h3>
+<h3 id="id19">Tools</h3>
<ul class="small-gap">
<li>The SDK now includes a <strong>command-line debugger</strong> that you can use to debug
Native Client modules. See <a class="reference internal" href="/native-client/devguide/devcycle/debugging.html#devcycle-debugging"><em>Debugging with nacl-gdb</em></a> for instructions on how to use this debugger. For now,
nacl-gdb only works on 64-bit Windows, 64-bit Linux, and 32-bit Linux
systems. Support for Mac and 32-bit Windows systems will be added soon.</li>
</ul>
-<h3 id="id19">Windows SDK</h3>
+<h3 id="id20">Windows SDK</h3>
<ul class="small-gap">
<li><p class="first">Developers using the Windows SDK can now <strong>build a module as a Pepper
plugin</strong> (sometimes called a &#8220;trusted&#8221; or &#8220;in-process&#8221; plugin) using the
@@ -517,7 +524,7 @@ or <a class="reference external" href="http://www.chromium.org/nativeclient/how-
In the future, the SDK will include resources for hosted development on Mac
and Linux as well as Windows.
</aside>
-<h3 id="id20">Examples</h3>
+<h3 id="id21">Examples</h3>
<ul class="small-gap">
<li>Each example in the SDK now builds both a debug and a release version. As
before, most examples also build newlib and glibc versions, which means that
@@ -531,7 +538,7 @@ in each example&#8217;s web page, attaches event listeners to monitor the loadin
of the module, and implements handleMessage() to respond to messages sent
from the NaCl module to the JavaScript side of the application</li>
</ul>
-<h3 id="id21">PPAPI</h3>
+<h3 id="id22">PPAPI</h3>
<ul class="small-gap">
<li>The <code>CompletionCallbackFactory</code> class template now takes a thread traits
class as its second parameter. For details see the <a class="reference external" href="/native-client/pepper_stable/cpp/classpp_1_1_completion_callback_factory#details">CompletionCallbackFactory
diff --git a/native_client_sdk/doc_generated/sitemap.html b/native_client_sdk/doc_generated/sitemap.html
index 88b6b3f441..4c3ff3141a 100644
--- a/native_client_sdk/doc_generated/sitemap.html
+++ b/native_client_sdk/doc_generated/sitemap.html
@@ -6,12 +6,11 @@
<div class="toctree-wrapper compound">
<ul class="small-gap">
<li class="toctree-l1"><a class="reference internal" href="/native-client/overview.html">Technical Overview</a><ul class="small-gap">
-<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#why-use-native-client">Why use Native Client?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#benefits-of-native-client">Benefits of Native Client</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#common-use-cases">Common use cases</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#how-native-client-works">How Native Client works</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#native-client-in-a-web-application">Native Client in a web application</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#versioning">Versioning</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#structure-of-a-web-application">Structure of a web application</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/overview.html#where-to-start">Where to start</a></li>
</ul>
</li>
@@ -27,12 +26,15 @@
<li class="toctree-l1"><a class="reference internal" href="/native-client/sdk/download.html">Download the Native Client SDK</a><ul class="small-gap">
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#prerequisites">Prerequisites</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#download-and-install-the-sdk">Download and install the SDK</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#staying-up-to-date-and-getting-new-versions-of-bundles">Staying up-to-date and getting new versions of bundles</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#versioning">Versioning</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#installing-the-sdk">Installing the SDK</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#updating-bundles">Updating bundles</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#help-with-the-naclsdk-utility">Help with the <code>naclsdk</code> utility</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/download.html#next-steps">Next steps</a></li>
</ul>
</li>
-<li class="toctree-l1"><a class="reference internal" href="/native-client/sdk/examples.html">Running the SDK Examples</a><ul class="small-gap">
-<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/examples.html#configure-the-google-chrome-browser">Configure the Google Chrome Browser</a></li>
+<li class="toctree-l1"><a class="reference internal" href="/native-client/sdk/examples.html">Examples</a><ul class="small-gap">
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/examples.html#enable-native-client">Enable Native Client</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/examples.html#build-the-sdk-examples">Build the SDK examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/examples.html#run-the-sdk-examples">Run the SDK examples</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/examples.html#run-the-sdk-examples-as-packaged-apps">Run the SDK examples as packaged apps</a></li>
@@ -40,6 +42,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="/native-client/sdk/release-notes.html">Release Notes</a><ul class="small-gap">
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-38-15-august-2014">Chrome/Pepper 38 (15 August 2014)</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-37-20-june-2014">Chrome/Pepper 37 (20 June 2014)</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-36-09-may-2014">Chrome/Pepper 36 (09 May 2014)</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-35-31-mar-2014">Chrome/Pepper 35 (31 Mar 2014)</a></li>
@@ -78,6 +81,7 @@
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part2.html#making-index-html-work-for-chrome-apps">Making index.html work for Chrome Apps</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part2.html#sharing-common-code-with-common-js">Sharing common code with common.js</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part2.html#example-specific-behavior-with-example-js">Example-specific behavior with example.js</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part2.html#compile-the-native-client-module-and-run-the-application-again">Compile the Native Client module and run the application again</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="/native-client/devguide/devcycle/index.html">Development Cycle</a></li>
@@ -109,7 +113,7 @@
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/debugging.html#debugging-with-other-tools">Debugging with other tools</a></li>
</ul>
</li>
-<li class="toctree-l1"><a class="reference internal" href="/native-client/devguide/devcycle/vs-addin.html">Debugging With Visual Studio</a><ul class="small-gap">
+<li class="toctree-l1"><a class="reference internal" href="/native-client/devguide/devcycle/vs-addin.html">Debugging with Visual Studio</a><ul class="small-gap">
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/vs-addin.html#introduction">Introduction</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/vs-addin.html#platforms">Platforms</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/vs-addin.html#installing-the-add-in">Installing the add-in</a></li>
@@ -118,12 +122,9 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html">Dynamic Linking and Loading with glibc</a><ul class="small-gap">
-<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#introduction">Introduction</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#building-a-dynamically-linked-application">Building a dynamically linked application</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#generating-a-native-client-manifest-file-for-a-dynamically-linked-application">Generating a Native Client manifest file for a dynamically linked application</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#deploying-a-dynamically-linked-application">Deploying a dynamically linked application</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#opening-a-shared-library-at-runtime">Opening a shared library at runtime</a></li>
-<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#troubleshooting">Troubleshooting</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#c-standard-libraries-glibc-and-newlib">C standard libraries: glibc and newlib</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#sdk-toolchains">SDK toolchains</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loading.html#specifying-and-delivering-shared-libraries">Specifying and delivering shared libraries</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="/native-client/devguide/coding/index.html">Coding Your Application</a></li>
@@ -280,6 +281,21 @@
<li class="toctree-l2"><a class="reference internal" href="/native-client/community/security-contest/contest-faq.html#why-is-my-country-province-excluded-from-the-contest">Why is my country/province excluded from the contest?</a></li>
</ul>
</li>
+<li class="toctree-l1"><a class="reference internal" href="/native-client/c-api.html">Pepper C API Reference (Stable)</a><ul class="small-gap">
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#id1">Interfaces</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#id2">Structures</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#id3">Functions</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#id4">Enums</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#id5">Typedefs</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#id6">Macros</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/c-api.html#files">Files</a></li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="/native-client/cpp-api.html">Pepper C++ API Reference (Stable)</a><ul class="small-gap">
+<li class="toctree-l2"><a class="reference internal" href="/native-client/cpp-api.html#id1">Classes</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/cpp-api.html#files">Files</a></li>
+</ul>
+</li>
<li class="toctree-l1"><a class="reference internal" href="/native-client/pepper_stable/c/index.html">Pepper C API Reference (Stable)</a><ul class="small-gap">
<li class="toctree-l2"><a class="reference internal" href="/native-client/pepper_stable/c/index.html#id1">Interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/pepper_stable/c/index.html#id2">Structures</a></li>
diff --git a/native_client_sdk/src/README b/native_client_sdk/src/README
index c44f214f27..3c35cb22c6 100644
--- a/native_client_sdk/src/README
+++ b/native_client_sdk/src/README
@@ -4,12 +4,13 @@ Welcome to the Native Client SDK
Native Client Tools Bundle
Version: ${VERSION}
Chrome Revision: ${CHROME_REVISION}
+Chrome Commit Position: ${CHROME_COMMIT_POSITION}
Native Client Revision: ${NACL_REVISION}
Build Date: ${DATE}
Please refer to the online documentation here:
- https://developers.google.com/native-client
+ https://developer.chrome.com/native-client
Contributing
------------
@@ -24,4 +25,4 @@ Known Issues
Please refer to the online documentation here:
- http://code.google.com/chrome/nativeclient/docs/releasenotes.html
+ https://developer.chrome.com/native-client/sdk/release-notes
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py
index d4e7f0c700..c03afb03c4 100755
--- a/native_client_sdk/src/build_tools/build_sdk.py
+++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -56,8 +56,8 @@ NACL_TOOLCHAINTARS_DIR = os.path.join(NACL_TOOLCHAIN_DIR, '.tars')
CYGTAR = os.path.join(BUILD_DIR, 'cygtar.py')
PKGVER = os.path.join(BUILD_DIR, 'package_version', 'package_version.py')
-NACLPORTS_URL = 'https://naclports.googlecode.com/svn/trunk/src'
-NACLPORTS_REV = 1293
+NACLPORTS_URL = 'https://chromium.googlesource.com/external/naclports.git'
+NACLPORTS_REV = '99f2417'
GYPBUILD_DIR = 'gypbuild'
@@ -76,7 +76,7 @@ TOOLCHAIN_PACKAGE_MAP = {
def GetToolchainNaClInclude(tcname, tcpath, arch):
if arch == 'x86':
if tcname == 'pnacl':
- return os.path.join(tcpath, 'sdk', 'include')
+ return os.path.join(tcpath, 'le32-nacl', 'include')
return os.path.join(tcpath, 'x86_64-nacl', 'include')
elif arch == 'arm':
return os.path.join(tcpath, 'arm-nacl', 'include')
@@ -102,7 +102,7 @@ def GetGypBuiltLib(tcname, xarch=None):
def GetToolchainNaClLib(tcname, tcpath, xarch):
if tcname == 'pnacl':
- return os.path.join(tcpath, 'sdk', 'lib')
+ return os.path.join(tcpath, 'le32-nacl', 'lib')
elif xarch == '32':
return os.path.join(tcpath, 'x86_64-nacl', 'lib32')
elif xarch == '64':
@@ -182,6 +182,8 @@ def BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision,
readme_text = open(os.path.join(SDK_SRC_DIR, 'README')).read()
readme_text = readme_text.replace('${VERSION}', pepper_ver)
readme_text = readme_text.replace('${CHROME_REVISION}', chrome_revision)
+ readme_text = readme_text.replace('${CHROME_COMMIT_POSITION}',
+ build_version.ChromeCommitPosition())
readme_text = readme_text.replace('${NACL_REVISION}', nacl_revision)
# Year/Month/Day Hour:Minute:Second
@@ -257,6 +259,9 @@ NACL_HEADER_MAP = {
('native_client/src/untrusted/valgrind/dynamic_annotations.h', 'nacl/'),
('ppapi/nacl_irt/public/irt_ppapi.h', ''),
],
+ 'bionic': [
+ ('ppapi/nacl_irt/public/irt_ppapi.h', ''),
+ ],
'host': []
}
@@ -563,9 +568,11 @@ def BuildStepBuildToolchains(pepperdir, toolchains):
glibcdir = os.path.join(pepperdir, 'toolchain', platform + '_x86_glibc')
armdir = os.path.join(pepperdir, 'toolchain', platform + '_arm_newlib')
pnacldir = os.path.join(pepperdir, 'toolchain', platform + '_pnacl')
+ bionicdir = os.path.join(pepperdir, 'toolchain', platform + '_arm_bionic')
if set(toolchains) & set(['glibc', 'newlib']):
GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR)
+ GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR)
if 'arm' in toolchains:
GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm')
@@ -584,6 +591,10 @@ def BuildStepBuildToolchains(pepperdir, toolchains):
InstallNaClHeaders(GetToolchainNaClInclude('newlib', armdir, 'arm'),
'arm')
+ if 'bionic' in toolchains:
+ InstallNaClHeaders(GetToolchainNaClInclude('bionic', bionicdir, 'arm'),
+ 'bionic')
+
if 'pnacl' in toolchains:
# NOTE: For ia32, gyp builds both x86-32 and x86-64 by default.
for arch in ('ia32', 'arm'):
@@ -795,15 +806,25 @@ def BuildStepArchiveSDKTools():
def BuildStepSyncNaClPorts():
"""Pull the pinned revision of naclports from SVN."""
buildbot_common.BuildStep('Sync naclports')
+
+ # In case a previous svn checkout exists, remove it.
+ # TODO(sbc): remove this once all the build machines
+ # have removed the old checkout
+ if (os.path.exists(NACLPORTS_DIR) and
+ not os.path.exists(os.path.join(NACLPORTS_DIR, '.git'))):
+ buildbot_common.RemoveDir(NACLPORTS_DIR)
+
if not os.path.exists(NACLPORTS_DIR):
# checkout new copy of naclports
- cmd = ['svn', 'checkout', '-q', '-r', str(NACLPORTS_REV), NACLPORTS_URL,
- 'naclports']
+ cmd = ['git', 'clone', NACLPORTS_URL, 'naclports']
buildbot_common.Run(cmd, cwd=os.path.dirname(NACLPORTS_DIR))
else:
- # sync existing copy to pinned revision.
- cmd = ['svn', 'update', '-r', str(NACLPORTS_REV)]
- buildbot_common.Run(cmd, cwd=NACLPORTS_DIR)
+ # checkout new copy of naclports
+ buildbot_common.Run(['git', 'fetch'], cwd=NACLPORTS_DIR)
+
+ # sync to required revision
+ cmd = ['git', 'checkout', str(NACLPORTS_REV)]
+ buildbot_common.Run(cmd, cwd=NACLPORTS_DIR)
def BuildStepBuildNaClPorts(pepper_ver, pepperdir):
@@ -933,10 +954,15 @@ def main(args):
if buildbot_common.IsSDKBuilder():
options.archive = True
options.build_ports = True
- options.build_app_engine = True
+ # TODO(binji): re-enable app_engine build when the linux builder stops
+ # breaking when trying to git clone from github.
+ # See http://crbug.com/412969.
+ options.build_app_engine = False
options.tar = True
- toolchains = ['newlib', 'glibc', 'arm', 'pnacl', 'host']
+ # NOTE: order matters here. This will be the order that is specified in the
+ # Makefiles; the first toolchain will be the default.
+ toolchains = ['pnacl', 'newlib', 'glibc', 'arm', 'host']
# Changes for experimental bionic builder
if options.bionic:
diff --git a/native_client_sdk/src/build_tools/build_updater.py b/native_client_sdk/src/build_tools/build_updater.py
index 2987e6477b..219e49a378 100755
--- a/native_client_sdk/src/build_tools/build_updater.py
+++ b/native_client_sdk/src/build_tools/build_updater.py
@@ -142,8 +142,6 @@ def BuildUpdater(out_dir, revision_number=None):
out_dir: The output directory.
revision_number: The revision number of this updater, as an integer. Or
None, to use the current Chrome revision."""
- buildbot_common.BuildStep('Create Updater')
-
out_dir = os.path.abspath(out_dir)
# Build SDK directory
@@ -181,8 +179,11 @@ def main(args):
dest='out_dir', default=os.path.join(SRC_DIR, 'out'))
parser.add_option('-r', '--revision', help='revision number of this updater',
dest='revision', default=None)
+ parser.add_option('-v', '--verbose', help='verbose output')
options, args = parser.parse_args(args[1:])
+ buildbot_common.verbose = options.verbose
+
if options.revision:
options.revision = int(options.revision)
BuildUpdater(options.out_dir, options.revision)
diff --git a/native_client_sdk/src/build_tools/build_version.py b/native_client_sdk/src/build_tools/build_version.py
index 6e0aaa7421..014b86e992 100644
--- a/native_client_sdk/src/build_tools/build_version.py
+++ b/native_client_sdk/src/build_tools/build_version.py
@@ -6,6 +6,7 @@
"""
import os
+import re
import sys
# pylint: disable=E0602
@@ -27,11 +28,12 @@ def ChromeVersion():
Returns:
Chrome version string or trunk + svn rev.
'''
- info = lastchange.FetchVersionInfo(None)
- if info.url.startswith('/trunk/'):
- return 'trunk.%s' % info.revision
- else:
- return ChromeVersionNoTrunk()
+ info = FetchGitCommitPosition()
+ if info.url == 'git':
+ _, ref, revision = ParseCommitPosition(info.revision)
+ if ref == 'refs/heads/master':
+ return 'trunk.%s' % revision
+ return ChromeVersionNoTrunk()
def ChromeVersionNoTrunk():
@@ -58,10 +60,26 @@ def ChromeMajorVersion():
def ChromeRevision():
'''Extract chrome revision from svn.
+ Now that the Chrome source-of-truth is git, this will return the
+ Cr-Commit-Position instead. Fortunately, this value is equal to the SVN
+ revision if one exists.
+
Returns:
The Chrome revision as a string. e.g. "12345"
'''
- return lastchange.FetchVersionInfo(None).revision
+ version = FetchGitCommitPosition()
+ return ParseCommitPosition(version.revision)[2]
+
+
+def ChromeCommitPosition():
+ '''Return the full git sha and commit position.
+
+ Returns:
+ A value like:
+ 0178d4831bd36b5fb9ff477f03dc43b11626a6dc-refs/heads/master@{#292238}
+ '''
+ return FetchGitCommitPosition().revision
+
def NaClRevision():
'''Extract NaCl revision from svn.
@@ -70,4 +88,49 @@ def NaClRevision():
The NaCl revision as a string. e.g. "12345"
'''
nacl_dir = os.path.join(SRC_DIR, 'native_client')
- return lastchange.FetchVersionInfo(None, nacl_dir).revision
+ return lastchange.FetchVersionInfo(None, nacl_dir, 'native_client').revision
+
+
+def FetchGitCommitPosition(directory=None):
+ '''Return the "commit-position" of the Chromium git repo. This should be
+ equivalent to the SVN revision if one exists.
+ '''
+ SEARCH_LIMIT = 100
+ for i in xrange(SEARCH_LIMIT):
+ cmd = ['show', '-s', '--format=%H%n%B', 'HEAD~%d' % i]
+ proc = lastchange.RunGitCommand(directory, cmd)
+ if not proc:
+ break
+
+ output = proc.communicate()[0]
+ if not (proc.returncode == 0 and output):
+ break
+
+ lines = output.splitlines()
+
+ # First line is the hash.
+ hsh = lines[0]
+ if not re.match(r'[0-9a-fA-F]+', hsh):
+ break
+
+ for line in reversed(lines):
+ if line.startswith('Cr-Commit-Position:'):
+ pos = line.rsplit()[-1].strip()
+ return lastchange.VersionInfo('git', '%s-%s' % (hsh, pos))
+
+ raise Exception('Unable to fetch a Git Commit Position.')
+
+
+
+def ParseCommitPosition(commit_position):
+ '''Parse a Chrome commit position into its components.
+
+ Given a commit position like:
+ 0178d4831bd36b5fb9ff477f03dc43b11626a6dc-refs/heads/master@{#292238}
+ Returns:
+ ("0178d4831bd36b5fb9ff477f03dc43b11626a6dc", "refs/heads/master", "292238")
+ '''
+ m = re.match(r'([0-9a-fA-F]+)(?:-([^@]+)@{#(\d+)})?', commit_position)
+ if m:
+ return m.groups()
+ return None
diff --git a/native_client_sdk/src/build_tools/buildbot_common.py b/native_client_sdk/src/build_tools/buildbot_common.py
index 10951693c4..7fad468c97 100644
--- a/native_client_sdk/src/build_tools/buildbot_common.py
+++ b/native_client_sdk/src/build_tools/buildbot_common.py
@@ -71,6 +71,9 @@ def GetWindowsEnvironment():
return self.env[key]
def __getitem__(self, key):
+ # The nacl side script now needs gyp_vars to return a list.
+ if key == 'gyp_vars':
+ return []
return self.env[key]
def SetEnv(self, key, value):
@@ -96,7 +99,7 @@ def GetWindowsEnvironment():
# KEY1=VALUE1\r\n
# KEY2=VALUE2\r\n
# ...
- return dict(line.split('=') for line in stdout.split('\r\n')[:-1])
+ return dict(line.split('=', 1) for line in stdout.split('\r\n')[:-1])
def BuildStep(name):
diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py
index febbd51fc7..38d1ae3258 100644
--- a/native_client_sdk/src/build_tools/generate_make.py
+++ b/native_client_sdk/src/build_tools/generate_make.py
@@ -189,29 +189,12 @@ def ModifyDescInPlace(desc):
Currently this consists of:
- Add -Wall to CXXFLAGS
- - Synthesize SEL_LDR_LIBS and SEL_LDR_DEPS by stripping
- down LIBS and DEPS (removing certain ppapi-only libs).
"""
- ppapi_only_libs = ['ppapi_simple']
-
for target in desc['TARGETS']:
target.setdefault('CXXFLAGS', [])
target['CXXFLAGS'].insert(0, '-Wall')
- def filter_out(key):
- value = target.get(key, [])
- if type(value) == dict:
- value = dict(value)
- for key in value.keys():
- value[key] = [v for v in value[key] if v not in ppapi_only_libs]
- else:
- value = [v for v in value if v not in ppapi_only_libs]
- return value
-
- target['SEL_LDR_LIBS'] = filter_out('LIBS')
- target['SEL_LDR_DEPS'] = filter_out('DEPS')
-
def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None,
first_toolchain=False):
diff --git a/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json b/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json
index 07c16f2eca..d425d221bb 100644
--- a/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json
+++ b/native_client_sdk/src/build_tools/json/naclsdk_manifest2.json
@@ -29,7 +29,7 @@
"name": "vs_addin",
"recommended": "no",
"repath": "vs_addin",
- "revision": 1573,
+ "revision": 1578,
"stability": "dev",
"version": 0
},
@@ -204,6 +204,16 @@
},
{
"archives": [],
+ "description": "Chrome 38 bundle, revision xxxxx",
+ "name": "pepper_38",
+ "recommended": "no",
+ "repath": "pepper_38",
+ "revision": 0,
+ "stability": "post_stable",
+ "version": 38
+ },
+ {
+ "archives": [],
"description": "Chrome Canary",
"name": "pepper_canary",
"recommended": "no",
diff --git a/native_client_sdk/src/build_tools/sdk_files.list b/native_client_sdk/src/build_tools/sdk_files.list
index 6112e09874..d3d44f0a11 100644
--- a/native_client_sdk/src/build_tools/sdk_files.list
+++ b/native_client_sdk/src/build_tools/sdk_files.list
@@ -323,25 +323,25 @@ toolchain/${PLATFORM}_arm_newlib/arm-nacl/lib/libppapi.a
toolchain/${PLATFORM}_arm_newlib/arm-nacl/lib/libppapi_stub.a
toolchain/${PLATFORM}_arm_newlib/arm-nacl/lib/libpthread.a
toolchain/${PLATFORM}_pnacl/*
-toolchain/${PLATFORM}_pnacl/sdk/include/irt.h
-toolchain/${PLATFORM}_pnacl/sdk/include/irt_dev.h
-toolchain/${PLATFORM}_pnacl/sdk/include/irt_ppapi.h
-toolchain/${PLATFORM}_pnacl/sdk/include/nacl/dynamic_annotations.h
-toolchain/${PLATFORM}_pnacl/sdk/include/nacl/nacl_dyncode.h
-toolchain/${PLATFORM}_pnacl/sdk/include/nacl/nacl_exception.h
-toolchain/${PLATFORM}_pnacl/sdk/include/nacl/nacl_minidump.h
-toolchain/${PLATFORM}_pnacl/sdk/include/nacl/nacl_startup.h
-toolchain/${PLATFORM}_pnacl/sdk/include/pthread.h
-toolchain/${PLATFORM}_pnacl/sdk/include/semaphore.h
-toolchain/${PLATFORM}_pnacl/sdk/lib/libminidump_generator.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libnacl.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libnacl_dyncode.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libnacl_exception.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libnacl_list_mappings.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libnosys.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libppapi.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libppapi_stub.a
-toolchain/${PLATFORM}_pnacl/sdk/lib/libpthread.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/irt.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/irt_dev.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/irt_ppapi.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/nacl/dynamic_annotations.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/nacl/nacl_dyncode.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/nacl/nacl_exception.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/nacl/nacl_minidump.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/nacl/nacl_startup.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/pthread.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/include/semaphore.h
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libminidump_generator.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libnacl.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libnacl_dyncode.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libnacl_exception.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libnacl_list_mappings.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libnosys.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libppapi.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libppapi_stub.a
+toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libpthread.a
toolchain/${PLATFORM}_x86_glibc/*
toolchain/${PLATFORM}_x86_glibc/x86_64-nacl/include/irt.h
toolchain/${PLATFORM}_x86_glibc/x86_64-nacl/include/irt_dev.h
diff --git a/native_client_sdk/src/build_tools/tests/build_version_test.py b/native_client_sdk/src/build_tools/tests/build_version_test.py
new file mode 100755
index 0000000000..f8f60a26ce
--- /dev/null
+++ b/native_client_sdk/src/build_tools/tests/build_version_test.py
@@ -0,0 +1,113 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+import collections
+import unittest
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
+CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(BUILD_TOOLS_DIR)))
+MOCK_DIR = os.path.join(CHROME_SRC, "third_party", "pymock")
+
+# For the mock library
+sys.path.append(MOCK_DIR)
+import mock
+
+sys.path.append(BUILD_TOOLS_DIR)
+import build_version
+
+ProcInfo = collections.namedtuple('ProcInfo', ['returncode', 'output'])
+
+class TestCase(unittest.TestCase):
+ def setUp(self):
+ self.fetch_svn = mock.patch('lastchange.FetchSVNRevision').start()
+ self.fetch_git_svn = mock.patch('lastchange.FetchGitSVNRevision').start()
+ self.run_git = mock.patch('lastchange.RunGitCommand').start()
+
+ self.fetch_svn.return_value = None
+ self.fetch_git_svn.return_value = None
+
+ def tearDown(self):
+ mock.patch.stopall()
+
+ def mockGitCommand(self, *args):
+ side_effects = []
+ for proc_info in args:
+ mock_proc = mock.MagicMock()
+ mock_proc.returncode = proc_info.returncode
+ comm_result = mock_proc.MagicMock()
+ comm_result.__getitem__.return_value = proc_info.output
+ mock_proc.communicate.return_value = comm_result
+ side_effects.append(mock_proc)
+
+ self.run_git.side_effect = side_effects
+
+ def mockDefaultGitCommand(self):
+ output = """\
+6a8b61d6be4656e682eba005a1dd7f129789129c
+[NaCl SDK] Update build_sdk.py to display Cr-Commit-Position in README.
+
+BUG=none
+R=bradnelson@google.com, bradnelson@chromium.org
+
+Review URL: https://codereview.chromium.org/495423010
+
+Cr-Commit-Position: refs/heads/master@{#292480}"""
+ self.mockGitCommand(ProcInfo(0, output))
+
+ def mockDepthTwoGitCommand(self):
+ output0 = """\
+ae4b444a0aa09a1fa73e59b180d7d957b9a36bf2
+."""
+
+ output1 = """\
+6a8b61d6be4656e682eba005a1dd7f129789129c
+[NaCl SDK] Update build_sdk.py to display Cr-Commit-Position in README.
+
+BUG=none
+R=bradnelson@google.com, bradnelson@chromium.org
+
+Review URL: https://codereview.chromium.org/495423010
+
+Cr-Commit-Position: refs/heads/master@{#292480}"""
+ self.mockGitCommand(ProcInfo(0, output0), ProcInfo(0, output1))
+
+
+ def assertGitShowCalled(self, depth=0):
+ cmd = ['show', '-s', '--format=%H%n%B', 'HEAD~%d' % depth]
+ self.run_git.assert_called_with(None, cmd)
+
+ def testChromeVersion(self):
+ self.mockDefaultGitCommand()
+ result = build_version.ChromeVersion()
+ self.assertGitShowCalled()
+ self.assertEqual(result, 'trunk.292480')
+
+ def testChromeRevision(self):
+ self.mockDefaultGitCommand()
+ result = build_version.ChromeRevision()
+ self.assertGitShowCalled()
+ self.assertEqual(result, '292480')
+
+ def testChromeCommitPosition(self):
+ self.mockDefaultGitCommand()
+ result = build_version.ChromeCommitPosition()
+ self.assertGitShowCalled()
+ self.assertEqual(
+ result,
+ '6a8b61d6be4656e682eba005a1dd7f129789129c-refs/heads/master@{#292480}')
+
+ def testChromeCommitPositionDepthTwo(self):
+ self.mockDepthTwoGitCommand()
+ result = build_version.ChromeCommitPosition()
+ self.assertEqual(
+ result,
+ '6a8b61d6be4656e682eba005a1dd7f129789129c-refs/heads/master@{#292480}')
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/native_client_sdk/src/build_tools/whitespace.txt b/native_client_sdk/src/build_tools/whitespace.txt
new file mode 100644
index 0000000000..f92b007455
--- /dev/null
+++ b/native_client_sdk/src/build_tools/whitespace.txt
@@ -0,0 +1 @@
+This is a whitespace file to kick off a build on the client.nacl.sdk waterfall. \ No newline at end of file
diff --git a/native_client_sdk/src/doc/Makefile b/native_client_sdk/src/doc/Makefile
index 04876d5744..24af1a8864 100644
--- a/native_client_sdk/src/doc/Makefile
+++ b/native_client_sdk/src/doc/Makefile
@@ -6,6 +6,7 @@ SPHINXOPTS = -W
SPHINXBUILD = sphinx-build
BUILDDIR = _build
CHROMESITE_BUILDDIR = $(realpath ../../doc_generated)
+PORT = 8000
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
@@ -69,5 +70,5 @@ presubmit:
-rm $(BUILDDIR)/.buildinfo
$(SPHINXBUILD) -b chromesite $(ALLSPHINXOPTS) $(BUILDDIR)
-serve:
- ../../../chrome/common/extensions/docs/server2/preview.py
+serve: chromesite_rst
+ ../../../chrome/common/extensions/docs/server2/preview.py -p $(PORT)
diff --git a/native_client_sdk/src/doc/_static/css/nacl.css b/native_client_sdk/src/doc/_static/css/nacl.css
index 9b3a36bd2c..49f8173026 100644
--- a/native_client_sdk/src/doc/_static/css/nacl.css
+++ b/native_client_sdk/src/doc/_static/css/nacl.css
@@ -81,6 +81,23 @@ blockquote.indent-only {font-style: normal; color: #000; }
display: block;
margin: 1em auto 0;
}
+#home .left-side {
+ float: left;
+ width: 54%;
+ background-color: #FFF;
+ }
+#home .left-side-inner {
+ padding-right: 40px;
+ }
+#home .pull-quote {
+ background-color: #f5f5f5;
+ border-bottom: 1px solid;
+ border-top: 1px solid;
+ font-size: 14px;
+ float: right;
+ margin: .5em 2em 2em 2em;
+ padding: 1em;
+}
#home .right-side {
float: right;
width: 54%;
diff --git a/native_client_sdk/src/doc/c-api.rst b/native_client_sdk/src/doc/c-api.rst
new file mode 100644
index 0000000000..53cd69abd2
--- /dev/null
+++ b/native_client_sdk/src/doc/c-api.rst
@@ -0,0 +1,3 @@
+.. _c-api:
+
+.. include:: pepper_stable/c/index.rst
diff --git a/native_client_sdk/src/doc/community/index.rst b/native_client_sdk/src/doc/community/index.rst
index 7cd1d00686..64e716148f 100644
--- a/native_client_sdk/src/doc/community/index.rst
+++ b/native_client_sdk/src/doc/community/index.rst
@@ -5,11 +5,10 @@ Community
#########
This section contains pages related to the Native Client *community* - both
-**implementors** (contributors to the `open-source Native Client project
-<nacl_project_>`_) and **developers**, who use Native Client to develop web
-applications.
+**implementors** (contributors to the `open-source Native Client project`_) and
+**developers**, who use Native Client to develop web applications.
For a list of active forums where you can ask questions, check the
:ref:`help page <help>`.
-.. _nacl_project: https://code.google.com/p/nativeclient/
+.. _open-source Native Client project: https://code.google.com/p/nativeclient/
diff --git a/native_client_sdk/src/doc/community/security-contest/contest-terms.rst b/native_client_sdk/src/doc/community/security-contest/contest-terms.rst
index cc50381116..0b05f628c5 100644
--- a/native_client_sdk/src/doc/community/security-contest/contest-terms.rst
+++ b/native_client_sdk/src/doc/community/security-contest/contest-terms.rst
@@ -65,7 +65,7 @@ I. Binding Agreement
will be asked to identify security Exploits in Google’s Native
Client Software and enter those Exploits on Google’s `Native Client
Issue Tracker <http://code.google.com/p/nativeclient/issues/list>`_
- web site using the "Security Contest Template." At this point, the
+ website using the "Security Contest Template." At this point, the
Exploit will become an Issue and will no longer be able to be
identified by another Participant. Google will then verify that the
Issue is reproducible. If so, that Issue will become a Verified
@@ -772,14 +772,14 @@ I. Binding Agreement
Google further reserves the right to disqualify any Participant
who tampers with the submission process or any other part of the
Contest. Any attempt by a Participant to deliberately damage any
- web site or undermine the legitimate operation of the Contest is
+ website or undermine the legitimate operation of the Contest is
a violation of criminal and civil laws and should such an
attempt be made, Google reserves the right to seek damages from
any such Participant to the fullest extent of the applicable
law.
#. Internet Disclaimer. Google is not responsible for any
- malfunction of the entire Contest, the web site displaying the
+ malfunction of the entire Contest, the website displaying the
Contest terms and entry information, or any late, lost, damaged,
misdirected, incomplete, illegible, undeliverable, or destroyed
Exploits, Issues or Summaries due to system errors, failed,
@@ -789,7 +789,7 @@ I. Binding Agreement
system/human errors and failures, technical malfunction(s) of
any telephone network or lines, cable connections, satellite
transmissions, servers or providers, or computer equipment,
- traffic congestion on the Internet or at the web site displaying
+ traffic congestion on the Internet or at the website displaying
the Contest or any combination thereof, including other
telecommunication, cable, digital or satellite malfunctions
which may limit an entrant’s ability to participate. Google is
diff --git a/native_client_sdk/src/doc/cpp-api.rst b/native_client_sdk/src/doc/cpp-api.rst
new file mode 100644
index 0000000000..6ab61892db
--- /dev/null
+++ b/native_client_sdk/src/doc/cpp-api.rst
@@ -0,0 +1,3 @@
+.. _cpp-api:
+
+.. include:: pepper_stable/cpp/index.rst
diff --git a/native_client_sdk/src/doc/devguide/coding/application-structure.rst b/native_client_sdk/src/doc/devguide/coding/application-structure.rst
index 4e82706dce..3c475d26ec 100644
--- a/native_client_sdk/src/doc/devguide/coding/application-structure.rst
+++ b/native_client_sdk/src/doc/devguide/coding/application-structure.rst
@@ -9,8 +9,8 @@ Application Structure
:backlinks: none
:depth: 2
-This chapter of the Developer's Guide describes the general structure of a
-Native Client application. The chapter assumes you are familiar with the
+This section of the Developer's Guide describes the general structure of a
+Native Client application. The section assumes you are familiar with the
material presented in the :doc:`Technical Overview <../../overview>`.
@@ -250,6 +250,6 @@ issue a ``crash`` event
While the ``CreateModule()`` factory function, the ``Module`` class, and the
``Instance`` class are required for a Native Client application, the code
-samples shown above don't actually do anything. Subsequent chapters in the
+samples shown above don't actually do anything. Subsequent sections in the
Developer's Guide build on these code samples and add more interesting
functionality.
diff --git a/native_client_sdk/src/doc/devguide/coding/audio.rst b/native_client_sdk/src/doc/devguide/coding/audio.rst
index 88c93880da..cfe627c166 100644
--- a/native_client_sdk/src/doc/devguide/coding/audio.rst
+++ b/native_client_sdk/src/doc/devguide/coding/audio.rst
@@ -9,7 +9,7 @@ Audio
:backlinks: none
:depth: 2
-This chapter describes how to use the Pepper audio API to play an audio
+This section describes how to use the Pepper audio API to play an audio
stream. The Pepper audio API provides a low-level means of playing a stream of
audio samples generated by a Native Client module. The API generally works as
follows: A Native Client module creates an audio resource that represents an
@@ -18,7 +18,7 @@ resource. The browser calls a function in the Native Client module to fill a
buffer with audio samples every time it needs data to play from the audio
stream.
-The code examples in this chapter describe a simple Native Client module that
+The code examples in this section describe a simple Native Client module that
generates audio samples using a sine wave with a frequency of 440 Hz. The module
starts playing the audio samples as soon as it is loaded into the browser. For a
slightly more sophisticated example, see the ``audio`` example (source code in
diff --git a/native_client_sdk/src/doc/devguide/coding/file-io.rst b/native_client_sdk/src/doc/devguide/coding/file-io.rst
index abec7f9162..17df6d47d8 100644
--- a/native_client_sdk/src/doc/devguide/coding/file-io.rst
+++ b/native_client_sdk/src/doc/devguide/coding/file-io.rst
@@ -12,7 +12,7 @@ File I/O
Introduction
============
-This chapter describes how to use the `FileIO API
+This section describes how to use the `FileIO API
</native-client/pepper_stable/cpp/classpp_1_1_file_i_o>`_ to read and write
files using a local secure data store.
@@ -28,7 +28,7 @@ data download and caching solution for your NaCl applications. For example:
#. Load the file into memory using the File IO API when needed by your
application.
-The example discussed in this chapter is included in the SDK in the directory
+The example discussed in this section is included in the SDK in the directory
``examples/api/file_io``.
Reference information
diff --git a/native_client_sdk/src/doc/devguide/coding/message-system.rst b/native_client_sdk/src/doc/devguide/coding/message-system.rst
index 1fcb2de136..8154db0420 100644
--- a/native_client_sdk/src/doc/devguide/coding/message-system.rst
+++ b/native_client_sdk/src/doc/devguide/coding/message-system.rst
@@ -9,13 +9,13 @@ Messaging System
:backlinks: none
:depth: 2
-This chapter describes the messaging system used to communicate between the
+This section describes the messaging system used to communicate between the
JavaScript code and the Native Client module's C or C++ code in a
Native Client application. It introduces the concept of asynchronous
programming and the basic steps required to set up a Native Client module
-that sends messages to and receive messages from JavaScript. This chapter
+that sends messages to and receive messages from JavaScript. This section
assumes you are familiar with the material presented in the
-:doc:`Application Structure <application-structure>` chapter.
+:doc:`Application Structure <application-structure>` section.
.. Note::
:class: note
diff --git a/native_client_sdk/src/doc/devguide/coding/progress-events.rst b/native_client_sdk/src/doc/devguide/coding/progress-events.rst
index 3275821f32..ce962e175b 100644
--- a/native_client_sdk/src/doc/devguide/coding/progress-events.rst
+++ b/native_client_sdk/src/doc/devguide/coding/progress-events.rst
@@ -1,7 +1,5 @@
.. _devcycle-progress-events:
-:template: standard_nacl_api
-
###############
Progress Events
###############
@@ -13,9 +11,9 @@ Progress Events
There are five types of events that developers can respond to in Native Client:
progress, message, view change, focus, and input events (each described in the
-glossary below). This chapter describes how to monitor progress events (events
+glossary below). This section describes how to monitor progress events (events
that occur during the loading and execution of a Native Client module). This
-chapter assumes you are familiar with the material presented in the
+section assumes you are familiar with the material presented in the
:doc:`Technical Overview <../../overview>`.
.. Note::
@@ -35,101 +33,79 @@ port of the proposed W3C `Progress Events
event which is an extension of the W3C standard). The following table lists the
events types reported by the Native Client runtime:
-+-------------+--------------------+-----------+---------------+---------------+
-| Event | Description | Number of | When event is | How you might |
-| | | times | triggered | react to |
-| | | triggered | | event |
-+=============+====================+===========+===============+===============+
-|``loadstart``| Native Client has | once | This is the | Display a |
-| | started to load a | | first | status |
-| | Native Client | | progress | message, such |
-| | module. | | event | as |
-| | | | triggered | "Loading..." |
-| | | | after the | |
-| | | | Native Client | |
-| | | | module is | |
-| | | | instantiated | |
-| | | | and | |
-| | | | initialized. | |
-+-------------+--------------------+-----------+---------------+---------------+
-|``progress`` | Part of the module | zero or | After | Display a |
-| | has been loaded. | more | ``loadstart`` | progress bar. |
-| | | | has been | |
-| | | | dispatched. | |
-+-------------+--------------------+-----------+---------------+---------------+
-|``error`` | The Native Client | zero or | After the | Inform user |
-| | module failed to | once | last | that the |
-| | start execution | | ``progress`` | application |
-| | (includes any | | event has | failed to |
-| | error before or | | been | load. |
-| | during | | dispatched, | |
-| | initialization of | | or after | |
-| | the module). The | | ``loadstart`` | |
-| | ``lastError`` | | if no | |
-| | attribute | | ``progress`` | |
-| | (mentioned later) | | event was | |
-| | provides details | | dispatched. | |
-| | on the error | | | |
-| | (initialization | | | |
-| | failed, sel_ldr | | | |
-| | did not start, | | | |
-| | and so on). | | | |
-+-------------+--------------------+-----------+---------------+---------------+
-|``abort`` | Loading of the | zero or | After the | It's not |
-| | Native Client | once | last | likely you |
-| | module was | | ``progress`` | will want to |
-| | aborted by the | | event has | respond to |
-| | user. | | been | this event. |
-| | | | dispatched, | |
-| | | | or after | |
-| | | | ``loadstart`` | |
-| | | | if no | |
-| | | | ``progress`` | |
-| | | | event was | |
-| | | | dispatched. | |
-+-------------+--------------------+-----------+---------------+---------------+
-|``load`` | The Native Client | zero or | After the | Remove the |
-| | module was | once | last | progress bar. |
-| | successfully | | ``progress`` | |
-| | loaded, and | | event has | |
-| | execution was | | been | |
-| | started. (The | | dispatched, | |
-| | module was | | or after | |
-| | initialized | | ``loadstart`` | |
-| | successfully.) | | if no | |
-| | | | ``progress`` | |
-| | | | event was | |
-| | | | dispatched. | |
-+-------------+--------------------+-----------+---------------+---------------+
-|``loadend`` | Loading of the | once | After an | Indicate |
-| | Native Client | | ``error``, | loading is |
-| | module has | | ``abort``, or | over |
-| | stopped. Load | | ``load`` | (regardless |
-| | succeeded | | event was | of failure or |
-| | (``load``), | | dispatched. | not). |
-| | failed | | | |
-| | (``error``), or | | | |
-| | was aborted | | | |
-| | (``abort``). | | | |
-+-------------+--------------------+-----------+---------------+---------------+
-|``crash`` | The Native Client | zero or | After a | Notify user |
-| | module is not | once | ``loadend``. | that the |
-| | responding (died | | | module did |
-| | on an | | | something |
-| | ``assert()`` or | | | illegal. |
-| | ``exit()``) after | | | |
-| | a successful | | | |
-| | load. This event | | | |
-| | is unique to | | | |
-| | Native Client and | | | |
-| | is not part of | | | |
-| | the W3C Progress | | | |
-| | Events standard. | | | |
-| | The ``exitStatus`` | | | |
-| | attribute provides | | | |
-| | the numeric exit | | | |
-| | status value. | | | |
-+-------------+--------------------+-----------+---------------+---------------+
++----------------------------------+-----------+---------------+---------------+
+| Event | Times | When | How you might |
+| | triggered | triggered | respond |
++==================================+===========+===============+===============+
+|``loadstart`` | once | The | Display a |
+| Native Client has started to | | first | status |
+| load a Native Client module. | | progress | message, such |
+| | | event | as |
+| | | after the | "Loading..." |
+| | | Native Client | |
+| | | module is | |
+| | | instantiated | |
+| | | and | |
+| | | initialized. | |
++----------------------------------+-----------+---------------+---------------+
+|``progress`` | zero or | After | Display a |
+| Part of the module has been | more | ``loadstart`` | progress bar. |
+| loaded. | | has been | |
+| | | dispatched. | |
++----------------------------------+-----------+---------------+---------------+
+|``error`` | zero or | After the last| Inform user |
+| The Native Client module failed | once | ``progress`` | that the |
+| to start execution (includes any| | event has been| application |
+| error before or during | | dispatched, | failed to |
+| initialization of the module). | | or after | load. |
+| The ``lastError`` attribute | | ``loadstart`` | |
+| (mentioned later) provides | | if no | |
+| details on the error | | ``progress`` | |
+| (initialization failed, sel_ldr | | event was | |
+| did not start, and so on). | | dispatched. | |
++----------------------------------+-----------+---------------+---------------+
+|``abort`` | zero or | After the last| It's not |
+| Loading of the NativeClient | once | ``progress`` | likely you |
+| module was aborted by the user. | | event has been| will want to |
+| | | dispatched, or| respond to |
+| | | after | this event. |
+| | | ``loadstart`` | |
+| | | if no | |
+| | | ``progress`` | |
+| | | event was | |
+| | | dispatched. | |
++----------------------------------+-----------+---------------+---------------+
+|``load`` | zero or | After the | Remove the |
+| The Native Client module was | once | last | progress bar. |
+| successfully loaded, and | | ``progress`` | |
+| execution was started. | | event has been| |
+| (The module was initialized | | dispatched, or| |
+| successfully.) | | after | |
+| | | ``loadstart`` | |
+| | | if no | |
+| | | ``progress`` | |
+| | | event was | |
+| | | dispatched. | |
++----------------------------------+-----------+---------------+---------------+
+|``loadend`` | once | After an | Indicate |
+| Loading of the Native Client | | ``error``, | loading is |
+| module has stopped. Load | | ``abort``, or | over |
+| succeeded (``load``), failed | | ``load`` | (regardless of|
+| (``error``), or was aborted | | event was | failure or |
+| (``abort``). | | dispatched. | not). |
++----------------------------------+-----------+---------------+---------------+
+|``crash`` | zero or | After a | Notify user |
+| The Native Client module is not | once | ``loadend``. | that the |
+| responding (died on an | | | module did |
+| ``assert()`` or ``exit()``) | | | something |
+| after a successful load. This | | | illegal. |
+| event is unique to Native Client| | | |
+| and is not part of the W3C | | | |
+| Progress Events standard. The | | | |
+| ``exitStatus`` attribute | | | |
+| provides the numeric exit | | | |
+| status. | | | |
++----------------------------------+-----------+---------------+---------------+
The sequence of events for a successful module load is as follows:
diff --git a/native_client_sdk/src/doc/devguide/coding/url-loading.rst b/native_client_sdk/src/doc/devguide/coding/url-loading.rst
index 4726939183..9949467cfe 100644
--- a/native_client_sdk/src/doc/devguide/coding/url-loading.rst
+++ b/native_client_sdk/src/doc/devguide/coding/url-loading.rst
@@ -12,11 +12,11 @@ URL Loading
Introduction
============
-This chapter describes how to use the `URLLoader API
+This section describes how to use the `URLLoader API
</native-client/pepper_stable/cpp/classpp_1_1_u_r_l_loader>`_ to load resources
such as images and sound files from a server into your application.
-The example discussed in this chapter is included in the SDK in the directory
+The example discussed in this section is included in the SDK in the directory
``examples/api/url_loader``.
Reference information
@@ -41,7 +41,7 @@ When a user launches your Native Client web application, Chrome downloads and
caches your application's HTML file, manifest file (.nmf), and Native Client
module (.pexe or .nexe). If your application needs additional assets, such as
images and sound files, it must explicitly load those assets. You can use the
-Pepper APIs described in this chapter to load assets from a URL into your
+Pepper APIs described in this section to load assets from a URL into your
application.
After you've loaded assets into your application, Chrome will cache those
diff --git a/native_client_sdk/src/doc/devguide/coding/view-focus-input-events.rst b/native_client_sdk/src/doc/devguide/coding/view-focus-input-events.rst
index 8714bde9a3..57d45c4aa9 100644
--- a/native_client_sdk/src/doc/devguide/coding/view-focus-input-events.rst
+++ b/native_client_sdk/src/doc/devguide/coding/view-focus-input-events.rst
@@ -1,7 +1,5 @@
.. _view_focus_input_events:
-:template: standard_nacl_api
-
####################################
View Change, Focus, and Input Events
####################################
@@ -11,11 +9,11 @@ View Change, Focus, and Input Events
:backlinks: none
:depth: 2
-This chapter describes view change, focus, and input event handling for a
-Native Client module. The chapter assumes you are familiar with the
+This section describes view change, focus, and input event handling for a
+Native Client module. The section assumes you are familiar with the
material presented in the :doc:`Technical Overview <../../overview>`.
-There are two examples used in this chapter to illustrate basic
+There are two examples used in this section to illustrate basic
programming techniques. The ``input_events`` example is used to
illustrate how your module can react to keyboard and mouse input
event. The ``mouse_lock`` example is used to illustrate how your module
@@ -43,71 +41,55 @@ override certain functions in the `pp::Instance
</native-client/pepper_stable/cpp/classpp_1_1_instance>`_ class to handle input
and browser events. These functions are listed in the table below:
-
-====================== =============================== ====================
-Function Event Use
-====================== =============================== ====================
-``DidChangeView`` Called when the position, An implementation
- size, or clip rectangle of this function
- of the module's instance in might check the size
- the browser has changed. of the module
- This event also occurs instance's rectangle
- when browser window is has changed and
- resized or mouse wheel reallocate the
- is scrolled. graphics context
- when a different
- size is received.
-
-``DidChangeFocus`` Called when the module's An implementation
- instance in the browser of this function
- has gone in or out of might start or stop
- focus (usually by an animation or a
- clicking inside or blinking cursor.
- outside the module
- instance). Having focus
- means that keyboard
- events will be sent to
- the module instance.
- An instance's default
- condition is that it
- does not have focus.
-
-``HandleDocumentLoad`` Called after This API is only
- ``pp::Instance::Init()`` applicable when you
- for a full-frame module are writing an
- instance that was extension to enhance
- instantiated based on the abilities of
- the MIME type of a the Chrome web
- DOMWindow navigation. browser. For
- This situation only example, a PDF
- applies to modules that viewer might
- are pre-registered to implement this
- handle certain MIME function to download
- types. If you haven't and display a PDF
- specifically registered file.
- to handle a MIME type or
- aren't positive this
- applies to you, your
- implementation of this
- function can just return
- false.
-
-``HandleInputEvent`` Called when a user An implementation of
- interacts with the this function
- module's instance in the examines the input
- browser using an input event type and
- device such as a mouse branches accordingly.
- or keyboard. You must
- register your module to
- accept input events
- using
- ``RequestInputEvents()``
- for mouse events and
- ``RequestFilteringInputEvents``
- for keyboard events
- prior to overriding this
- function.
-====================== =============================== ====================
++-------------------------------------+----------------------------------------+
+| Function | Use |
++=====================================+========================================+
+|``DidChangeView`` |An implementation of this function might|
+| Called when the position, size, or |check the size of the module instance's |
+| clip rectangle of the module's |rectangle has changed and reallocate the|
+| instance in the browser has |graphcs context when a different size is|
+| changed. This event also occurs |received. |
+| when the browser window is resized | |
+| or the mouse wheel is scrolled. | |
++-------------------------------------+----------------------------------------+
+|``DidChangeFocus`` |An implementation of this function might|
+| Called when the module's instance |start or stop an animation or a blinking|
+| in the browser has gone in or out |cursor. |
+| of focus (usually by clicking | |
+| inside or outside the module | |
+| instance). Having focus means that | |
+| keyboard events will be sent to the| |
+| module instance. An instance's | |
+| default condition is that it does | |
+| not have focus. | |
++-------------------------------------+----------------------------------------+
+|``HandleDocumentLoad`` |This API is only applicable when you are|
+| ``pp::Instance::Init()`` for a |writing an extension to enhance the |
+| full-frame module instance that was|abilities of the Chrome web browser. For|
+| instantiated based on the MIME |example, a PDF viewer might implement |
+| type of a DOMWindow navigation. |this function to download and display a |
+| This situation only applies to |PDF file. |
+| modules that are pre-registered to | |
+| handle certain MIME types. If you | |
+| haven't specifically registered to | |
+| handle a MIME type or aren't | |
+| positive this applies to you, your | |
+| implementation of this function can| |
+| just return false. | |
++-------------------------------------+----------------------------------------+
+|``HandleInputEvent`` |An implementation of this function |
+| Called when a user interacts with |examines the input event type and |
+| the module's instance in the |branches accordingly. |
+| browser using an input device such | |
+| as a mouse or keyboard. You must | |
+| register your module to accept | |
+| input events using | |
+| ``RequestInputEvents()`` | |
+| for mouse events and | |
+| ``RequestFilteringInputEvents()`` | |
+| for keyboard events prior to | |
+| overriding this function. | |
++-------------------------------------+----------------------------------------+
These interfaces are found in the `pp::Instance class
diff --git a/native_client_sdk/src/doc/devguide/devcycle/debugging.rst b/native_client_sdk/src/doc/devguide/devcycle/debugging.rst
index 326ac22b6f..b00adb6526 100644
--- a/native_client_sdk/src/doc/devguide/devcycle/debugging.rst
+++ b/native_client_sdk/src/doc/devguide/devcycle/debugging.rst
@@ -114,61 +114,6 @@ variable as follows:
the ``--no-sandbox`` flag. You must also be careful that each variable points
to a different file.
-Redirecting output to the JavaScript console
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-You can also cause output from printf statements in your C/C++ code to be
-relayed to the JavaScript side of your application through the Pepper messaging
-system, where you can then write the output to the JavaScript console. Follow
-these steps:
-
-#. Set the ``NACL_EXE_STDOUT`` and ``NACL_EXE_STDERR`` environment variables as
- follows:
-
- * ``NACL_EXE_STDOUT=DEBUG_ONLY:dev://postmessage``
- * ``NACL_EXE_STDERR=DEBUG_ONLY:dev://postmessage``
-
- These settings tell Native Client to use ``PostMessage()`` to send output
- that your Native Client module writes to stdout and stderr to the JavaScript
- side of your application.
-
-#. Register a JavaScript handler to receive messages from your Native Client
- module:
-
- .. naclcode::
-
- <div id="nacl_container">
- <script type="text/javascript">
- var container = document.getElementById('nacl_container');
- container.addEventListener('message', handleMessage, true);
- </script>
- <embed id="nacl_module"
- src="my_application.nmf"
- type="application/x-nacl" />
- </div>
-
-#. Implement a simple JavaScript handler that logs the messages it receives to
- the JavaScript console:
-
- .. naclcode::
-
- function handleMessage(message_event) {
- console.log(message_event.data);
- }
-
- This handler works in the simple case where the only messages your Native
- Client module sends to JavaScript are messages with the output from stdout
- and stderr. If your Native Client module also sends other messages to
- JavaScript, your handler will need to be more complex.
-
- Once you've implemented a message handler and set up the environment
- variables as described above, you can check the JavaScript console to see
- output that your Native Client module prints to stdout and stderr. Keep in
- mind that your module makes a call to ``PostMessage()`` every time it flushes
- stdout or stderr. Your application's performance will degrade considerably
- if your module prints and flushes frequently, or if it makes frequent Pepper
- calls to begin with (e.g., to render).
-
Logging calls to Pepper interfaces
----------------------------------
@@ -589,17 +534,6 @@ Note that starting with the ``pepper_22`` bundle, the NaCl SDK for Windows
includes pre-built libraries and library source code, making it much easier to
build a module into a .DLL.
-Open source profiling tools
----------------------------
-
-For the brave-hearted there are open source tools at `Chromium.org
-<http://www.chromium.org/nativeclient>`_ that describe how to do profiling on
-`64-bit Windows
-<https://sites.google.com/a/chromium.org/dev/nativeclient/how-tos/profiling-nacl-apps-on-64-bit-windows>`_
-and `Linux
-<http://www.chromium.org/nativeclient/how-tos/limited-profiling-with-oprofile-on-x86-64>`_
-machines.
-
.. |menu-icon| image:: /images/menu-icon.png
.. |puzzle| image:: /images/puzzle.png
diff --git a/native_client_sdk/src/doc/devguide/devcycle/dynamic-loading.rst b/native_client_sdk/src/doc/devguide/devcycle/dynamic-loading.rst
index d0242f004a..519ce1e3a8 100644
--- a/native_client_sdk/src/doc/devguide/devcycle/dynamic-loading.rst
+++ b/native_client_sdk/src/doc/devguide/devcycle/dynamic-loading.rst
@@ -7,9 +7,6 @@ Dynamic Linking and Loading with glibc
:backlinks: none
:depth: 2
-Introduction
-============
-
.. Note::
:class: caution
@@ -31,31 +28,30 @@ C standard libraries: glibc and newlib
The Native Client SDK comes with two C standard libraries --- glibc and
newlib. These libraries are described in the table below.
-+--------+----------+-------------+--------------------------------------------+
-| Library| Linking | License | Description |
-+========+==========+=============+============================================+
-| glibc | dynamic | GNU Lesser | glibc is the GNU implementation of the |
-| | or static| General | POSIX_ standard runtime library for the C |
-| | | Public | programming language. Designed for |
-| | | License | portability and performance, glibc is one |
-| | | (LGPL) | of the most popular implementations of the |
-| | | | C library. It is comprised of a set of |
-| | | | interdependent libraries including libc, |
-| | | | libpthreads, libdl, and others. For |
-| | | | documentation, FAQs, and additional |
-| | | | information about glibc, see GLIBC_ |
-+--------+----------+-------------+--------------------------------------------+
-| newlib | static | Berkeley | newlib is a C library intended for use in |
-| | | Software | embedded systems. Like glibc, newlib is a |
-| | | Distribution| conglomeration of several library parts. |
-| | | (BSD) type | It is available for use under BSD-type free|
-| | | free | software licenses, which generally makes it|
-| | | software | more suitable to link statically in |
-| | | licenses | commercial, closed-source applications. For|
-| | | | documentation, FAQs, and additional |
-| | | | information about newlib, see the newlib_ |
-| | | | documentation. |
-+--------+----------+-------------+--------------------------------------------+
++-----------------------------------------------------+----------+-------------+
+| Library | Linking | License |
++=====================================================+==========+=============+
+|glibc | dynamic | GNU Lesser |
+| The GNU implementation of the POSIX_ standard | or static| General |
+| runtime library for the C programming language. | | Public |
+| Designed for portability and performance, glibc is | | License |
+| one of the most popular implementations of the C | | (LGPL) |
+| library. It is comprised of a set of interdependent| | |
+| libraries including libc, libpthreads, libdl, and | | |
+| others. For documentation, FAQs, and additional | | |
+| information about glibc, see GLIBC_. | | |
++-----------------------------------------------------+----------+-------------+
+|newlib | static | Berkeley |
+| newlib is a C library intended for use in embedded | | Software |
+| systems. Like glibc, newlib is a conglomeration of | | Distribution|
+| several libraries. It is available for use under | | (BSD) type |
+| BSD-type free software licenses, which generally | | free |
+| makes it more suitable to link statically in | | software |
+| commercial, closed-source applications. For | | licenses |
+| documentation, FAQs, and additional information | | |
+| about newlib, see newlib_. | | |
++-----------------------------------------------------+----------+-------------+
+
For proprietary (closed-source) applications, your options are to either
statically link to newlib, or dynamically link to glibc. We recommend
diff --git a/native_client_sdk/src/doc/devguide/devcycle/running.rst b/native_client_sdk/src/doc/devguide/devcycle/running.rst
index e6e25dc88a..3394494733 100644
--- a/native_client_sdk/src/doc/devguide/devcycle/running.rst
+++ b/native_client_sdk/src/doc/devguide/devcycle/running.rst
@@ -1,7 +1,5 @@
.. _devcycle-running:
-:template: standard_nacl_api
-
#######
Running
#######
@@ -67,49 +65,57 @@ below. Each technique has certain requirements (NaCl flag, web server, and/or
CWS metadata); these are explained in the :ref:`Requirements <requirements>`
section below.
-.. list-table::
- :header-rows: 1
-
- * - #
- - Technique
- - Requires NaCl flag
- - Requires Web Server
- - Requires CWS Metadata
- - Description
- * - 1
- - Local server
- - |CHK|
- - |CHK|
- -
- - Run a local server and simply point your browser to your application on
- the server.
- * - 2
- - Packaged application loaded as an unpacked extension
- -
- -
- - |CHK|
- - Load your packaged application into Chrome as an unpacked extension and
- run it without a server. An unpacked extension is simply an application
- whose source and metadata files are located in a plain (unzipped) folder
- on your development machine. The CWS manifest file (explained below) must
- specify a ``local_path`` field.
- * - 3
- - Hosted application loaded as an unpacked extension
- -
- - |CHK|
- - |CHK|
- - Load your hosted application into Chrome as an unpacked extension and run
- it from a server (which can be a local server). The CWS manifest file
- must specify a ``web_url`` field.
- * - 4
- - CWS application with untrusted testers
- -
- -
- - |CHK|
- - This is the standard technique for distributing a packaged or hosted
- application in the CWS, but you can limit the application to a few
- trusted testers. This technique requires a server if your application is
- a hosted application.
+
++--------------------------------------------------------+----------+----------+
+| Technique | Requires | Requires |
+| | Web | CWS |
+| | Server | Metadata |
++========================================================+==========+==========+
+|**1. Local server** | |CHK| | |
+| | | |
+| .. | | |
+| | | |
+| Run a local server and simply point your browser to | | |
+| your application on the server. | | |
+| | | |
+| .. Note:: | | |
+| :class: note | | |
+| | | |
+| This technique requires the NaCl flag. | | |
++---------------------------------------------+----------+----------+----------+
+|**2. Packaged application loaded as an unpacked | | |CHK| |
+|extension** | | |
+| | | |
+| .. | | |
+| | | |
+| Load your packaged application into Chrome as an | | |
+| unpacked extension and run it without a server. An | | |
+| unpacked extension is an application whose source and | | |
+| metadata files are located in an unzipped folder on | | |
+| your development machine. The CWS manifest file | | |
+| (explained below) must specify a local_path field. | | |
++--------------------------------------------------------+----------+----------+
+|**3. Hosted application loaded as an unpacked | |CHK| | |CHK| |
+|extension** | | |
+| | | |
+| .. | | |
+| | | |
+| Load your hosted application into Chrome as an | | |
+| unpacked extension and run it from a server (which can| | |
+| be a local server). The CWS manifest file must specify| | |
+| a web_url field. | | |
++--------------------------------------------------------+----------+----------+
+|**4. CWS application with untrusted testers** | | |CHK| |
+| | | |
+| .. | | |
+| | | |
+| The standard technique for distributing a packaged or | | |
+| hosted application in the CWS. You can limit the | | |
+| application to trusted testers. This technique | | |
+| requires a server if your application is a hosted | | |
+| application. | | |
++--------------------------------------------------------+----------+----------+
+
.. |CHK| image:: /images/check-red.png
@@ -420,7 +426,7 @@ is how to do so:
* Upload the application files (.html, .nmf, .nexe, .css, .js, image files,
etc.) to the server on which the application is being hosted.
* Use `Google Webmaster Tools <http://www.google.com/webmasters/tools/>`_ to
- verify ownership of the web site on which the application runs.
+ verify ownership of the website on which the application runs.
#. Log in to the `Chrome Web Store Developer Dashboard
<https://chrome.google.com/webstore/developer/dashboard>`_.
diff --git a/native_client_sdk/src/doc/devguide/devcycle/vs-addin.rst b/native_client_sdk/src/doc/devguide/devcycle/vs-addin.rst
index 90e4d96435..c028d4375f 100644
--- a/native_client_sdk/src/doc/devguide/devcycle/vs-addin.rst
+++ b/native_client_sdk/src/doc/devguide/devcycle/vs-addin.rst
@@ -1,7 +1,7 @@
-:template: standard_nacl_api
+.. _devcycle-vs-addin:
############################
-Debugging With Visual Studio
+Debugging with Visual Studio
############################
@@ -181,10 +181,10 @@ example):
+-------------------+----------------------------------------------------------+
| Variable Name | Description |
+===================+==========================================================+
-| NACL_SDK_ROOT | The path to the pepper directory in the SDK. |
+| ``NACL_SDK_ROOT`` | The path to the pepper directory in the SDK. |
| | For example: ``C:\nacl_sdk\pepper_23`` |
+-------------------+----------------------------------------------------------+
-| CHROME_PATH | The path to the .exe file for the version of Chrome you |
+| ``CHROME_PATH`` | The path to the .exe file for the version of Chrome you |
| | are testing with. For example: |
| | ``C:\Users\fred\AppData\Local\Google\Chrome |
| | SxS\Application\chrome.exe`` |
diff --git a/native_client_sdk/src/doc/devguide/tutorial/tutorial-part1.rst b/native_client_sdk/src/doc/devguide/tutorial/tutorial-part1.rst
index 46604f7923..46ab52e89c 100644
--- a/native_client_sdk/src/doc/devguide/tutorial/tutorial-part1.rst
+++ b/native_client_sdk/src/doc/devguide/tutorial/tutorial-part1.rst
@@ -17,26 +17,26 @@ Client (PNaCl). This is a client-side application that uses HTML, JavaScript and
a Native Client module written in C++. The PNaCl toolchain is used to enable
running the Native Client module directly from a web page.
-It's recommended to read the :doc:`Native Client Technical Overview
+It's recommended that you read the :doc:`Native Client Technical Overview
</overview>` prior to going through this tutorial.
What the application in this tutorial does
------------------------------------------
The application in this tutorial shows how to load a Native Client module in a
-web page, and how to send messages between JavaScript and the C++ code in the
-Native Client module. In this simple application, the JavaScript code in the web
-page sends a ``'hello'`` message to the Native Client module. When the Native
-Client module receives a message, it checks whether the message is equal to the
-string ``'hello'``. If it is, the Native Client module returns a message saying
-``'hello from NaCl'``. A JavaScript alert panel displays the message received
-from the Native Client module.
+web page, and how to send messages between JavaScript and the Native Client
+module. In this simple application, the JavaScript sends a ``'hello'`` message
+to the Native Client module. When the Native Client module receives a message,
+it checks whether the message is equal to the string ``'hello'``. If it is, the
+Native Client module returns a message saying ``'hello from NaCl'``. A
+JavaScript alert panel displays the message received from the Native Client
+module.
Communication between JavaScript and Native Client modules
----------------------------------------------------------
The Native Client programming model supports bidirectional communication between
-JavaScript and the Native Client module (C/C++ code). Both sides can initiate
+JavaScript and the Native Client module. Both sides can initiate
and respond to messages. In all cases, the communication is asynchronous: The
caller (JavaScript or the Native Client module) sends a message, but the caller
does not wait for, or may not even expect, a response. This behavior is
@@ -76,8 +76,8 @@ rule called ``serve`` is the easiest way to invoke it:
:doc:`versioning information </version>`). In the sample invocation above
``pepper_$(VERSION)`` refers to the specific version you want to use. For
example, ``pepper_31``. If you don't know which version you need, use the
- one labeled ``(stable)`` by ``naclsdk list``. See :doc:`Download the Native
- Client SDK </sdk/download>` for more details.
+ one labeled ``(stable)`` by the ``naclsdk list`` command. See
+ :doc:`Download the Native Client SDK </sdk/download>` for more details.
If no port number is specified, the server defaults to port 5103, and can be
accessed at ``http://localhost:5103``.
@@ -246,12 +246,13 @@ member functions.
Step 8: Compile the Native Client module and run the application again
======================================================================
-Compile the Native Client module by running the ``make`` command again.
-
-Re-run the application by reloading ``http://localhost:5103/part1`` in Chrome.
-
-After Chrome loads the Native Client module, you should see an alert panel
-appear with the message sent from the module.
+#. Compile the Native Client module by running the ``make`` command again.
+#. Start the SDK web server by running ``make server``.
+#. Re-run the application by reloading ``http://localhost:5103/part1`` in
+ Chrome.
+
+ After Chrome loads the Native Client module, you should see the message sent
+ from the module.
.. _tutorial_troubleshooting:
@@ -280,7 +281,7 @@ Next steps
==========
* See the :doc:`Application Structure </devguide/coding/application-structure>`
- chapter in the Developer's Guide for information about how to structure a
+ section in the Developer's Guide for information about how to structure a
Native Client module.
* Check the `C++ Reference </native-client/pepper_stable/cpp>`_ for details
about how to use the Pepper APIs.
diff --git a/native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst b/native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst
index 3f8de272cf..6cee489a6e 100644
--- a/native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst
+++ b/native_client_sdk/src/doc/devguide/tutorial/tutorial-part2.rst
@@ -301,7 +301,9 @@ configurations, and path to the ``.nmf`` file:
example with different toolchains by changing the URL's `query string
<http://en.wikipedia.org/wiki/Query_string>`_. For example, you can load the
glibc Debug version of this example by navigating to
-``index.html?tc=glibc&config=Debug``.
+``index.html?tc=glibc&config=Debug``. Path URI's such as ``../``, for example
+do not work for either the data-path parameter or its corresponding query
+string.
Next, we remove the ``embed`` element that is described in HTML. This will be
automatically added for us by ``common.js``, based on the current
@@ -496,3 +498,14 @@ during the module loading process. This example only needs to respond to two:
var logEl = document.getElementById('log');
logEl.textContent += message.data;
}
+
+Compile the Native Client module and run the application again
+==============================================================
+
+#. Compile the Native Client module by running the ``make`` command again.
+#. Start the SDK web server by running ``make server``.
+#. Re-run the application by reloading ``http://localhost:5103/part2`` in
+ Chrome.
+
+ After Chrome loads the Native Client module, you should see the message sent
+ from the module.
diff --git a/native_client_sdk/src/doc/glossary.rst b/native_client_sdk/src/doc/glossary.rst
index e4607123a7..cf3220261a 100644
--- a/native_client_sdk/src/doc/glossary.rst
+++ b/native_client_sdk/src/doc/glossary.rst
@@ -27,7 +27,7 @@ manifest file
A file containing metadata or information about accompanying files.
message events
Events used to pass data between JavaScript and the Native Client
- module (see the :doc:`Messaging System <devguide/coding/message-system>` chapter).
+ module (see the :doc:`Messaging System <devguide/coding/message-system>` section).
module
Depending on context, "module" may mean one of two things. First, it may be a
general short-term for for "Native Client module"---compiled C/C++ code
diff --git a/native_client_sdk/src/doc/images/nacl-in-a-web-app.png b/native_client_sdk/src/doc/images/nacl-in-a-web-app.png
index 1ffed33833..44c8b1d5f1 100644
--- a/native_client_sdk/src/doc/images/nacl-in-a-web-app.png
+++ b/native_client_sdk/src/doc/images/nacl-in-a-web-app.png
Binary files differ
diff --git a/native_client_sdk/src/doc/images/nacl-pnacl-component-diagram.png b/native_client_sdk/src/doc/images/nacl-pnacl-component-diagram.png
index 338be194e5..da9cd7e9ab 100644
--- a/native_client_sdk/src/doc/images/nacl-pnacl-component-diagram.png
+++ b/native_client_sdk/src/doc/images/nacl-pnacl-component-diagram.png
Binary files differ
diff --git a/native_client_sdk/src/doc/images/web-app-with-nacl.png b/native_client_sdk/src/doc/images/web-app-with-nacl.png
index 46d5ca6778..7661fc3b6f 100644
--- a/native_client_sdk/src/doc/images/web-app-with-nacl.png
+++ b/native_client_sdk/src/doc/images/web-app-with-nacl.png
Binary files differ
diff --git a/native_client_sdk/src/doc/index.rst b/native_client_sdk/src/doc/index.rst
index 40d78f843d..0a8c030f9b 100644
--- a/native_client_sdk/src/doc/index.rst
+++ b/native_client_sdk/src/doc/index.rst
@@ -5,66 +5,119 @@ Welcome to Native Client
.. raw:: html
<div id="home">
- <a class="button-nacl button-download" href="/native-client/sdk/download.html">Download SDK</a>
+ <div class="pull-quote">To get the SDK and<br/>installation instructions<br/>
+ <a href="/native-client/sdk/download.html">visit the SDK Download page</a>.
+ </div>
<div class="big-intro">
**Native Client** is a sandbox for running compiled C and C++ code in the
browser efficiently and securely, independent of the user's operating system.
**Portable Native Client** extends that technology with
architecture independence, letting developers compile their code once to run
-in any website and on any architecture.
+in any website and on any architecture with ahead-of-time (AOT) translation.
In short, Native Client brings the **performance** and **low-level control**
of native code to modern web browsers, without sacrificing the **security** and
**portability** of the web. Watch the video below for an overview of
Native Client, including its goals, how it works, and how
-Portable Native Client lets developers run native compiled code on the web.
+Portable Native Client lets developers run native compiled code on the web.
+
+.. Note::
+ :class: note
+
+ This site uses several examples of Native Client. For the best experience,
+ consider downloading the `latest version of Chrome
+ <http://www.google.com/chrome/>`_. When you come back, be sure to `check out
+ our demos <https://gonativeclient.appspot.com/demo>`_.
.. raw:: html
</div>
- <iframe class="video" width="640" height="360"
+ <iframe class="video" width="600" height="337"
src="//www.youtube.com/embed/MvKEomoiKBA?rel=0" frameborder="0"></iframe>
+ <div class="big-intro">
+
+Two Types of Modules
+====================
+
+Native Client comes in two flavors.
+
+* **Portable Native Client (PNaCl)**: Pronounced 'pinnacle', PNaCl runs single,
+ portable (**pexe**) executables and is available in most implementations of
+ Chrome. A translator built into Chrome translates the pexe into native code
+ for the client hardware. The entire module is translated before any code is
+ executed rather than as the code is executed. PNaCl modules can be hosted from
+ any web server.
+* **Native Client (NaCl)**: Also called traditional or non-portable Native
+ Client, NaCl runs architecture-dependent (**nexe**) modules, which are
+ packaged into an application. At runtime, the browser decides which nexe to
+ load based on the architecture of the client machine. NaCl modules must be run
+ from the `Chrome Web Store (CWS)
+ <https://chrome.google.com/webstore/category/apps>`_. Fortunately, work from
+ PNaCl modules can be used to create NaCl modules.
+
+These flavors are described in more depth in :doc:`PNaCl and NaCl
+<nacl-and-pnacl>`
+
+.. raw:: html
- <div class="right-side">
- <div class="right-side-inner">
- <h2>Guiding principles of Native Client</h2>
+ <div class="left-side">
+ <div class="left-side-inner">
+ <h2>Hello World</h2>
<div class="big-intro">
- <ul>
- <li>Developer flexibility to program in any language.</li>
- <li>Running close to the metal to allow access to performance gains.</li>
- <li>Protecting users from malicious code and malware.</li>
- <li>Write-once, run-anywhere code portability across all user architectures.</li>
- </ul>
+
+To jump right in :doc:`take the tutorial <devguide/tutorial/tutorial-part1>`
+that walks you through a basic web application for Portable Native Client
+(PNaCl). This is a client-side application that uses HTML, JavaScript, and a
+Native Client module written in C++.
.. raw:: html
</div>
</div>
</div>
+ <h2>A Little More Advanced</h2>
+ <div class="big-intro">
-Get started with Native Client
-==============================
+If you've already got the basics down, you're probably trying to get a real
+application ready for production. You're :doc:`building
+<devguide/devcycle/building>`, :doc:`debugging <devguide/devcycle/debugging>`
+or :doc:`ready to distribute <devguide/distributing>`.
.. raw:: html
- <div class="big-intro">
+ </div>
-#. :doc:`Download the Native Client SDK <sdk/download>`.
-#. Read the :doc:`Technical Overview <overview>`.
-#. Learn how to use the SDK and build both a web app and a Chrome app in the
- :doc:`Getting Started Tutorial <devguide/tutorial/tutorial-part1>`.
+ <div class="left-side">
+ <div class="left-side-inner">
+ <h2>Nuts and Bolts</h2>
+ <div class="big-intro">
+
+You've been working on a Native Client module for a while now and you've run
+into an arcane problem. You may need to refer to the :doc:`PNaCl Bitcode
+Reference <reference/pnacl-bitcode-abi>` or the :doc:`Sandbox internals
+<reference/sandbox_internals/index>`.
.. raw:: html
</div>
+ </div>
+ </div>
+
+I Want to Know Everything
+=========================
+
+So, you like to read now and try later. Start with our :doc:`Technical Overview
+<overview>`
+
+.. raw:: html
+
<div class="big-intro" style="clear: both;">
-Send us questions, comments, and feedback:
-`native-client-discuss <https://groups.google.com/forum/#!forum/native-client-discuss>`_.
+Send us questions, comments, and feedback: `native-client-discuss
+<https://groups.google.com/forum/#!forum/native-client-discuss>`_.
.. raw:: html
</div>
- </div>
diff --git a/native_client_sdk/src/doc/nacl-and-pnacl.rst b/native_client_sdk/src/doc/nacl-and-pnacl.rst
index 2a0872b2b9..b83f0a5c46 100644
--- a/native_client_sdk/src/doc/nacl-and-pnacl.rst
+++ b/native_client_sdk/src/doc/nacl-and-pnacl.rst
@@ -12,109 +12,102 @@ This document describes the differences between **Native Client** and
:backlinks: none
:depth: 2
+.. _native-client-nacl:
+
Native Client (NaCl)
====================
Native Client enables the execution of native code securely inside web
applications through the use of advanced `Software Fault Isolation (SFI)
-techniques </native-client/community/talks#research>`_. Since its launch in
-2011, Native Client has provided developers with the ability to harness a
-client machine's computational power to a much fuller extent than traditional
-web technologies, by running compiled C and C++ code at near-native speeds and
-taking advantage of multiple cores with shared memory.
-
-While Native Client provides operating system independence, it requires
-developers to generate architecture-specific executable modules
-(**nexe** modules) for each hardware platform. This is not only inconvenient
-for developers, but architecture-specific machine code is not portable and thus
-not well-suited for the open web. The traditional method of application
-distribution on the web is through a self-contained bundle of HTML, CSS,
-JavaScript, and other resources (images, etc.) that can be hosted on a server
-and run inside a web browser. With this type of distribution, a website
-created today should still work years later, on all platforms.
-Architecture-specific executables are clearly not a good fit for distribution
-on the web. As a consequence, Native Client has been restricted to
-applications and browser extensions that are installed through the
+techniques <http://research.google.com/pubs/pub35649.html>`_. Native Client
+allows you to harness a client machine's computational power to a fuller extent
+than traditional web technologies. It does this by running compiled C and C++
+code at near-native speeds, and exposing a CPU's full capabilities, including
+SIMD vectors and multiple-core processing with shared memory.
+
+While Native Client provides operating system independence, it requires you to
+generate architecture-specific executables (**nexe**) for each hardware
+platform. This is neither portable nor convenient, making it ill-suited for the
+open web.
+
+The traditional method of application distribution on the web is through self-
+contained bundles of HTML, CSS, JavaScript, and other resources (images, etc.)
+that can be hosted on a server and run inside a web browser. With this type of
+distribution, a website created today should still work years later, on all
+platforms. Architecture-specific executables are clearly not a good fit for
+distribution on the web. Consequently, Native Client has been until recently
+restricted to applications and browser extensions that are installed through the
Chrome Web Store.
+.. _portable-native-client-pnacl:
+
Portable Native Client (PNaCl)
==============================
PNaCl solves the portability problem by splitting the compilation process
into two parts:
-#. compiling the source code to a portable bitcode format, and
-#. translating the bitcode to a host-specific executable.
-
-PNaCl enables developers
-to distribute **portable executables** (**pexe** modules) that the hosting
-environment (e.g., the Chrome browser) can translate to native code before
-executing. This portability aligns Native Client with existing open web
-technologies such as JavaScript: A developer can distribute a **pexe**
-as part of an application (along with HTML, CSS, and JavaScript),
-and the user's machine is simply able to run it.
-
-With PNaCl, a developer generates a single **pexe** from source code,
-rather than multiple platform-specific nexes. The **pexe** provides both
-architecture- and OS-independence. Since the **pexe** uses an abstract,
-architecture-independent format, it does not suffer from the portability
-problem described above. Future versions of hosting environments should
-have no problem executing the **pexe**, even on new architectures.
-Moreover, if an existing architecture is subsequently enhanced, the
-**pexe** doesn't even have to be recompiled---in some cases the
-client-side translation will automatically be able to take advantage of
-the new capabilities.
-
-**In short, PNaCl combines the portability of existing web technologies with
-the performance and security benefits of Native Client.**
-
-With the advent of PNaCl, the distribution restriction of Native Client
-can be lifted. Specifically, a **pexe** module can be part of any web
-application---it does not have to be distributed through the Chrome Web
-Store.
+#. compiling the source code to a bitcode executable (pexe), and
+#. translating the bitcode to a host-specific executable as soon as the module
+ loads in the browser but before any code execution.
+
+This portability aligns Native Client with existing open web technologies such
+as JavaScript. You can distribute a pexe as part of an application (along with
+HTML, CSS, and JavaScript), and the user's machine is simply able to run it.
+
+With PNaCl, you'll generate a single pexe, rather than multiple platform-
+specific nexes. Since the pexe uses an abstract, architecture- and OS-
+independent format, it does not suffer from the portability problem described
+above. Although, PNaCl can be more efficient on some operating systems than on
+others. PNaCl boasts the same level of security as NaCl. Future versions of
+hosting environments should have no problem executing the pexe, even on new
+architectures. Moreover, if an existing architecture is enhanced, the pexe
+doesn't need to be recompiled. In some cases the client-side translation will
+automatically take advantage of new capabilities. A pexe can be part of any web
+application. It does not have to be distributed through the Chrome Web Store. In
+short, PNaCl combines the portability of existing web technologies with the
+performance and security benefits of Native Client.
PNaCl is a new technology, and as such it still has a few limitations
as compared to NaCl. These limitations are described below.
+.. _when-to-use-pnacl:
+
When to use PNaCl
=================
PNaCl is the preferred toolchain for Native Client, and the only way to deploy
-Native Client modules on the open web. Unless your project is subject to one
-of the narrow limitations described below
-(see :ref:`When to use NaCl<when-to-use-nacl>`), you should use PNaCl.
-
-Beginning with version 31, the Chrome browser supports translation of
-**pexe** modules and their use in web applications, without requiring
-any installation (either of a browser plugin or of the applications
-themselves). Native Client and PNaCl are open-source technologies, and
-our hope is that they will be added to other hosting platforms in the
-future.
-
-If controlled distribution through the Chrome Web Store is an important part
-of your product plan, the benefits of PNaCl are less critical for you. But
-you can still use the PNaCl toolchain and distribute your application
-through the Chrome Web Store, and thereby take advantage of the
-conveniences of PNaCl, such as not having to explicitly compile your application
-for all supported architectures.
+Native Client modules without the Google Web Store. Unless your project is
+subject to one of the narrow limitations described under ":ref:`When to use
+NaCl<when-to-use-nacl>`", you should use PNaCl.
+
+Since version 31, Chrome supports translation of pexe
+modules and their use in web applications without requiring installation either
+of a browser plug-in or of the applications themselves. Native Client and PNaCl
+are open-source technologies, and our hope is that they will be added to other
+hosting platforms in the future.
+
+If controlled distribution through the Chrome Web Store is an important part of
+your product plan, the benefits of PNaCl are less critical for you. But you can
+still use the PNaCl toolchain and distribute your application through the Chrome
+Web Store, and thereby take advantage of the conveniences of PNaCl, such as not
+having to explicitly compile your application for all supported architectures.
.. _when-to-use-nacl:
When to use NaCl
================
-The limitations below apply to the current release of PNaCl. If any of
-these limitations are critical for your application, you should use
-non-portable NaCl:
-
-* By its nature, PNaCl does not support architecture-specific
- instructions in an application (i.e., inline assembly), but tries to
- offer high-performance portable equivalents. One such example is
- PNaCl's :ref:`Portable SIMD Vectors <portable_simd_vectors>`.
-* Currently PNaCl only supports static linking with the ``newlib``
- C standard library (the Native Client SDK provides a PNaCl port of
- ``newlib``). Dynamic linking and ``glibc`` are not yet supported.
- Work is under way to enable dynamic linking in future versions of PNaCl.
-* In the initial release, PNaCl does not support some GNU extensions
- like taking the address of a label for computed ``goto``, or nested
+Use NaCl if any of the following apply to your application:
+
+* Your application requires architecture-specific instructions such as, for
+ example, inline assembly. PNaCl tries to offer high-performance portable
+ equivalents. One such example is PNaCl's :ref:`Portable SIMD Vectors
+ <portable_simd_vectors>`.
+* Your application uses dynamic linking. PNaCl only supports static linking
+ with a PNaCl port of the ``newlib`` C standard library. Dynamic linking and
+ ``glibc`` are not yet supported in PNaCl. Work is under way to enable dynamic
+ linking in future versions of PNaCl.
+* Your application uses certain GNU extensions not supported by PNaCl's LLVM
+ toolchain, like taking the address of a label for computed ``goto``, or nested
functions.
diff --git a/native_client_sdk/src/doc/overview.rst b/native_client_sdk/src/doc/overview.rst
index f98a1d9ef8..c6bc993314 100644
--- a/native_client_sdk/src/doc/overview.rst
+++ b/native_client_sdk/src/doc/overview.rst
@@ -9,87 +9,104 @@ Technical Overview
:backlinks: none
:depth: 2
-Introduction
-============
-
**Native Client** (NaCl) is an open-source technology for running native
compiled code in the browser, with the goal of maintaining the portability
and safety that users expect from web applications. Native Client expands web
-programming beyond JavaScript, enabling developers to enhance their web
-applications using their preferred language. This document describes some of
-the key benefits and common use cases of Native Client.
+programming beyond JavaScript, enabling you to enhance your web applications
+using your preferred language. This document describes some of the key benefits
+and common use cases of Native Client.
Google has implemented the open-source `Native Client project
<http://www.chromium.org/nativeclient>`_ in the Chrome browser on Windows, Mac,
Linux, and Chrome OS. The :doc:`Native Client Software Development Kit (SDK)
-<sdk/download>`, itself an open-source project, lets developers create web
-applications that use NaCl and run in Chrome across multiple platforms.
+<sdk/download>`, itself an open-source project, lets you create web applications
+that use NaCl and run in Chrome across multiple platforms.
+
+A Native Client web application consists of JavaScript, HTML, CSS, and a NaCl
+module written in a language supported by the SDK. The NaCl SDK currently
+supports C and C++; as compilers for additional languages are developed, the SDK
+will be updated.
+
+.. figure:: /images/web-app-with-nacl.png
+ :alt: A web application with and without Native Client
+
+ A web application with and without Native Client
-A web application that uses Native Client generally consists of a combination of
-JavaScript, HTML, CSS, and a NaCl module that is written in a language supported
-by the SDK. The NaCl SDK currently supports C and C++; as compilers for
-additional languages are developed, the SDK will be updated to support those
-languages as well.
+Native Client comes in two flavors: traditional (NaCl) and portable (PNaCl).
+Traditional, which must be distributed through the Chrome Web Store lets you
+target a specific hardware platform. Portable can run on the open web. A
+bitcode file that can be loaded from any web server is downloaded to a client
+machine and converted to hardware-specific code before any execution. For
+details, see :doc:`NaCl and PNaCl </nacl-and-pnacl>`.
-.. image:: /images/web-app-with-nacl.png
+.. _why-use-native-client:
Why use Native Client?
======================
Native Client open-source technology is designed to run compiled code
-securely inside a browser at near-native speeds. Native Client puts web
-applications on the same playing field as traditional (locally-run)
-software---it provides the means to fully harness the client's computational
-resources for applications such as 3D games, multimedia editors, CAD modeling,
-client-side data analytics, and interactive simulations.
-Native Client also aims to give C and C++ (and eventually other languages) the
-same level of portability and safety that JavaScript provides on the web today.
+securely inside a browser at near-native speeds. Native Client gives web
+applications some advantages of desktop software. Specifically, it provides the
+means to fully harness the client's computational resources for applications
+such as:
-Here are a few of the key benefits that Native Client offers:
+- 3D games
+- multimedia editors
+- CAD modeling
+- client-side data analytics
+- interactive simulations.
-* **Graphics, audio, and much more:** Run native code modules that render 2D
- and 3D graphics, play audio, respond to mouse and keyboard events, run on
- multiple threads, and access memory directly---all without requiring
- the user to install a plugin.
-* **Portability:** Write your applications once and you'll be able to run them
- across operating systems (Windows, Linux, Mac, and Chrome OS) and CPU
- architectures (x86 and ARM).
-* **Easy migration path to the web:** Many developers and companies have years
- of work invested in existing desktop applications. Native Client makes the
- transition from the desktop to a web application significantly easier because
- it supports C and C++.
-* **Security:** Native Client uses a double sandbox model designed to protect
- the user's system from malicious or buggy applications. This model offers the
- safety of traditional web applications without sacrificing performance and
- without requiring users to install a plugin.
-* **Performance:** Native Client allows web applications to run at speeds
- comparable to desktop applications (within 5-15% of native speed).
- Native Client also allows applications to harness all available CPU cores via
- a threading API; this enables demanding applications such as console-quality
- games to run inside the browser.
+Native Client gives C and C++ (and other languages targeting it) the same level
+of portability and safety as JavaScript.
+
+.. _benefits-of-native-client:
+Benefits of Native Client
+=========================
+
+Benefits of Native Client include:
+
+* **Graphics, audio, and much more:** Running native code modules that render 2D
+ and 3D graphics, play audio, respond to mouse and keyboard events, run on
+ multiple threads, and access memory directly---all without requiring the user
+ to install a plug-in.
+* **Portability:** Writing your applications once and running them on multiple
+ operating systems (Windows, Linux, Mac, and Chrome OS) and CPU architectures
+ (x86 and ARM).
+* **Easy migration path to the web:** Leveraging years of work in existing
+ desktop applications. Native Client makes the transition from the desktop to
+ a web application significantly easier because it supports C and C++.
+* **Security:** Protecting the user's system from malicious or buggy
+ applications through Native Client's double sandbox model. This model offers
+ the safety of traditional web applications without sacrificing performance
+ and without requiring users to install a plug-in.
+* **Performance:** Running at speeds within 5% to 15% of a native desktop
+ application. Native Client also allows applications to harness all available
+ CPU cores via a threading API. This enables demanding applications such as
+ console-quality games to run inside the browser.
+
+.. _common-use-cases:
+
Common use cases
================
Typical use cases for Native Client include the following:
-* **Existing software components:** With support for C and C++, Native
- Client enables you to reuse existing software modules in
- web applications---you don't need to rewrite and debug code
- that's already proven to work well.
+* **Existing software components:** Native Client lets you repurpose existing
+ C and C++ software in web applications. You don't need to rewrite and debug
+ code that already works. It also lets your application take advantage of
+ things the browser does well such as handling user interaction and processing
+ events. You can also take advantage of the latest developments in HTML5.
* **Legacy desktop applications:** Native Client provides a smooth migration
path from desktop applications to the web. You can port and recompile existing
code for the computation engine of your application directly to Native Client,
- and need repurpose only the user interface and event handling portions to the
- new browser platform. Native Client allows you to embed existing functionality
- directly into the browser. At the same time, your application can take
- advantage of things the browser does well: handling user interaction and
- processing events, based on the latest developments in HTML5.
+ and need rebuild only the user interface and event handling portions for the
+ browser.
* **Heavy computation in enterprise applications:** Native Client can handle the
number crunching required by large-scale enterprise applications. To ensure
- protection of user data, Native Client enables you to build complex
- cryptographic algorithms directly into the browser so that unencrypted data
- never goes out over the network.
+ protection of user data, Native Client lets you run complex cryptographic
+ algorithms directly in the browser so that unencrypted data never goes out
+ over the network.
* **Multimedia applications:** Codecs for processing sounds, images, and movies
can be added to the browser in a Native Client module.
* **Games:** Native Client lets web applications run at close to native
@@ -99,43 +116,61 @@ Typical use cases for Native Client include the following:
artificial intelligence module that powers a sophisticated web game.
Native Client also enables applications to run unchanged across
many platforms.
-* **Any application that requires acceleration**: Native Client fits seamlessly
- into web applications---it's up to you to decide to what extent to use it.
+* **Any application that requires acceleration:** Native Client fits seamlessly
+ into web applications. It's up to you to decide to what extent to use it.
Use of Native Client covers the full spectrum from complete applications to
- small optimized routines that accelerate vital parts of web apps.
+ small optimized routines that accelerate vital parts of web applications.
.. _link_how_nacl_works:
How Native Client works
=======================
-Native Client is an umbrella name for a set of interrelated software components
-that work together to provide a way to develop C/C++ applications and run them
-securely on the web.
-
-At a high level, Native Client consists of:
+Native Client is an umbrella name for a set of related software components for
+developing C/C++ applications and running them securely on the web. At a high
+level, Native Client consists of:
-* **Toolchains**: collections of development tools (compilers, linkers, etc.)
- that transform C/C++ code to Native Client modules.
-* **Runtime components**: components embedded in the browser or other
- host platforms that allow execution of Native Client modules
- securely and efficiently.
+* **Toolchains:** collections of development tools (compilers, linkers, etc.)
+ that transform C/C++ code to Portable Native Client modules or Native Client
+ modules.
+* **Runtime components:** components embedded in the browser or other host
+ platforms that allow execution of Native Client modules securely and
+ efficiently.
The following diagram shows how these components interact:
-.. image:: /images/nacl-pnacl-component-diagram.png
+.. figure:: /images/nacl-pnacl-component-diagram.png
+ :alt: The Native Client toolchains and their outputs
+
+ The Native Client toolchains and their outputs
+
+.. _toolchains:
+
+Toolchains
+----------
+
+A Native Client toolchain consists of a compiler, a linker, an assembler and
+other tools that are used to convert C/C++ source code into a module that is
+loadable by a browser.
+
+The Native Client SDK provides two toolchains:
-The left side of the diagram shows how to use Portable Native Client
-(PNaCl, pronounced "pinnacle"). Developers use the PNaCl toolchain
-to produce a single, portable (**pexe**) module. At runtime, a translator
-built into the browser translates the pexe into native code for the
-relevant client architecture.
+* The left side of the diagram shows **Portable Native Client** (PNaCl,
+ pronounced "pinnacle"). An LLVM based toolchain produces a single, portable
+ (**pexe**) module. At runtime an ahead-of-time (AOT) translator, built into
+ the browser, translates the pexe into native code for the relevant client
+ architecture.
-The right side of the diagram shows how to use traditional (non-portable)
-Native Client. Developers use a nacl-gcc based toolchain to produce multiple
-architecture-dependent (**nexe**) modules, which are packaged into an
-application. At runtime, the browser decides which nexe to load based
-on the architecture of the client machine.
+* The right side of the diagram shows **(non-portable) Native Client**. A GCC
+ based toolchain produces multiple architecture-dependent (**nexe**) modules,
+ which are packaged into an application. At runtime the browser determines
+ which nexe to load based on the architecture of the client machine.
+
+The PNaCl toolchain is recommended for most applications. The NaCl-GCC
+toolchain should only be used for applications that won't be distributed on the
+open web.
+
+.. _security:
Security
--------
@@ -144,17 +179,19 @@ Since Native Client permits the execution of native code on client machines,
special security measures have to be implemented:
* The NaCl sandbox ensures that code accesses system resources only through
- safe, whitelisted APIs, and operates within its limits without attempting to
+ safe, whitelisted APIs, and operates within its limits without attempting to
interfere with other code running either within the browser or outside it.
-* The NaCl validator statically analyzes code prior to running it
- to make sure it only uses code and data patterns that are permitted and safe.
+* The NaCl validator statically analyzes code before running it to make sure it
+ only uses code and data patterns that are permitted and safe.
-The above security measures are in addition to the existing sandbox in the
-Chrome browser---the Native Client module always executes in a process with
+These security measures are in addition to the existing sandbox in the
+Chrome browser. The Native Client module always executes in a process with
restricted permissions. The only interaction between this process and the
-outside world is through sanctioned browser interfaces. Because of the
+outside world is through defined browser interfaces. Because of the
combination of the NaCl sandbox and the Chrome sandbox, we say that
-Native Client employs a double sandbox design.
+Native Client employs a **double sandbox** design.
+
+.. _portability:
Portability
-----------
@@ -167,76 +204,67 @@ applications<link_nacl_in_web_apps>`.
The PNaCl translator is a component embedded in the Chrome browser; its task is
to run pexe modules. Internally, the translator compiles a pexe to a nexe
-(a native executable for the client platform's architecture), and then executes
-the nexe within the Native Client sandbox as described above. It also uses
-intelligent caching to avoid re-compiling the pexe if it was previously compiled
-on the client's browser.
+(described above), and then executes the nexe within the Native Client sandbox
+as described above. The translator uses intelligent caching to avoid
+re-compiling the pexe if it was previously compiled on the client's browser.
Native Client also supports the execution of nexe modules directly in the
-browser. However, since nexes contain architecture-specific machine code,
-they are not allowed to be distributed on the open web---they can only be
-used as part of applications and extensions that are installed from the
-Chrome Web Store.
+browser. However, since nexes contain architecture-specific machine code, they
+are not allowed to be distributed on the open web. They can only be used as part
+of applications and extensions that are installed from the Chrome Web Store.
For more details on the difference between NaCl and PNaCl, see
:doc:`NaCl and PNaCl <nacl-and-pnacl>`.
-.. _toolchains:
-
-Toolchains
-----------
-
-A toolchain is a set of tools used to create an application from a set of
-source files. In the case of Native Client, a toolchain consists of a compiler,
-linker, assembler and other tools that are used to convert an
-application written in C/C++ into a module that is loadable by the browser.
-
-The Native Client SDK provides two toolchains:
-
-* a **PNaCl toolchain** for generating portable NaCl modules (pexe files)
-* a **gcc-based toolchain (nacl-gcc)** for generating non-portable NaCl modules
- (nexe files)
-
-The PNaCl toolchain is recommended for most applications. The nacl-gcc
-toolchain should only be used for applications that will not be distributed
-on the open web.
-
.. _link_nacl_in_web_apps:
-Native Client in a web application
-==================================
+Structure of a web application
+==============================
.. _application_files:
A Native Client application consists of a set of files:
-* **HTML**, **CSS**, and **JavaScript** files, as in any modern web
- application. The JavaScript code is responsible for communicating with the
- NaCl module.
-* A **pexe** (portable NaCl) file. This module uses the :ref:`Pepper
- <link_pepper>` API, which provides the bridge to JavaScript and
- browser resources.
-* A Native Client **manifest** file that specifies the pexe to load, along with
- some loading options. This manifest file is embedded into the HTML page
- through an ``<embed>`` tag, as shown in the figure below.
-
-.. image:: /images/nacl-in-a-web-app.png
+* **HTML and CSS:** The HTML file tells the browser where to find the manifest
+ (nmf file) through the embed tag.
+
+ .. naclcode::
+
+ <embed name="mygame" src="mygame.nmf" type="application/x-pnacl" />
+
+* **Manifest:** The manifest identifies the module to load and specifies
+ options. For example, "mygame.nmf" might look like this:
+
+ .. naclcode::
+
+ {...
+ ...
+ "url": "mygame.pexe",
+ }
+
+* **pexe (portable NaCl file):** A compiled Native Client module. It uses the
+ :ref:`Pepper API <link_pepper>`, which provides a bridge to JavaScript and
+ other browser resources.
+
+.. figure:: /images/nacl-in-a-web-app.png
+ :alt: Structure of a web application
+
+ Structure of a web application
For more details, see :doc:`Application Structure
<devguide/coding/application-structure>`.
.. _link_pepper:
-Pepper Plugin API
------------------
+Pepper plug-in API
+------------------
-The Pepper Plugin API (PPAPI), called **Pepper** for convenience, is an
-open-source, cross-platform C/C++ API for web browser plugins. From the point
-of view of Native Client, Pepper allows a C/C++ module to communicate with
-the hosting browser and get access to system-level functions in a safe and
-portable way. One of the security constraints in Native Client is that modules
-cannot make any OS-level calls directly. Pepper provides analogous APIs that
-modules can target instead.
+The Pepper plug-in API (PPAPI), called **Pepper** for convenience, is an
+open-source, cross-platform C/C++ API for web browser plug-ins. Pepper allows a
+C/C++ module to communicate with the hosting browser and to access system-level
+functions in a safe and portable way. One of the security constraints in Native
+Client is that modules cannot make OS-level calls. Pepper provides analogous
+APIs that modules can use instead.
You can use the Pepper APIs to gain access to the full array of browser
capabilities, including:
@@ -247,26 +275,14 @@ capabilities, including:
* :doc:`Playing audio <devguide/coding/audio>`.
* :doc:`Rendering 3D graphics <devguide/coding/3D-graphics>`.
-Pepper includes both a C API and a C++ API. The C++ API is a set of bindings
-written on top of the C API. For additional information about Pepper, see
-`Pepper Concepts <http://code.google.com/p/ppapi/wiki/Concepts>`_.
-
-Versioning
-==========
-
-Chrome is released on a six week cycle, and developer versions of Chrome are
-pushed to the public beta channel three weeks before each release. As with any
-software, each release of Chrome may include changes to Native Client and the
-Pepper interfaces that may require modification to existing applications.
-However, modules compiled for one version of Pepper/Chrome should work with
-subsequent versions of Pepper/Chrome. The SDK includes multiple versions of the
-Pepper APIs to help developers make adjustments to API changes and take
-advantage of new features: `stable </native-client/pepper_stable>`_, `beta
-</native-client/pepper_beta>`_ and `dev </native-client/pepper_dev>`_.
+Pepper includes both a :doc:`C API </c-api>` and a :doc:`C++ API </cpp-api>`.
+The C++ API is a set of bindings written on top of the C API. For additional
+information about Pepper, see `Pepper Concepts
+<http://code.google.com/p/ppapi/wiki/Concepts>`_.
Where to start
==============
The :doc:`Quick Start <quick-start>` document provides links to downloads and
-documentation that should help you get started with developing and distributing
-Native Client applications.
+documentation to help you get started with developing and distributing Native
+Client applications.
diff --git a/native_client_sdk/src/doc/sdk/download.rst b/native_client_sdk/src/doc/sdk/download.rst
index 73fa43dcfd..a52ea509a4 100644
--- a/native_client_sdk/src/doc/sdk/download.rst
+++ b/native_client_sdk/src/doc/sdk/download.rst
@@ -3,112 +3,128 @@
Download the Native Client SDK
==============================
-To build Native Client modules, you must download and install the Native
-Client Software Development Kit (SDK). This page provides an overview
-of the Native Client SDK, and instructions for how to download and
-install the SDK.
+This page provides an overview of the Native Client SDK, and instructions for
+downloading and installing the SDK.
+
+.. raw:: html
+
+ <div id="home">
+ <a class="button-nacl button-download" href="http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip">Download SDK Zip File</a>
+ </div>
+
+.. _sdk-overview:
Overview
--------
-The Native Client SDK includes the following:
-
-support for multiple Pepper versions
- The SDK contains **bundles** that let you compile Native Client modules
- using different versions of the
- :ref:`link_pepper` (e.g., Pepper 31 or Pepper Canary). Review the
- :doc:`Release Notes <release-notes>` for a description of the new features
- included in each Pepper version to help you decide which bundle to
- use to develop your application. In general, Native Client modules
- compiled using a particular Pepper version will work in
- corresponding versions of Chrome and higher. For example, a module
- compiled using the Pepper 31 bundle will work in Chrome 31 and
- higher.
-
-update utility
- The ``naclsdk`` utility (``naclsdk.bat`` on Windows) lets you download new
- bundles that are available, as well as new versions of existing bundles.
-
-toolchains
- Each platform includes three toolchains: one for compiling
- Portable Native Client (PNaCl) applications, one for compiling
- architecture-specific Native Client applications with newlib, and
- one for compiling architecture-specific Native Client applications with glibc.
- Newlib and glibc are two different implementations
- of the C standard library. All three toolchains contain
- Native Client-compatible versions of standard compilers, linkers,
- and other tools. See :doc:`NaCl and PNaCl </nacl-and-pnacl>` to help
- you choose the right toolchain.
-
-examples
- Each example in the SDK includes C or C++ source files and header files
- illustrating how to use NaCl and Pepper, along with a Makefile to build
- the example using each of the toolchains.
-
-tools
- The SDK includes a number of additional tools that you can use for
- tasks such as validating Native Client modules and running modules
- from the command line.
+The Native Client SDK includes:
+
+- **Support for multiple Pepper versions** to compile for specific minimum
+ versions of Chrome.
+- **Update utility** to download new bundles and updates to existing bundles.
+- **Toolchains** to compile for Portable Native Client (PNaCl), traditional
+ Native Client (NaCl), and for compiling architecture-specific Native Client
+ applications with glibc.
+- **Examples** Including C or C++ source files and header files illustrating
+ how to use NaCl and Pepper, and Makefiles to build the example with each of
+ the toolchains.
+- **Tools** for validating Native Client modules and running modules from the
+ command line.
Follow the steps below to download and install the Native Client SDK.
+.. _prerequisites:
+
Prerequisites
-------------
-* **Python:** Make sure you have Python 2.6 or 2.7 installed, and that the
- Python executable is in your path.
-
- * On Mac/Linux, Python is likely preinstalled. Run the command ``"python
- -V``" in a terminal window, and make sure that the version of Python you
- have is 2.6.x or 2.7.x (if it's not, upgrade to one of those versions).
- * On Windows, you may need to install Python. Go to
- `http://www.python.org/download/ <http://www.python.org/download/>`_ and
- select the latest 2.x version. In addition, be sure to add the Python
- directory (for example, ``C:\python27``) to the PATH `environment
- variable <http://en.wikipedia.org/wiki/Environment_variable>`_. After
- you've installed Python, run the command ``"python -V``" in a Command
- Prompt window and verify that the version of Python you have is 2.6.x or
- 2.7.x.
- * Note that Python 3.x is not yet supported.
-
-* **Make:** On the Mac, you need to install the ``make`` command on your system
- before you can build and run the examples in the SDK. One easy way to get
- ``make``, along with several other useful tools, is to install
- `Xcode Developer Tools <https://developer.apple.com/technologies/tools/>`_.
- After installing Xcode, go to the Preferences menu, select
- Downloads and Components, and verify that Command Line Tools are installed.
- If you'd rather not install Xcode, you can download and build an
- `open source version
- <http://mac.softpedia.com/dyn-postdownload.php?p=44632&t=4&i=1>`_ of
- ``make``. In order to build the command you may also need to download and
- install a copy of `gcc <https://github.com/kennethreitz/osx-gcc-installer>`_.
-
-Download and install the SDK
-----------------------------
-
-#. Download the SDK update utility: `nacl_sdk.zip
+.. _python26-27:
+
+Python 2.7
+^^^^^^^^^^^^^^^^^
+
+Make sure that the Python executable is in your ``PATH`` variable. Python 3.x is
+not yet supported.
+
+* On Mac and Linux, Python is likely preinstalled. Run the command ``python -V``
+ in a terminal window, and make sure that the version you have is 2.6.x or
+ 2.7.x.
+* On Windows, you may need to install Python. Go to `http://www.python.org/
+ download/ <http://www.python.org/download/>`_ and select the latest 2.x
+ version. In addition, be sure to add the Python directory (for example,
+ ``C:\python27``) to the ``PATH`` `environment variable <http://en.wikipedia.
+ org/wiki/Environment_variable>`_. Run ``python -V`` from a command line to
+ verify that you properly configured the PATH variable.
+
+.. _make:
+
+Make
+^^^^
+
+* On the Mac, you need to install ``make`` on your system before you can build
+ and run the examples in the SDK. One easy way to get ``make``, along with
+ several other useful tools, is to install `Xcode Developer Tools
+ <https://developer.apple.com/technologies/tools/>`_. After installing Xcode,
+ go to the XCode menu, open the Preferences dialog box then select Downloads
+ and Components. Verify that Command Line Tools are installed. If you'd rather
+ not install Xcode, you can download and build an `open source version
+ <http://mac.softpedia.com/dyn-postdownload.php?p=44632&t=4&i=1>`_ of ``make``.
+ To build the program you may also need to download and install `gcc
+ <https://github.com/kennethreitz/osx-gcc-installer>`_.
+* On Windows, the Native Client SDK includes a copy of GNU Make.
+
+.. _versioning:
+
+Versioning
+----------
+
+Chrome is released on a six week cycle, and developer versions of Chrome are
+pushed to the public beta channel three weeks before each release. As with any
+software, each release of Chrome may include changes to Native Client and the
+Pepper interfaces that may require modification to existing applications.
+However, modules compiled for one version of Pepper/Chrome should work with
+subsequent versions of Pepper/Chrome. The SDK includes multiple versions of the
+Pepper APIs to help developers make adjustments to API changes and take
+advantage of new features: `stable </native-client/pepper_stable>`_, `beta
+</native-client/pepper_beta>`_ and `dev </native-client/pepper_dev>`_.
+
+.. _installing-the-sdk:
+
+Installing the SDK
+------------------
+
+.. _downloading-and-unzipping:
+
+Downloading and Unzipping
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+#. Download the `SDK update zip file
<http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip>`_.
-#. Unzip the SDK update utility:
+#. Unzip the file:
- * On Mac/Linux, run the command "``unzip nacl_sdk.zip``" in a terminal
+ * On Mac/Linux, run the command ``unzip nacl_sdk.zip`` in a terminal
window.
* On Windows, right-click on the .zip file and select "Extract All...". A
- dialog box will open; enter a location and click "Extract".
+ dialog box opens; enter a location and click "Extract".
- Unzipping the SDK update utility creates a directory called ``nacl_sdk`` with
- the following files and directories:
+ A directory is created called ``nacl_sdk`` with the following files and
+ directories:
- * ``naclsdk`` (and ``naclsdk.bat`` for Windows) --- the front end of the update
- utility, i.e., the command you run to download the latest bundles
+ * ``naclsdk`` (and ``naclsdk.bat`` for Windows) --- the update utility,
+ which is the command you run to download and update bundles.
* ``sdk_cache`` --- a directory with a manifest file that lists the bundles
- you have already downloaded
- * ``sdk_tools`` --- the back end of the update utility, also known as the
- "sdk_tools" bundle
+ you have already downloaded.
+ * ``sdk_tools`` --- the code run by the ``naclsdk`` command.
+
+.. _installing-the-stable-bundle:
-#. To see the SDK bundles that are available for download, go to the ``nacl_sdk``
- directory and run ``naclsdk`` with the ``"list"`` command.
- The SDK includes a separate bundle for each version of Chrome/Pepper.
+Installing the stable bundle
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+#. To see the SDK bundles that are available for download, go to the
+ ``nacl_sdk`` directory and run ``naclsdk`` with the ``list`` command. The SDK
+ includes a separate bundle for each version of Chrome/Pepper.
On Mac/Linux::
@@ -128,28 +144,32 @@ Download and install the SDK
I sdk_tools (stable)
vs_addin (dev)
- pepper_27 (post_stable)
- pepper_28 (post_stable)
- pepper_29 (post_stable)
- pepper_30 (post_stable)
- pepper_31 (stable)
- pepper_32 (beta)
+ pepper_31 (post_stable)
+ pepper_32 (post_stable)
+ pepper_33 (post_stable)
+ pepper_34 (post_stable)
+ pepper_35 (stable)
+ pepper_36 (beta)
+ pepper_37 (dev)
pepper_canary (canary)
+ bionic_canary (canary)
+
- The sample output above shows that there are a number of bundles available
- for download, and that you have already installed the latest revision of the
- ``sdk_tools`` bundle (it was included in the zip file you downloaded).
- Each bundle is labeled post-stable, stable, beta, dev, or canary.
- These labels usually correspond to the current versions of
- Chrome. (In the example above, Chrome 31 is stable, Chrome 32 is beta, etc.).
- We generally recommend that you download and use a "stable" bundle,
- as applications developed with "stable" bundles can be used by all current
- Chrome users. This is because Native Client is designed to be
- backward-compatible (for example, applications developed with the
- ``pepper_31`` bundle can run in Chrome 31, Chrome 32, etc.).
- Thus in the example above, ``pepper_31`` is the recommended bundle to use.
-
-#. Run ``naclsdk`` with the "update" command to download recommended bundles.
+ The sample output above shows that several bundles are available for
+ download, and that you have already installed the latest revision of the
+ ``sdk_tools`` bundle, which was included in the zip file. You never need to
+ update the ``sdk_tools`` bundle. It is updated automatically (if necessary)
+ whenever you run ``naclsdk``.
+
+ Bundles are labeled post-stable, stable, beta, dev, or canary. These labels
+ usually correspond to the current versions of Chrome. We recommend that you
+ develop against a "stable" bundle, because such bundles can be used by all
+ current Chrome users. Native Client is designed to be backward-compatible.For
+ example, applications developed with the ``pepper_31`` bundle can run in
+ Chrome 31, Chrome 32, etc..
+
+#. Run ``naclsdk`` with the ``update`` command to download recommended bundles,
+ including the current "stable" bundle.
On Mac/Linux::
@@ -159,27 +179,22 @@ Download and install the SDK
> naclsdk update
- By default, ``naclsdk`` only downloads bundles that are
- recommended---generally those that are "stable." Continuing with the earlier example, the
- "update" command would only download the ``pepper_31``
- bundle, since the bundles ``pepper_32`` and greater are not yet stable.
- If you want the ``pepper_32`` bundle, you must ask for it explicitly::
-
- $ ./naclsdk update pepper_32
+ By default, ``naclsdk`` only downloads bundles that are recommended,
+ generally those that are "stable." For example, if the current "stable"
+ bundle is ``pepper_35``, then the ``update`` downloads that bundle. To
+ download the ``pepper_36`` bundle you must ask for it explicitly::
- Note that you never need to update the ``sdk_tools`` bundle---it is
- updated automatically (if necessary) whenever you run ``naclsdk``.
+ $ ./naclsdk update pepper_36
+
+
-.. Note::
- :class: note
+.. _updating-bundles:
- The minimum SDK bundle that supports PNaCl is ``pepper_31``.
+Updating bundles
+----------------
-Staying up-to-date and getting new versions of bundles
-------------------------------------------------------
-
-#. Run ``naclsdk`` with the "list" command again; this will show you the list of
- available bundles and verify which bundles you have installed.
+#. Run ``naclsdk`` with the ``list`` command. This shows you the list of available
+ bundles and verifies which bundles you have installed.
On Mac/Linux::
@@ -188,9 +203,9 @@ Staying up-to-date and getting new versions of bundles
On Windows::
> naclsdk list
-
- Continuing with the earlier example, if you previously downloaded the
- ``pepper_31`` bundle, you should see output similar to this::
+
+ An asterisk (*) next to a bundle indicates that there is an update available
+ it. For example::
Bundles:
I: installed
@@ -198,57 +213,25 @@ Staying up-to-date and getting new versions of bundles
I sdk_tools (stable)
vs_addin (dev)
- pepper_27 (post_stable)
- pepper_28 (post_stable)
- pepper_29 (post_stable)
- pepper_30 (post_stable)
- I pepper_31 (stable)
- pepper_32 (beta)
+ pepper_31 (post_stable)
+ pepper_32 (post_stable)
+ pepper_33 (post_stable)
+ pepper_34 (post_stable)
+ I* pepper_35 (stable)
+ pepper_36 (beta)
+ pepper_37 (dev)
pepper_canary (canary)
+ bionic_canary (canary)
-#. Running ``naclsdk`` with the "update" command again will verify that your
- bundles are up-to-date, or warn if you there are new versions of previously
- installed bundles.
-
- On Mac/Linux::
-
- $ ./naclsdk update
+
+ If you run ``naclsdk update`` now, it warns you with a message similar to
+ this::
- On Windows::
+ WARNING: pepper_35 already exists, but has an update available. Run update
+ with the --force option to overwrite the existing directory. Warning: This
+ will overwrite any modifications you have made within this directory.
- > naclsdk update
-
- Continuing with the earlier example, you should see output similar to this::
-
- pepper_31 is already up-to-date.
-
-#. To check if there is a new version of a previously installed bundle, you can
- run the "list" command again::
-
- Bundles:
- I: installed
- *: update available
-
- I sdk_tools (stable)
- vs_addin (dev)
- pepper_27 (post_stable)
- pepper_28 (post_stable)
- pepper_29 (post_stable)
- pepper_30 (post_stable)
- I* pepper_31 (stable)
- pepper_32 (beta)
- pepper_canary (canary)
-
- An asterisk next to a bundle indicates that there is an update
- available for that bundle. If you run the "update" command now,
- ``naclsdk`` will warn you with a message similar to this::
-
- WARNING: pepper_31 already exists, but has an update available.
- Run update with the --force option to overwrite the existing directory.
- Warning: This will overwrite any modifications you have made within this directory.
-
- To dowload the new version of a bundle and overwrite the existing directory
- for that bundle, run ``naclsdk`` with the ``--force`` option.
+#. To download and install the new bundle, run:
On Mac/Linux::
@@ -258,6 +241,11 @@ Staying up-to-date and getting new versions of bundles
> naclsdk update --force
+.. _help-with-the-naclsdk-utility:
+
+Help with the ``naclsdk`` utility
+---------------------------------
+
#. For more information about the ``naclsdk`` utility, run:
On Mac/Linux::
@@ -268,12 +256,15 @@ Staying up-to-date and getting new versions of bundles
> naclsdk help
-Next steps:
+.. _next-steps:
+
+Next steps
+----------
-* Browse through the :doc:`Release Notes <release-notes>` for important
+* Browse the `Release Notes <release-notes>`_ for important
information about the SDK and new bundles.
-* If you're just getting started with Native Client, we recommend reading
- the :doc:`Technical Overview <../overview>` and walking through the
- :doc:`Getting Started Tutorial </devguide/tutorial/tutorial-part1>`.
-* If you'd rather dive into information about the toolchains, see
- :doc:`Building Native Client Modules </devguide/devcycle/building>`.
+* If you're just starting with Native Client, we recommend reading the
+ `Technical Overview <../overview>`_ and walking through the
+ `Getting Started Tutorial <devguide/tutorial/tutorial-part1>`_.
+* If you'd rather dive in, see
+ `Building Native Client Modules <devguide/devcycle/building>`_.
diff --git a/native_client_sdk/src/doc/sdk/examples.rst b/native_client_sdk/src/doc/sdk/examples.rst
index 211c63a4b3..a59928a6eb 100644
--- a/native_client_sdk/src/doc/sdk/examples.rst
+++ b/native_client_sdk/src/doc/sdk/examples.rst
@@ -1,147 +1,134 @@
.. _sdk-examples-2:
-Running the SDK Examples
-========================
+.. TODO: After default toolchain is changed to pnacl, recreate the make examples.
+
+Examples
+========
Every Native Client SDK bundle comes with a folder of example applications.
Each example demonstrates one or two key Native Client programming concepts.
After you've :doc:`downloaded the SDK <download>`, follow the instructions
on this page to build and run the examples.
-Configure the Google Chrome Browser
------------------------------------
-
-#. Your version of Chrome must be equal to or greater than the version of
- your SDK bundle. For example, if you're developing with the ``pepper_31``
- bundle, you must use Google Chrome version 31 or greater. To find out what
- version of Chrome you're using, type ``about:chrome`` or ``about:version``
- in the Chrome address bar.
-
-#. For Portable Native Client, no extra Chrome flags are needed as of
- Chrome version 31.
-
- For other Native Client applications, or to **debug** Portable Native
- Client applications by translating the **pexe** to a **nexe** ahead of
- time, enable the Native Client flag. Native Client is enabled by default
- only for applications distributed through the Chrome Web Store. To run
- Native Client applications that are not distributed through the Chrome
- Web Store, like the SDK examples, you must specifically enable the Native
- Client flag in Chrome:
-
- * Type ``about:flags`` in the Chrome address bar and scroll down to
- "Native Client".
- * If the link below "Native Client" says "Disable", then Native Client is
+Your version of Chrome must be equal to or greater than the version of your SDK
+bundle. For example, if you're developing with the ``pepper_35`` bundle, you
+must use Google Chrome version 35 or greater. To find out what version of Chrome
+you're using, type ``about:chrome`` or ``about:version`` in the Chrome address
+bar.
+
+.. _enable-native-client:
+
+Enable Native Client
+--------------------
+
+If you are using Chrome 31 or later, you can skip this section. To run Portable
+Native Client applications you must specifically enable Native Client in Chrome:
+
+#. Type ``about:flags`` in the Chrome address bar and scroll down to "Native
+ Client".
+
+ - If the link below "Native Client" says "Disable", then Native Client is
already enabled and you don't need to do anything else.
+
* If the link below "Native Client" says "Enable", click the "Enable"
- link, scroll down to the bottom of the page, and click the "Relaunch
- Now" button. All browser windows will restart when you relaunch Chrome.
-
-#. Disable the Chrome cache. Chrome caches resources aggressively; when you
- are building a Native Client application you should disable the cache to
- make sure that Chrome loads the latest version:
+ link.
+
+#. Scroll down to the bottom of the page, and click "Relaunch Now". All browser
+ windows will restart when you relaunch Chrome.
- * Open Chrome's developer tools by clicking the menu icon |menu-icon| and
- choosing Tools > Developer tools.
- * Click the gear icon |gear-icon| in the bottom right corner of the
- Chrome window.
- * Under the "General" settings, check the box next to "Disable cache".
+.. _build-the-sdk-examples:
Build the SDK examples
----------------------
-Starting with the ``pepper_24`` bundle, the Makefile scripts for the SDK
-examples build multiple versions of the examples using all three SDK
-toolchains (newlib, glibc, and PNaCl) and in both release and debug
-configurations. (Note that some examples build only with the particular
-toolchains).
+The Makefile scripts for the SDK examples can build multiple versions of the
+examples using any of the three SDK toolchains (newlib, glibc, and PNaCl) and in
+both release and debug configurations. Note that some examples, ``dlopen`` for
+example, build only with particular toolchains.
-To build all the examples, go to the examples directory in a specific SDK
-bundle and run ``make``::
+Find the toolchains for each example by looking at the ``VALID_TOOLCHAINS``
+variable in the Makefile for a particular example. The first item listed is the
+default. It's built when you run an example make file without parameters. for
+example running make in the ``core`` directory of pepper_35 builds the example
+using the ``newlib`` toolchain. ::
- $ cd pepper_31/examples
+ $ cd pepper_35/examples/api/core
$ make
- make -C api all
- make[1]: Entering directory `pepper_31/examples/api'
- make -C audio all
- make[2]: Entering directory `pepper_31/examples/api/audio'
- CXX newlib/Debug/audio_x86_32.o
- LINK newlib/Debug/audio_x86_32.nexe
- CXX newlib/Debug/audio_x86_64.o
- LINK newlib/Debug/audio_x86_64.nexe
- CXX newlib/Debug/audio_arm.o
- LINK newlib/Debug/audio_arm.nexe
- CREATE_NMF newlib/Debug/audio.nmf
- make[2]: Leaving directory `pepper_31/examples/api/audio'
- make -C url_loader all
- make[2]: Entering directory `pepper_31/examples/api/url_loader'
- CXX newlib/Debug/url_loader_x86_32.o
- ...
-
-Calling ``make`` from inside a particular example's directory will build only
-that example::
-
- $ cd pepper_31/examples/api/core
- $ make
- CXX newlib/Debug/core_x86_32.o
- LINK newlib/Debug/core_x86_32.nexe
- CXX newlib/Debug/core_x86_64.o
- LINK newlib/Debug/core_x86_64.nexe
- CXX newlib/Debug/core_arm.o
- LINK newlib/Debug/core_arm.nexe
- CREATE_NMF newlib/Debug/core.nmf
-
-You can call ``make`` with the ``TOOLCHAIN`` and ``CONFIG`` parameters to
-override the defaults::
-
+ CXX newlib/Release/core_x86_32.o
+ LINK newlib/Release/core_unstripped_x86_32.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_32.nexe
+ CXX newlib/Release/core_x86_64.o
+ LINK newlib/Release/core_unstripped_x86_64.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_64.nexe
+ CXX newlib/Release/core_arm.o
+ LINK newlib/Release/core_unstripped_arm.nexe
+ VALIDATE newlib/Release/core_unstripped_arm.nexe
+ STRIP newlib/Release/core_x86_32.nexe
+ STRIP newlib/Release/core_x86_64.nexe
+ STRIP newlib/Release/core_arm.nexe
+ CREATE_NMF newlib/Release/core.nmf
+
+As you can see, this produces a number of architecture specific nexe files in
+the ``pepper_35/examples/api/core/Release`` directory. Create debug versions by
+using the ``CONFIG`` parameter of the make command. ::
+
+ $make CONFIG=Debug
+
+This creates similar output, but in ``pepper_35/examples/api/core/Debug``.
+
+Select a different toolchain with the ``TOOLCHAIN`` parameter. For example::
+
+ $ cd pepper_35/examples/api/core
$ make TOOLCHAIN=pnacl CONFIG=Release
- CXX pnacl/Release/core_pnacl.o
- LINK pnacl/Release/core.bc
- FINALIZE pnacl/Release/core.pexe
+ CXX pnacl/Release/core.o
+ LINK pnacl/Release/core_unstripped.bc
+ FINALIZE pnacl/Release/core_unstripped.pexe
CREATE_NMF pnacl/Release/core.nmf
+You can also set ``TOOLCHAIN`` to ``all`` to build all Release versions with
+default toolchains. ::
-You can also set ``TOOLCHAIN`` to "all" to build one or more examples with
-all available toolchains::
-
+ $ cd pepper_35/examples/api/core
$ make TOOLCHAIN=all
- make TOOLCHAIN=newlib
- make[1]: Entering directory `pepper_31/examples/api/core'
- CXX newlib/Debug/core_x86_32.o
- LINK newlib/Debug/core_x86_32.nexe
- CXX newlib/Debug/core_x86_64.o
- LINK newlib/Debug/core_x86_64.nexe
- CXX newlib/Debug/core_arm.o
- LINK newlib/Debug/core_arm.nexe
- CREATE_NMF newlib/Debug/core.nmf
- make[1]: Leaving directory `pepper_31/examples/api/core'
- make TOOLCHAIN=glibc
- make[1]: Entering directory `pepper_31/examples/api/core'
- CXX glibc/Debug/core_x86_32.o
- LINK glibc/Debug/core_x86_32.nexe
- CXX glibc/Debug/core_x86_64.o
- LINK glibc/Debug/core_x86_64.nexe
- CREATE_NMF glibc/Debug/core.nmf
- make[1]: Leaving directory `pepper_31/examples/api/core'
- make TOOLCHAIN=pnacl
- make[1]: Entering directory `pepper_31/examples/api/core'
- CXX pnacl/Debug/core.o
- LINK pnacl/Debug/core_unstripped.bc
- FINALIZE pnacl/Debug/core_unstripped.pexe
- CREATE_NMF pnacl/Debug/core.nmf
- make[1]: Leaving directory `pepper_31/examples/api/core'
- make TOOLCHAIN=linux
- make[1]: Entering directory `pepper_31/examples/api/core'
- CXX linux/Debug/core.o
- LINK linux/Debug/core.so
- make[1]: Leaving directory `pepper_31/examples/api/core'
-
-
-After running ``make``, each example directory will contain one or more of
-the following subdirectories:
-
-* a ``newlib`` directory with subdirectories ``Debug`` and ``Release``;
-* a ``glibc`` directory with subdirectories ``Debug`` and ``Release``;
-* a ``pnacl`` directory with subdirectories ``Debug`` and ``Release``;
+ make TOOLCHAIN=newlib
+ make[1]: Entering directory 'pepper_35/examples/api/core'
+ CXX newlib/Release/core_x86_32.o
+ LINK newlib/Release/core_unstripped_x86_32.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_32.nexe
+ CXX newlib/Release/core_x86_64.o
+ LINK newlib/Release/core_unstripped_x86_64.nexe
+ VALIDATE newlib/Release/core_unstripped_x86_64.nexe
+ CXX newlib/Release/core_arm.o
+ LINK newlib/Release/core_unstripped_arm.nexe
+ VALIDATE newlib/Release/core_unstripped_arm.nexe
+ STRIP newlib/Release/core_x86_32.nexe
+ STRIP newlib/Release/core_x86_64.nexe
+ STRIP newlib/Release/core_arm.nexe
+ CREATE_NMF newlib/Release/core.nmf
+ make[1]: Leaving directory 'pepper_35/examples/api/core'
+ make TOOLCHAIN=glibc
+ make[1]: Entering directory 'pepper_35/examples/api/core'
+ CXX glibc/Release/core_x86_32.o
+ LINK glibc/Release/core_unstripped_x86_32.nexe
+ VALIDATE glibc/Release/core_unstripped_x86_32.nexe
+ CXX glibc/Release/core_x86_64.o
+ LINK glibc/Release/core_unstripped_x86_64.nexe
+ VALIDATE glibc/Release/core_unstripped_x86_64.nexe
+ ...
+ (content excerpted)
+ ...
+
+.. _build-results:
+
+Build results
+^^^^^^^^^^^^^
+
+After running ``make``, example directories will contain one or more of the
+following subdirectories, depending on which Makefile you run:
+
+* ``newlib`` with subdirectories ``Debug`` and ``Release``;
+* ``glibc`` with subdirectories ``Debug`` and ``Release``;
+* ``pnacl`` with subdirectories ``Debug`` and ``Release``;
For the newlib and glibc toolchains the Debug and Release subdirectories
contain .nexe files for all target architectures. For the PNaCl toolchain
@@ -161,22 +148,49 @@ use the SDK toolchain itself, see :doc:`Building Native Client Modules
Run the SDK examples
--------------------
-To run the SDK examples, you can use the ``make run`` command::
+.. _disable-chrome-cache:
+
+Disable the Chrome cache
+^^^^^^^^^^^^^^^^^^^^^^^^
- $ cd pepper_31/examples/api/core
+Chrome's intelligent caching caches resources aggressively. When building a
+Native Client application you should disable the cache to make sure that Chrome
+loads the latest version. Intelligent caching only remains inactive while
+Developer Tools are open. Otherwise, agressive caching continues.
+
+#. Open Chrome's developer tools by clicking the menu icon |menu-icon| and
+ choosing Tools > Developer tools.
+
+#. Click the gear icon |gear-icon| in the bottom right corner of the Chrome
+ window.
+
+#. Under the "General" settings, check the box next to "Disable cache".
+
+.. _run-the-examples:
+
+Run the examples
+^^^^^^^^^^^^^^^^
+
+To run the SDK examples, use the ``make run`` command::
+
+ $ cd pepper_35/examples/api/core
$ make run
-This will launch a local HTTP server which will serve the data for the
-example. It then launches Chrome with the address of this server, usually
-``http://localhost:5103``. After you close Chrome, the local HTTP server is
-automatically shutdown.
+This launches a local HTTP server that serves the example. It then launches
+Chrome with the address of this server, usually ``http://localhost:5103``.
+After you close Chrome, the local HTTP server automatically shuts down.
-This command will try to find an executable named ``google-chrome`` in your
+This command tries to find an executable named ``google-chrome`` in your
``PATH`` environment variable. If it can't, you'll get an error message like
this::
- pepper_31/tools/common.mk:415: No valid Chrome found at CHROME_PATH=
- pepper_31/tools/common.mk:415: *** Set CHROME_PATH via an environment variable, or command-line.. Stop.
+ pepper_35/tools/common.mk:415: No valid Chrome found at CHROME_PATH=
+ pepper_35/tools/common.mk:415: *** Set CHROME_PATH via an environment variable, or command-line.. Stop.
+
+.. _add-an-env-variable-for-chrome:
+
+Add an environment variable for Chrome
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set the CHROME_PATH environment variable to the location of your Chrome
executable.
@@ -187,7 +201,7 @@ executable.
``C:\Program Files (x86)\Google\Chrome\Application\chrome.exe`` for Chrome
stable and
``C:\Users\<username>\AppData\Local\Google\Chrome SxS\Application\chrome.exe``
- for Chrome Canary; try looking in those directories first::
+ for Chrome Canary. Try looking in those directories first::
> set CHROME_PATH=<Path to chrome.exe>
@@ -205,31 +219,27 @@ executable.
application bundle, not the top-level ``.app`` directory::
$ export CHROME_PATH=<Path to Google Chrome>
-
-You can run via a different toolchain or configuration by using the
-``TOOLCHAIN`` and ``CONFIG`` parameters to make::
-
- $ make run TOOLCHAIN=pnacl CONFIG=Debug
-
+
.. _run_sdk_examples_as_packaged:
Run the SDK examples as packaged apps
-------------------------------------
-Each example can also be launched as a packaged app. For more information about
-using Native Client for packaged apps, see :ref:`Packaged application
-<distributing_packaged>`. For general information about packaged apps, see the
-`Chrome apps documentation </apps/about_apps>`_.
+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
+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
+application files. Refer to `What are Chrome Apps </apps/about_apps>`_ for more
+information about creating a packaged application.
Some Pepper features, such as TCP/UDP socket access, are only allowed in
-packaged apps. The examples that use these features must be run as packaged
-apps, by using the ``make run_package`` command::
+packaged applications. The examples that use these features must be run as
+packaged applications, by using the following command::
$ make run_package
-You can use ``TOOLCHAIN`` and ``CONFIG`` parameters as above to run with a
-different toolchain or configuration.
-
+You can use ``TOOLCHAIN`` and ``CONFIG`` parameters as described above to run
+with a different toolchain or configuration.
.. _debugging_the_sdk_examples:
@@ -242,15 +252,14 @@ NaCl code. To use it, run the ``make debug`` command from an example directory::
$ make debug
-This will launch Chrome with the ``--enable-nacl-debug`` flag set. This flag
-will cause Chrome to pause when a NaCl module is first loaded, waiting for a
-connection from gdb. The ``make debug`` command also simultaneously launches
-GDB and loads the symbols for that NEXE. To connect GDB to Chrome, in the GDB
-console, type::
+This launches Chrome with the ``--enable-nacl-debug`` flag set. This flag causes
+Chrome to pause when a NaCl module is first loaded, waiting for a connection
+from gdb. The ``make debug`` command also simultaneously launches GDB and loads
+the symbols for that NEXE. To connect GDB to Chrome, in the GDB console, type::
(gdb) target remote :4014
-This tells GDB to connect to a TCP port on ``localhost:4014``--the port that
+This tells GDB to connect to a TCP port on ``localhost:4014``, the port that
Chrome is listening on. GDB will respond::
Remote debugging using :4014
@@ -258,9 +267,9 @@ Chrome is listening on. GDB will respond::
At this point, you can use the standard GDB commands to debug your NaCl module.
The most common commands you will use to debug are ``continue``, ``step``,
-``next``, ``break`` and ``backtrace``. See :doc:`Debugging
-<../devguide/devcycle/debugging>` for more information about debugging a Native Client
-application.
+``next``, ``break`` and ``backtrace``. See
+:doc:`Debugging <../devguide/devcycle/debugging>` for more information about
+debugging a Native Client application.
.. |menu-icon| image:: /images/menu-icon.png
diff --git a/native_client_sdk/src/doc/sdk/release-notes.rst b/native_client_sdk/src/doc/sdk/release-notes.rst
index 7f076aa833..5a9a147463 100644
--- a/native_client_sdk/src/doc/sdk/release-notes.rst
+++ b/native_client_sdk/src/doc/sdk/release-notes.rst
@@ -4,6 +4,16 @@
Release Notes
#############
+Chrome/Pepper 38 (15 August 2014)
+=================================
+
+PNaCl
+-----
+
+* Compilation speed improvements due to validation caching of the translator and
+ linker.
+* Performance improvement of SIMD vector shuffle.
+
Chrome/Pepper 37 (20 June 2014)
===============================
diff --git a/native_client_sdk/src/doc/sitemap.rst b/native_client_sdk/src/doc/sitemap.rst
index e00c3b3e76..3ca34a52bc 100644
--- a/native_client_sdk/src/doc/sitemap.rst
+++ b/native_client_sdk/src/doc/sitemap.rst
@@ -43,6 +43,8 @@ Contents:
community/security-contest/contest-announcement.rst
community/security-contest/contest-terms.rst
community/security-contest/contest-faq.rst
+ c-api.rst
+ cpp-api.rst
pepper_stable/c/index.rst
pepper_stable/cpp/index.rst
pepper_beta/c/index.rst
diff --git a/native_client_sdk/src/examples/api/gamepad/gamepad.cc b/native_client_sdk/src/examples/api/gamepad/gamepad.cc
index 9ab4778e08..1b6bfe9b66 100644
--- a/native_client_sdk/src/examples/api/gamepad/gamepad.cc
+++ b/native_client_sdk/src/examples/api/gamepad/gamepad.cc
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <algorithm>
#include <cassert>
#include "ppapi/c/ppb_gamepad.h"
diff --git a/native_client_sdk/src/examples/api/url_loader/url_loader_handler.cc b/native_client_sdk/src/examples/api/url_loader/url_loader_handler.cc
index 6948257a26..66363620ca 100644
--- a/native_client_sdk/src/examples/api/url_loader/url_loader_handler.cc
+++ b/native_client_sdk/src/examples/api/url_loader/url_loader_handler.cc
@@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <algorithm>
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/cpp/module.h"
diff --git a/native_client_sdk/src/examples/api/video_decode/video_decode.cc b/native_client_sdk/src/examples/api/video_decode/video_decode.cc
index 80088b9e27..9664c9b640 100644
--- a/native_client_sdk/src/examples/api/video_decode/video_decode.cc
+++ b/native_client_sdk/src/examples/api/video_decode/video_decode.cc
@@ -254,7 +254,7 @@ Decoder::Decoder(MyInstance* instance,
assert(!decoder_->is_null());
decoder_->Initialize(graphics_3d,
kBitstreamProfile,
- PP_TRUE /* allow_software_fallback */,
+ PP_HARDWAREACCELERATION_WITHFALLBACK,
callback_factory_.NewCallback(&Decoder::InitializeDone));
}
diff --git a/native_client_sdk/src/examples/tutorial/testing/testing.cc b/native_client_sdk/src/examples/tutorial/testing/testing.cc
index 57ae127b5c..b44b5a1070 100644
--- a/native_client_sdk/src/examples/tutorial/testing/testing.cc
+++ b/native_client_sdk/src/examples/tutorial/testing/testing.cc
@@ -3,24 +3,6 @@
// found in the LICENSE file.
#include "gtest/gtest.h"
-
-TEST(TestCase, SimpleTest) {
- EXPECT_EQ(4, 2*2);
-}
-
-TEST(TestCase, AnotherTest) {
- EXPECT_EQ(1, sizeof(char));
-}
-
-#if defined(SEL_LDR)
-
-int main(int argc, char* argv[]) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-#else
-
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/var.h"
#include "ppapi_simple/ps_main.h"
@@ -30,6 +12,14 @@ int main(int argc, char* argv[]) {
#undef PostMessage
#endif
+TEST(TestCase, SimpleTest) {
+ EXPECT_EQ(4, 2*2);
+}
+
+TEST(TestCase, AnotherTest) {
+ EXPECT_EQ(1, sizeof(char));
+}
+
class GTestEventListener : public ::testing::EmptyTestEventListener {
public:
// TestEventListener overrides.
@@ -59,14 +49,15 @@ class GTestEventListener : public ::testing::EmptyTestEventListener {
};
int example_main(int argc, char* argv[]) {
+ setenv("TERM", "xterm-256color", 0);
::testing::InitGoogleTest(&argc, argv);
- ::testing::UnitTest::GetInstance()->listeners()
- .Append(new GTestEventListener());
+ if (PSGetInstanceId() != 0) {
+ ::testing::UnitTest::GetInstance()->listeners()
+ .Append(new GTestEventListener());
+ }
return RUN_ALL_TESTS();
}
// Register the function to call once the Instance Object is initialized.
// see: pappi_simple/ps_main.h
PPAPI_SIMPLE_REGISTER_MAIN(example_main);
-
-#endif
diff --git a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c
index 10322d01b0..31e88fa515 100644
--- a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c
+++ b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/hello_world.c
@@ -8,10 +8,6 @@
#include "ppapi_simple/ps_main.h"
-#ifdef SEL_LDR
-#define example_main main
-#endif
-
int example_main(int argc, char* argv[]) {
/* Use ppb_messaging to send "Hello World" to JavaScript. */
printf("Hello World STDOUT.\n");
@@ -28,6 +24,4 @@ int example_main(int argc, char* argv[]) {
* This is not needed when building the sel_ldr version of this example
* which does not link against ppapi_simple.
*/
-#ifndef SEL_LDR
PPAPI_SIMPLE_REGISTER_MAIN(example_main)
-#endif
diff --git a/native_client_sdk/src/gonacl_appengine/static/frame.js b/native_client_sdk/src/gonacl_appengine/static/frame.js
index eca667e116..2564cf52ce 100644
--- a/native_client_sdk/src/gonacl_appengine/static/frame.js
+++ b/native_client_sdk/src/gonacl_appengine/static/frame.js
@@ -13,7 +13,6 @@ var examples = [
];
var exampleMap = {}; // Created below.
-var iframeEl = null;
var isChrome = /Chrome\/([^\s]+)/.test(navigator.userAgent);
var isMobile = /Mobi/.test(navigator.userAgent);
var hasPnacl = navigator.mimeTypes['application/x-pnacl'] !== undefined;
@@ -21,13 +20,13 @@ var hasPnacl = navigator.mimeTypes['application/x-pnacl'] !== undefined;
if (isChrome && !isMobile) {
if (hasPnacl) {
makeExampleList();
- window.onpopstate = function(popState) {
- if (popState.state == null) {
- updateViewFromLocation();
- } else {
- var exampleName = popState.state;
- loadExample(popState.state);
- }
+ if (history.state == null) {
+ updateViewFromLocation();
+ }
+
+ window.onpopstate = function(event) {
+ var exampleName = event.state;
+ loadExample(exampleName);
}
} else {
// Older version of Chrome?
@@ -131,20 +130,17 @@ function createHomeIframe() {
}
function createIframe(src) {
- var oldIframeEl = iframeEl;
-
- iframeEl = document.createElement('iframe');
- iframeEl.setAttribute('frameborder', '0');
- iframeEl.setAttribute('width', '100%');
- iframeEl.setAttribute('height', '100%');
- iframeEl.src = src;
- iframeEl.setAttribute('hidden', '');
- iframeEl.onload = function() {
- if (oldIframeEl)
- oldIframeEl.parentNode.removeChild(oldIframeEl);
- iframeEl.removeAttribute('hidden');
+ var iframeEl = document.querySelector('iframe');
+ if (iframeEl === null) {
+ iframeEl = document.createElement('iframe');
+ iframeEl.setAttribute('frameborder', '0');
+ iframeEl.setAttribute('width', '100%');
+ iframeEl.setAttribute('height', '100%');
+ iframeEl.src = src;
+ document.querySelector('section').appendChild(iframeEl);
+ } else {
+ iframeEl.contentDocument.location.replace(src);
}
- document.querySelector('section').appendChild(iframeEl);
}
function pushState(exampleName) {
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
index 6dd7642419..108bdd26d2 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
@@ -240,22 +240,8 @@ Error FsNode::VIoctl(int request, va_list args) {
} // namespace
-Error DevFs::Access(const Path& path, int a_mode) {
- ScopedNode node;
- int error = root_->FindChild(path.Join(), &node);
- if (error)
- return error;
-
- // Don't allow execute access.
- if (a_mode & X_OK) {
- LOG_TRACE("Executing devfs nodes is not allowed.");
- return EACCES;
- }
-
- return 0;
-}
-
-Error DevFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
+Error DevFs::OpenWithMode(const Path& path, int open_flags,
+ mode_t mode, ScopedNode* out_node) {
out_node->reset(NULL);
int error;
if (path.Part(1) == "fs") {
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.h b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.h
index a17dc85131..872f77ef9d 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.h
@@ -14,8 +14,8 @@ class Node;
class DevFs : public Filesystem {
public:
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int open_flags, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int permissions);
virtual Error Rmdir(const Path& path);
diff --git a/native_client_sdk/src/libraries/nacl_io/dir_node.cc b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
index e16c0c7d17..6cf0656d04 100644
--- a/native_client_sdk/src/libraries/nacl_io/dir_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
@@ -69,6 +69,12 @@ Error DirNode::GetDents(size_t offs,
return cache_.GetDents(offs, pdir, size, out_bytes);
}
+Error DirNode::Fchmod(mode_t mode) {
+ AUTO_LOCK(node_lock_);
+ SetMode(mode);
+ return 0;
+}
+
Error DirNode::AddChild(const std::string& name, const ScopedNode& node) {
AUTO_LOCK(node_lock_);
diff --git a/native_client_sdk/src/libraries/nacl_io/dir_node.h b/native_client_sdk/src/libraries/nacl_io/dir_node.h
index 29d271f7f6..3deaa33ddf 100644
--- a/native_client_sdk/src/libraries/nacl_io/dir_node.h
+++ b/native_client_sdk/src/libraries/nacl_io/dir_node.h
@@ -43,6 +43,7 @@ class DirNode : public Node {
const void* buf,
size_t count,
int* out_bytes);
+ virtual Error Fchmod(mode_t mode);
// Adds a finds or adds a directory entry as an INO, updating the refcount
virtual Error AddChild(const std::string& name, const ScopedNode& node);
diff --git a/native_client_sdk/src/libraries/nacl_io/filesystem.cc b/native_client_sdk/src/libraries/nacl_io/filesystem.cc
index feda1e7657..2577a3a311 100644
--- a/native_client_sdk/src/libraries/nacl_io/filesystem.cc
+++ b/native_client_sdk/src/libraries/nacl_io/filesystem.cc
@@ -39,6 +39,12 @@ Error Filesystem::Init(const FsInitArgs& args) {
void Filesystem::Destroy() {
}
+Error Filesystem::Open(const Path& path,
+ int open_flags,
+ ScopedNode* out_node) {
+ return OpenWithMode(path, open_flags, 0666, out_node);
+}
+
Error Filesystem::OpenResource(const Path& path, ScopedNode* out_node) {
out_node->reset(NULL);
LOG_TRACE("Can't open resource: %s", path.Join().c_str());
diff --git a/native_client_sdk/src/libraries/nacl_io/filesystem.h b/native_client_sdk/src/libraries/nacl_io/filesystem.h
index b05810bd5e..e6b7ba2aa1 100644
--- a/native_client_sdk/src/libraries/nacl_io/filesystem.h
+++ b/native_client_sdk/src/libraries/nacl_io/filesystem.h
@@ -62,16 +62,20 @@ class Filesystem : public sdk_util::RefObject {
// All paths in functions below are expected to containing a leading "/".
- // Test whether a file or directory at a given path can be accessed.
- // Returns 0 on success, or an appropriate errno value on failure.
- virtual Error Access(const Path& path, int a_mode) = 0;
+ // Open a node at |path| with the specified open and modeflags. The resulting
+ // Node is created with a ref count of 1.
+ // Assumes that |out_node| is non-NULL.
+ virtual Error OpenWithMode(const Path& path,
+ int open_flags,
+ mode_t mode,
+ ScopedNode* out_node) = 0;
// Open a node at |path| with the specified open flags. The resulting
// Node is created with a ref count of 1.
// Assumes that |out_node| is non-NULL.
- virtual Error Open(const Path& path,
- int open_flags,
- ScopedNode* out_node) = 0;
+ Error Open(const Path& path,
+ int open_flags,
+ ScopedNode* out_node);
// OpenResource is only used to read files from the NaCl NMF file. No
// filesystem except PassthroughFs should implement it.
@@ -91,10 +95,10 @@ class Filesystem : public sdk_util::RefObject {
Error Filesystem_Ioctl(int request, ...);
// Assumes that |node| is non-NULL.
- void OnNodeCreated(Node* node);
+ virtual void OnNodeCreated(Node* node);
// Assumes that |node| is non-NULL.
- void OnNodeDestroyed(Node* node);
+ virtual void OnNodeDestroyed(Node* node);
protected:
// Device number for the filesystem.
diff --git a/native_client_sdk/src/libraries/nacl_io/fuse.h b/native_client_sdk/src/libraries/nacl_io/fuse.h
index 314291c7cc..cbc381f790 100644
--- a/native_client_sdk/src/libraries/nacl_io/fuse.h
+++ b/native_client_sdk/src/libraries/nacl_io/fuse.h
@@ -87,35 +87,35 @@ struct fuse_operations {
unsigned int flag_nopath : 1;
unsigned int flag_reserved : 31;
- // Called when a filesystem of this type is initialized.
- void* (*init)(struct fuse_conn_info* conn);
- // Called when a filesystem of this type is unmounted.
- void (*destroy)(void*);
- // Called by access()
- int (*access)(const char* path, int mode);
- // Called when O_CREAT is passed to open()
- int (*create)(const char* path, mode_t mode, struct fuse_file_info*);
- // Called by stat()/fstat(). If this function pointer is non-NULL, it is
- // called, otherwise fuse_operations.getattr will be called.
- int (*fgetattr)(const char* path, struct stat*, struct fuse_file_info*);
- // Called by fsync(). The datasync paramater is not currently supported.
- int (*fsync)(const char* path, int datasync, struct fuse_file_info*);
- // Called by ftruncate()
- int (*ftruncate)(const char* path, off_t, struct fuse_file_info*);
// Called by stat()/fstat(), but only when fuse_operations.fgetattr is NULL.
// Also called by open() to determine if the path is a directory or a regular
// file.
int (*getattr)(const char* path, struct stat*);
- // Called by mkdir()
- int (*mkdir)(const char* path, mode_t);
+ // Not called currently.
+ int (*readlink)(const char*, char*, size_t);
// Called when O_CREAT is passed to open(), but only if fuse_operations.create
// is non-NULL.
int (*mknod)(const char* path, mode_t, dev_t);
+ // Called by mkdir()
+ int (*mkdir)(const char* path, mode_t);
+ // Called by unlink()
+ int (*unlink)(const char* path);
+ // Called by rmdir()
+ int (*rmdir)(const char* path);
+ // Not called currently.
+ int (*symlink)(const char*, const char*);
+ // Called by rename()
+ int (*rename)(const char* path, const char* new_path);
+ // Not called currently.
+ int (*link)(const char*, const char*);
+ // Called by chmod()/fchmod()
+ int (*chmod)(const char*, mode_t);
+ // Not called currently.
+ int (*chown)(const char*, uid_t, gid_t);
+ // Called by truncate(), as well as open() when O_TRUNC is passed.
+ int (*truncate)(const char* path, off_t);
// Called by open()
int (*open)(const char* path, struct fuse_file_info*);
- // Called by getdents(), which is called by the more standard functions
- // opendir()/readdir().
- int (*opendir)(const char* path, struct fuse_file_info*);
// Called by read(). Note that FUSE specifies that all reads will fill the
// entire requested buffer. If this function returns less than that, the
// remainder of the buffer is zeroed.
@@ -124,6 +124,34 @@ struct fuse_operations {
size_t count,
off_t,
struct fuse_file_info*);
+ // Called by write(). Note that FUSE specifies that a write should always
+ // return the full count, unless an error occurs.
+ int (*write)(const char* path,
+ const char* buf,
+ size_t count,
+ off_t,
+ struct fuse_file_info*);
+ // Not called currently.
+ int (*statfs)(const char*, struct statvfs*);
+ // Not called currently.
+ int (*flush)(const char*, struct fuse_file_info*);
+ // Called when the last reference to this node is released. This is only
+ // called for regular files. For directories, fuse_operations.releasedir is
+ // called instead.
+ int (*release)(const char* path, struct fuse_file_info*);
+ // Called by fsync(). The datasync paramater is not currently supported.
+ int (*fsync)(const char* path, int datasync, struct fuse_file_info*);
+ // Not called currently.
+ int (*setxattr)(const char*, const char*, const char*, size_t, int);
+ // Not called currently.
+ int (*getxattr)(const char*, const char*, char*, size_t);
+ // Not called currently.
+ int (*listxattr)(const char*, char*, size_t);
+ // Not called currently.
+ int (*removexattr)(const char*, const char*);
+ // Called by getdents(), which is called by the more standard functions
+ // opendir()/readdir().
+ int (*opendir)(const char* path, struct fuse_file_info*);
// Called by getdents(), which is called by the more standard function
// readdir().
//
@@ -176,67 +204,57 @@ struct fuse_operations {
off_t,
struct fuse_file_info*);
// Called when the last reference to this node is released. This is only
- // called for regular files. For directories, fuse_operations.releasedir is
- // called instead.
- int (*release)(const char* path, struct fuse_file_info*);
- // Called when the last reference to this node is released. This is only
// called for directories. For regular files, fuse_operations.release is
// called instead.
int (*releasedir)(const char* path, struct fuse_file_info*);
- // Called by rename()
- int (*rename)(const char* path, const char* new_path);
- // Called by rmdir()
- int (*rmdir)(const char* path);
- // Called by truncate(), as well as open() when O_TRUNC is passed.
- int (*truncate)(const char* path, off_t);
- // Called by unlink()
- int (*unlink)(const char* path);
- // Called by write(). Note that FUSE specifies that a write should always
- // return the full count, unless an error occurs.
- int (*write)(const char* path,
- const char* buf,
- size_t count,
- off_t,
- struct fuse_file_info*);
-
- // The following functions are not currently called by the nacl_io
- // implementation of FUSE.
- int (*bmap)(const char*, size_t blocksize, uint64_t* idx);
- int (*chmod)(const char*, mode_t);
- int (*chown)(const char*, uid_t, gid_t);
- int (*fallocate)(const char*, int, off_t, off_t, struct fuse_file_info*);
- int (*flock)(const char*, struct fuse_file_info*, int op);
- int (*flush)(const char*, struct fuse_file_info*);
+ // Not called currently.
int (*fsyncdir)(const char*, int, struct fuse_file_info*);
- int (*getxattr)(const char*, const char*, char*, size_t);
+ // Called when a filesystem of this type is initialized.
+ void* (*init)(struct fuse_conn_info* conn);
+ // Called when a filesystem of this type is unmounted.
+ void (*destroy)(void*);
+ // Called by access()
+ int (*access)(const char* path, int mode);
+ // Called when O_CREAT is passed to open()
+ int (*create)(const char* path, mode_t mode, struct fuse_file_info*);
+ // Called by ftruncate()
+ int (*ftruncate)(const char* path, off_t, struct fuse_file_info*);
+ // Called by stat()/fstat(). If this function pointer is non-NULL, it is
+ // called, otherwise fuse_operations.getattr will be called.
+ int (*fgetattr)(const char* path, struct stat*, struct fuse_file_info*);
+ // Not called currently.
+ int (*lock)(const char*, struct fuse_file_info*, int cmd, struct flock*);
+ // Called by utime()/utimes()/futimes()/futimens() etc.
+ int (*utimens)(const char*, const struct timespec tv[2]);
+ // Not called currently.
+ int (*bmap)(const char*, size_t blocksize, uint64_t* idx);
+ // Not called currently.
int (*ioctl)(const char*,
int cmd,
void* arg,
struct fuse_file_info*,
unsigned int flags,
void* data);
- int (*link)(const char*, const char*);
- int (*listxattr)(const char*, char*, size_t);
- int (*lock)(const char*, struct fuse_file_info*, int cmd, struct flock*);
+ // Not called currently.
int (*poll)(const char*,
struct fuse_file_info*,
struct fuse_pollhandle* ph,
unsigned* reventsp);
+ // Not called currently.
+ int (*write_buf)(const char*,
+ struct fuse_bufvec* buf,
+ off_t off,
+ struct fuse_file_info*);
+ // Not called currently.
int (*read_buf)(const char*,
struct fuse_bufvec** bufp,
size_t size,
off_t off,
struct fuse_file_info*);
- int (*readlink)(const char*, char*, size_t);
- int (*removexattr)(const char*, const char*);
- int (*setxattr)(const char*, const char*, const char*, size_t, int);
- int (*statfs)(const char*, struct statvfs*);
- int (*symlink)(const char*, const char*);
- int (*utimens)(const char*, const struct timespec tv[2]);
- int (*write_buf)(const char*,
- struct fuse_bufvec* buf,
- off_t off,
- struct fuse_file_info*);
+ // Not called currently.
+ int (*flock)(const char*, struct fuse_file_info*, int op);
+ // Not called currently.
+ int (*fallocate)(const char*, int, off_t, off_t, struct fuse_file_info*);
};
#endif // LIBRARIES_NACL_IO_FUSE_H_
diff --git a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
index fdf74be4a6..d072392631 100644
--- a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
@@ -57,20 +57,8 @@ void FuseFs::Destroy() {
fuse_ops_->destroy(fuse_user_data_);
}
-Error FuseFs::Access(const Path& path, int a_mode) {
- if (!fuse_ops_->access) {
- LOG_TRACE("fuse_ops_->access is NULL.");
- return ENOSYS;
- }
-
- int result = fuse_ops_->access(path.Join().c_str(), a_mode);
- if (result < 0)
- return -result;
-
- return 0;
-}
-
-Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
+Error FuseFs::OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node) {
std::string path_str = path.Join();
const char* path_cstr = path_str.c_str();
int result = 0;
@@ -82,7 +70,6 @@ Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
if (open_flags & (O_CREAT | O_EXCL)) {
// According to the FUSE docs, open() is not called when O_CREAT or O_EXCL
// is passed.
- mode_t mode = S_IRALL | S_IWALL;
if (fuse_ops_->create) {
result = fuse_ops_->create(path_cstr, mode, &fi);
if (result < 0)
@@ -114,6 +101,8 @@ Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
*out_node = node;
return 0;
}
+ // Get mode.
+ mode = statbuf.st_mode & ~S_IFMT;
}
// Existing file.
@@ -142,6 +131,7 @@ Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
Error error = node->Init(open_flags);
if (error)
return error;
+ node->SetMode(mode);
*out_node = node;
return 0;
@@ -257,6 +247,34 @@ Error FuseFsNode::GetStat(struct stat* stat) {
return 0;
}
+Error FuseFsNode::Futimens(const struct timespec times[2]) {
+ int result;
+ if (!fuse_ops_->utimens) {
+ LOG_TRACE("fuse_ops_->utimens is NULL.");
+ return ENOSYS;
+ }
+
+ result = fuse_ops_->utimens(path_.c_str(), times);
+ if (result < 0)
+ return -result;
+
+ return result;
+}
+
+Error FuseFsNode::Fchmod(mode_t mode) {
+ int result;
+ if (!fuse_ops_->chmod) {
+ LOG_TRACE("fuse_ops_->chmod is NULL.");
+ return ENOSYS;
+ }
+
+ result = fuse_ops_->chmod(path_.c_str(), mode);
+ if (result < 0)
+ return -result;
+
+ return result;
+}
+
Error FuseFsNode::VIoctl(int request, va_list args) {
LOG_ERROR("Ioctl not implemented for fusefs.");
return ENOSYS;
@@ -341,13 +359,11 @@ Error FileFuseFsNode::Read(const HandleAttr& attr,
if (result < 0)
return -result;
- // Fuse docs say that a read() call will always completely fill the buffer
- // (padding with zeroes) unless the direct_io filesystem flag is set.
// TODO(binji): support the direct_io flag
if (static_cast<size_t>(result) < count)
memset(&cbuf[result], 0, count - result);
- *out_bytes = count;
+ *out_bytes = result;
return 0;
}
@@ -365,9 +381,6 @@ Error FileFuseFsNode::Write(const HandleAttr& attr,
if (result < 0)
return -result;
- // Fuse docs say that a write() call will always write the entire buffer
- // unless the direct_io filesystem flag is set.
- // TODO(binji): What should we do if the user breaks this contract? Warn?
// TODO(binji): support the direct_io flag
*out_bytes = result;
return 0;
diff --git a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.h b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.h
index 2c41e3f50a..609714395a 100644
--- a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.h
@@ -21,8 +21,8 @@ class FuseFs : public Filesystem {
virtual void Destroy();
public:
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int perm);
virtual Error Rmdir(const Path& path);
@@ -54,6 +54,8 @@ class FuseFsNode : public Node {
virtual Error Tcsetattr(int optional_actions,
const struct termios* termios_p);
virtual Error GetSize(off_t* out_size);
+ virtual Error Futimens(const struct timespec times[2]);
+ virtual Error Fchmod(mode_t mode);
protected:
struct fuse_operations* fuse_ops_;
diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
index 11648f6522..4dd50acfa2 100644
--- a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
+++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc
@@ -221,6 +221,16 @@ void HostResolver::freeaddrinfo(struct addrinfo* res) {
}
}
+int HostResolver::getnameinfo(const struct sockaddr *sa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ int flags) {
+ return ENOSYS;
+}
+
int HostResolver::getaddrinfo(const char* node,
const char* service,
const struct addrinfo* hints_in,
diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.h b/native_client_sdk/src/libraries/nacl_io/host_resolver.h
index 2647e29a67..cb2365f6d0 100644
--- a/native_client_sdk/src/libraries/nacl_io/host_resolver.h
+++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.h
@@ -21,6 +21,13 @@ class HostResolver {
void Init(PepperInterface* ppapi);
void freeaddrinfo(struct addrinfo* res);
+ int getnameinfo(const struct sockaddr *sa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ int flags);
int getaddrinfo(const char* node,
const char* service,
const struct addrinfo* hints,
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
index 00d2e934ae..9a5aaf3310 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.cc
@@ -29,13 +29,43 @@ int64_t strtoull(const char* nptr, char** endptr, int base) {
} // namespace
-Error Html5Fs::Access(const Path& path, int a_mode) {
- // a_mode is unused, since all files are readable, writable and executable.
- ScopedNode node;
- return Open(path, O_RDONLY, &node);
+// Continuing DJB2a hash
+ino_t Html5Fs::HashPathSegment(ino_t hash, const char *str, size_t len) {
+ // First add the path seperator
+ hash = (hash * static_cast<ino_t>(33)) ^ '/';
+ while (len--) {
+ hash = (hash * static_cast<ino_t>(33)) ^ *str++;
+ }
+ return hash;
+}
+
+ino_t Html5Fs::HashPath(const Path& path) {
+ // Prime the DJB2a hash
+ ino_t hash = 5381;
+
+ // Apply a running DJB2a to each part of the path
+ for (size_t segment = 0; segment < path.Size(); segment++) {
+ const char *ptr = path.Part(segment).c_str();
+ size_t len = path.Part(segment).length();
+ hash = HashPathSegment(hash, ptr, len);
+ }
+ return hash;
+}
+
+
+// For HTML5, the INO should be the one used by the system, however PPAPI
+// does not provide access to the real INO. Instead, since HTML5 does not
+// suport links, we assume that files are unique based on path to the base
+// of the mount.
+void Html5Fs::OnNodeCreated(Node* node) {
+ node->stat_.st_dev = dev_;
}
-Error Html5Fs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
+void Html5Fs::OnNodeDestroyed(Node* node) {}
+
+
+Error Html5Fs::OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node) {
out_node->reset(NULL);
Error error = BlockUntilFilesystemOpen();
if (error)
@@ -48,6 +78,10 @@ Error Html5Fs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
ScopedNode node(new Html5FsNode(this, fileref));
error = node->Init(open_flags);
+
+ // Set the INO based on the path
+ node->stat_.st_ino = HashPath(path);
+
if (error)
return error;
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.h b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.h
index 8233639900..c075aa64d2 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs.h
@@ -18,8 +18,8 @@ class Node;
class Html5Fs : public Filesystem {
public:
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int permissions);
virtual Error Rmdir(const Path& path);
@@ -28,6 +28,12 @@ class Html5Fs : public Filesystem {
PP_Resource filesystem_resource() { return filesystem_resource_; }
+ virtual void OnNodeCreated(Node* node);
+ virtual void OnNodeDestroyed(Node* node);
+
+ static ino_t HashPathSegment(ino_t hash, const char *str, size_t len);
+ static ino_t HashPath(const Path& path);
+
protected:
static const int REMOVE_DIR = 1;
static const int REMOVE_FILE = 2;
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
index 981f69e8f3..91662912a8 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
@@ -16,6 +16,7 @@
#include "nacl_io/filesystem.h"
#include "nacl_io/getdents_helper.h"
+#include "nacl_io/html5fs/html5_fs.h"
#include "nacl_io/kernel_handle.h"
#include "nacl_io/osdirent.h"
#include "nacl_io/pepper_interface.h"
@@ -125,8 +126,13 @@ Error Html5FsNode::GetDents(size_t offs,
std::min(static_cast<size_t>(file_name_length),
MEMBER_SIZE(dirent, d_name) - 1); // -1 for NULL.
- // TODO(binji): Better handling of ino numbers.
- helper.AddDirent(1, file_name, file_name_length);
+ // The INO is based on the running hash of fully qualified path, so
+ // a childs INO must be the parent directories hash, plus '/', plus
+ // the filename.
+ ino_t child_ino = Html5Fs::HashPathSegment(stat_.st_ino, file_name,
+ file_name_length);
+
+ helper.AddDirent(child_ino, file_name, file_name_length);
}
var_iface_->Release(file_name_var);
@@ -268,13 +274,17 @@ Error Html5FsNode::Init(int open_flags) {
return EIO;
}
+ // Set all files and directories to RWX.
+ SetMode(S_IWALL | S_IRALL | S_IXALL);
+
// First query the FileRef to see if it is a file or directory.
PP_FileInfo file_info;
int32_t query_result = file_ref_iface_->Query(
fileref_resource_, &file_info, PP_BlockUntilComplete());
// If this is a directory, do not get a FileIO.
- if (query_result == PP_OK && file_info.type == PP_FILETYPE_DIRECTORY)
+ if (query_result == PP_OK && file_info.type == PP_FILETYPE_DIRECTORY) {
return 0;
+ }
fileio_resource_ =
file_io_iface_->Create(filesystem_->ppapi()->GetInstance());
diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc
index cc44cfa0ba..1950bb1512 100644
--- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc
@@ -41,40 +41,19 @@ std::string NormalizeHeaderKey(const std::string& s) {
return result;
}
-Error HttpFs::Access(const Path& path, int a_mode) {
- NodeMap_t::iterator iter = node_cache_.find(path.Join());
- if (iter == node_cache_.end()) {
- // If we can't find the node in the cache, fetch it
- std::string url = MakeUrl(path);
- ScopedNode node(new HttpFsNode(this, url, cache_content_));
- Error error = node->Init(0);
- if (error)
- return error;
-
- error = node->GetStat(NULL);
- if (error)
- return error;
- }
-
- // Don't allow write or execute access.
- if (a_mode & (W_OK | X_OK))
- return EACCES;
-
- return 0;
-}
-
-Error HttpFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
+Error HttpFs::OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node) {
out_node->reset(NULL);
- NodeMap_t::iterator iter = node_cache_.find(path.Join());
- if (iter != node_cache_.end()) {
- *out_node = iter->second;
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() != NULL) {
+ *out_node = node;
return 0;
}
// If we can't find the node in the cache, create it
std::string url = MakeUrl(path);
- ScopedNode node(new HttpFsNode(this, url, cache_content_));
+ node.reset(new HttpFsNode(this, url, cache_content_));
Error error = node->Init(open_flags);
if (error)
return error;
@@ -97,48 +76,54 @@ Error HttpFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
return 0;
}
-Error HttpFs::Unlink(const Path& path) {
+ScopedNode HttpFs::FindExistingNode(const Path& path) {
NodeMap_t::iterator iter = node_cache_.find(path.Join());
if (iter == node_cache_.end())
+ return ScopedNode();
+ return iter->second;
+}
+
+Error HttpFs::Unlink(const Path& path) {
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() == NULL)
return ENOENT;
- if (iter->second->IsaDir())
+ if (node->IsaDir())
return EISDIR;
return EACCES;
}
Error HttpFs::Mkdir(const Path& path, int permissions) {
- NodeMap_t::iterator iter = node_cache_.find(path.Join());
- if (iter != node_cache_.end()) {
- if (iter->second->IsaDir())
- return EEXIST;
- }
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() != NULL && node->IsaDir())
+ return EEXIST;
+
return EACCES;
}
Error HttpFs::Rmdir(const Path& path) {
- NodeMap_t::iterator iter = node_cache_.find(path.Join());
- if (iter == node_cache_.end())
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() == NULL)
return ENOENT;
- if (!iter->second->IsaDir())
+ if (!node->IsaDir())
return ENOTDIR;
return EACCES;
}
Error HttpFs::Remove(const Path& path) {
- NodeMap_t::iterator iter = node_cache_.find(path.Join());
- if (iter == node_cache_.end())
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() == NULL)
return ENOENT;
return EACCES;
}
Error HttpFs::Rename(const Path& path, const Path& newpath) {
- NodeMap_t::iterator iter = node_cache_.find(path.Join());
- if (iter == node_cache_.end())
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() == NULL)
return ENOENT;
return EACCES;
@@ -197,7 +182,8 @@ HttpFs::HttpFs()
: allow_cors_(false),
allow_credentials_(false),
cache_stat_(true),
- cache_content_(true) {
+ cache_content_(true),
+ is_blob_url_(false) {
}
Error HttpFs::Init(const FsInitArgs& args) {
@@ -213,11 +199,6 @@ Error HttpFs::Init(const FsInitArgs& args) {
url_root_ = iter->second;
is_blob_url_ = strncmp(url_root_.c_str(), "blob:", 5) == 0;
- // Make sure url_root_ ends with a slash, except for blob URLs.
- if (!is_blob_url_ && !url_root_.empty() &&
- url_root_[url_root_.length() - 1] != '/') {
- url_root_ += '/';
- }
} else if (iter->first == "manifest") {
char* text;
error = LoadManifest(iter->second, &text);
@@ -245,6 +226,18 @@ Error HttpFs::Init(const FsInitArgs& args) {
}
}
+ if (!is_blob_url_) {
+ if (!url_root_.empty() && url_root_[url_root_.length() - 1] != '/') {
+ // Make sure url_root_ ends with a slash, except for blob URLs.
+ url_root_ += '/';
+ }
+
+ ScopedNode root;
+ error = FindOrCreateDir(Path("/"), &root);
+ if (error)
+ return error;
+ }
+
return 0;
}
@@ -253,18 +246,20 @@ void HttpFs::Destroy() {
Error HttpFs::FindOrCreateDir(const Path& path, ScopedNode* out_node) {
out_node->reset(NULL);
- std::string strpath = path.Join();
- NodeMap_t::iterator iter = node_cache_.find(strpath);
- if (iter != node_cache_.end()) {
- *out_node = iter->second;
+
+ ScopedNode node = FindExistingNode(path);
+ if (node.get() != NULL) {
+ *out_node = node;
return 0;
}
// If the node does not exist, create it.
- ScopedNode node(new DirNode(this));
+ node.reset(new DirNode(this));
Error error = node->Init(0);
if (error)
return error;
+ // Directorys in http filesystems are never writable.
+ node->SetMode(node->GetMode() & ~S_IWALL);
// If not the root node, find the parent node and add it to the parent
if (!path.IsRoot()) {
@@ -279,7 +274,7 @@ Error HttpFs::FindOrCreateDir(const Path& path, ScopedNode* out_node) {
}
// Add it to the node cache.
- node_cache_[strpath] = node;
+ node_cache_[path.Join()] = node;
*out_node = node;
return 0;
}
@@ -311,13 +306,13 @@ Error HttpFs::ParseManifest(const char* text) {
// Only support regular and streams for now
// Ignore EXEC bit
- int mode = S_IFREG;
+ int type = 0;
switch (modestr[0]) {
case '-':
- mode = S_IFREG;
+ type = S_IFREG;
break;
case 'c':
- mode = S_IFCHR;
+ type = S_IFCHR;
break;
default:
LOG_ERROR("Unable to parse type %s for %s.",
@@ -326,6 +321,7 @@ Error HttpFs::ParseManifest(const char* text) {
return EINVAL;
}
+ int mode = 0;
switch (modestr[1]) {
case '-':
break;
@@ -356,8 +352,9 @@ Error HttpFs::ParseManifest(const char* text) {
std::string url = MakeUrl(path);
HttpFsNode* http_node = new HttpFsNode(this, url, cache_content_);
- http_node->SetMode(mode);
ScopedNode node(http_node);
+ node->SetMode(mode);
+ node->SetType(type);
Error error = node->Init(0);
if (error)
@@ -373,8 +370,7 @@ Error HttpFs::ParseManifest(const char* text) {
if (error)
return error;
- std::string pname = path.Join();
- node_cache_[pname] = node;
+ node_cache_[path.Join()] = node;
}
}
diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.h b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.h
index 3c43927218..b481cc4821 100644
--- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.h
@@ -18,8 +18,8 @@ class HttpFs : public Filesystem {
public:
typedef std::map<std::string, ScopedNode> NodeMap_t;
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int permissions);
virtual Error Rmdir(const Path& path);
@@ -35,6 +35,7 @@ class HttpFs : public Filesystem {
virtual Error Init(const FsInitArgs& args);
virtual void Destroy();
+ ScopedNode FindExistingNode(const Path& path);
Error FindOrCreateDir(const Path& path, ScopedNode* out_node);
Error LoadManifest(const std::string& path, char** out_manifest);
Error ParseManifest(const char* text);
diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc
index b41cefbda0..73930a7681 100644
--- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.cc
@@ -232,10 +232,12 @@ HttpFsNode::HttpFsNode(Filesystem* filesystem,
buffer_len_(0),
cache_content_(cache_content),
has_cached_size_(false) {
+ // http nodes are read-only by default
+ SetMode(S_IRALL);
}
-void HttpFsNode::SetMode(int mode) {
- stat_.st_mode = mode;
+HttpFsNode::~HttpFsNode() {
+ free(buffer_);
}
Error HttpFsNode::GetStat_Locked(struct stat* stat) {
@@ -297,7 +299,7 @@ Error HttpFsNode::GetStat_Locked(struct stat* stat) {
stat_.st_mtime = 0;
stat_.st_ctime = 0;
- stat_.st_mode |= S_IFREG;
+ SetType(S_IFREG);
}
// Fill the stat structure if provided
diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.h b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.h
index cccd335d70..f9cabf0595 100644
--- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.h
+++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs_node.h
@@ -37,13 +37,14 @@ class HttpFsNode : public Node {
virtual Error GetSize(off_t* out_size);
void SetCachedSize(off_t size);
- void SetMode(int mode);
protected:
HttpFsNode(Filesystem* filesystem,
const std::string& url,
bool cache_content);
+ virtual ~HttpFsNode();
+
private:
Error GetStat_Locked(struct stat* stat);
Error OpenUrl(const char* method,
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h b/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h
index d09eb59a02..d116253f41 100644
--- a/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h
+++ b/native_client_sdk/src/libraries/nacl_io/include/sys/poll.h
@@ -6,10 +6,7 @@
#define LIBRARIES_NACL_IO_INCLUDE_SYS_POLL_H_
#include <stdint.h>
-
-#include "sdk_util/macros.h"
-
-EXTERN_C_BEGIN
+#include <sys/cdefs.h>
/* This header adds definitions of flags and structures for use with poll on
* toolchains with 'C' libraries which do not normally supply poll. */
@@ -31,8 +28,10 @@ struct pollfd {
uint16_t revents;
};
+__BEGIN_DECLS
+
int poll(struct pollfd* __fds, nfds_t __nfds, int __timeout);
-EXTERN_C_END
+__END_DECLS
#endif /* LIBRARIES_NACL_IO_INCLUDE_SYS_POLL_H_ */
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/time.h b/native_client_sdk/src/libraries/nacl_io/include/sys/time.h
new file mode 100644
index 0000000000..8c56c5896b
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/include/sys/time.h
@@ -0,0 +1,22 @@
+/* Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include_next <sys/time.h>
+
+#ifndef LIBRARIES_NACL_IO_INCLUDE_SYS_TIME_H
+#define LIBRARIES_NACL_IO_INCLUDE_SYS_TIME_H
+
+#include <sys/cdefs.h>
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+// TODO(binji): https://code.google.com/p/nativeclient/issues/detail?id=3949
+// remove when these declarations are added to the newlib headers.
+int utimes(const char *filename, const struct timeval times[2]);
+int futimes(int fd, const struct timeval times[2]);
+
+__END_DECLS
+
+#endif /* LIBRARIES_NACL_IO_INCLUDE_SYS_TIME_H */
diff --git a/native_client_sdk/src/libraries/nacl_io/include/utime.h b/native_client_sdk/src/libraries/nacl_io/include/utime.h
new file mode 100644
index 0000000000..d21518b019
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/include/utime.h
@@ -0,0 +1,20 @@
+/* Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include_next <utime.h>
+
+#ifndef LIBRARIES_NACL_IO_INCLUDE_UTIME_H_
+#define LIBRARIES_NACL_IO_INCLUDE_UTIME_H_
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+// TODO(binji): https://code.google.com/p/nativeclient/issues/detail?id=3949
+// remove when these declarations are added to the newlib headers.
+int utime(const char* filename, const struct utimbuf* times);
+
+__END_DECLS
+
+#endif /* LIBRARIES_NACL_IO_INCLUDE_UTIME_H_ */
diff --git a/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.cc b/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.cc
index 9c0b2153d7..26d2e14e99 100644
--- a/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.cc
@@ -391,20 +391,8 @@ PP_Var JsFs::WaitForResponse(RequestId request_id) {
}
}
-Error JsFs::Access(const Path& path, int a_mode) {
- ScopedVar response(ppapi_);
- if (!SendRequestAndWait(&response, "%s%s%d",
- "cmd", "access",
- "path", path.Join().c_str(),
- "amode", a_mode)) {
- LOG_ERROR("Failed to send request.");
- return EINVAL;
- }
-
- return ErrorFromResponse(response);
-}
-
-Error JsFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
+Error JsFs::OpenWithMode(const Path& path, int open_flags, mode_t t,
+ ScopedNode* out_node) {
out_node->reset(NULL);
ScopedVar response(ppapi_);
if (!SendRequestAndWait(&response, "%s%s%d",
diff --git a/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.h b/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.h
index a01f19cdf3..08b1e4c182 100644
--- a/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.h
@@ -35,8 +35,8 @@ class JsFs : public Filesystem {
virtual void Destroy();
public:
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int perm);
virtual Error Rmdir(const Path& path);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
index 6f5a510585..d0790648c6 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc
@@ -14,6 +14,7 @@
#include "nacl_io/log.h"
#include "nacl_io/osmman.h"
#include "nacl_io/ossocket.h"
+#include "nacl_io/ostime.h"
#include "nacl_io/pepper_interface.h"
#include "nacl_io/real_pepper_interface.h"
@@ -109,8 +110,12 @@ int ki_is_initialized() {
return s_state.kp != NULL;
}
-void ki_uninit() {
+int ki_uninit() {
LOG_TRACE("ki_uninit");
+ assert(s_state.kp);
+ if (s_state.kp == NULL)
+ return 1;
+
if (s_saved_state.kp == NULL)
kernel_wrap_uninit();
@@ -124,6 +129,7 @@ void ki_uninit() {
delete state_to_delete.kp;
delete state_to_delete.ppapi;
+ return 0;
}
nacl_io::KernelProxy* ki_get_proxy() {
@@ -221,9 +227,9 @@ int ki_umount(const char* path) {
return s_state.kp->umount(path);
}
-int ki_open(const char* path, int oflag) {
+int ki_open(const char* path, int oflag, mode_t mode) {
ON_NOSYS_RETURN(-1);
- return s_state.kp->open(path, oflag);
+ return s_state.kp->open(path, oflag, mode);
}
int ki_pipe(int pipefds[2]) {
@@ -328,7 +334,24 @@ int ki_readlink(const char* path, char* buf, size_t count) {
int ki_utimes(const char* path, const struct timeval times[2]) {
ON_NOSYS_RETURN(-1);
- return s_state.kp->utimes(path, times);
+ // Implement in terms of utimens.
+ struct timespec ts[2];
+ ts[0].tv_sec = times[0].tv_sec;
+ ts[0].tv_nsec = times[0].tv_usec * 1000;
+ ts[1].tv_sec = times[1].tv_sec;
+ ts[1].tv_nsec = times[1].tv_usec * 1000;
+ return s_state.kp->utimens(path, ts);
+}
+
+int ki_futimes(int fd, const struct timeval times[2]) {
+ ON_NOSYS_RETURN(-1);
+ // Implement in terms of futimens.
+ struct timespec ts[2];
+ ts[0].tv_sec = times[0].tv_sec;
+ ts[0].tv_nsec = times[0].tv_usec * 1000;
+ ts[1].tv_sec = times[1].tv_sec;
+ ts[1].tv_nsec = times[1].tv_usec * 1000;
+ return s_state.kp->futimens(fd, ts);
}
void* ki_mmap(void* addr,
@@ -378,7 +401,18 @@ int ki_lchown(const char* path, uid_t owner, gid_t group) {
int ki_utime(const char* filename, const struct utimbuf* times) {
ON_NOSYS_RETURN(-1);
- return s_state.kp->utime(filename, times);
+ // Implement in terms of utimens.
+ struct timespec ts[2];
+ ts[0].tv_sec = times->actime;
+ ts[0].tv_nsec = 0;
+ ts[1].tv_sec = times->modtime;
+ ts[1].tv_nsec = 0;
+ return s_state.kp->utimens(filename, ts);
+}
+
+int ki_futimens(int fd, const struct timespec times[2]) {
+ ON_NOSYS_RETURN(-1);
+ return s_state.kp->futimens(fd, times);
}
int ki_poll(struct pollfd* fds, nfds_t nfds, int timeout) {
@@ -482,6 +516,18 @@ struct hostent* ki_gethostbyname(const char* name) {
return s_state.kp->gethostbyname(name);
}
+int ki_getnameinfo(const struct sockaddr *sa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ unsigned int flags) {
+ ON_NOSYS_RETURN(EAI_SYSTEM);
+ return s_state.kp->getnameinfo(sa, salen, host, hostlen, serv, servlen,
+ flags);
+}
+
int ki_getaddrinfo(const char* node,
const char* service,
const struct addrinfo* hints,
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h
index ff57b8886d..c513a42fe4 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_intercept.h
@@ -65,7 +65,7 @@ nacl_io::KernelProxy* ki_get_proxy();
#endif
int ki_is_initialized(void);
-void ki_uninit(void);
+int ki_uninit(void);
int ki_chdir(const char* path);
void ki_exit(int status);
@@ -85,7 +85,7 @@ int ki_mount(const char* source,
unsigned long mountflags,
const void* data);
int ki_umount(const char* path);
-int ki_open(const char* path, int oflag);
+int ki_open(const char* path, int oflag, mode_t mode);
int ki_pipe(int pipefds[2]);
ssize_t ki_read(int fd, void* buf, size_t nbyte);
ssize_t ki_write(int fd, const void* buf, size_t nbyte);
@@ -107,6 +107,7 @@ int ki_symlink(const char* oldpath, const char* newpath);
int ki_access(const char* path, int amode);
int ki_readlink(const char* path, char* buf, size_t count);
int ki_utimes(const char* path, const struct timeval times[2]);
+int ki_futimes(int fd, const struct timeval times[2]);
void* ki_mmap(void* addr,
size_t length,
int prot,
@@ -121,6 +122,7 @@ int ki_chown(const char* path, uid_t owner, gid_t group);
int ki_fchown(int fd, uid_t owner, gid_t group);
int ki_lchown(const char* path, uid_t owner, gid_t group);
int ki_utime(const char* filename, const struct utimbuf* times);
+int ki_futimens(int fd, const struct timespec times[2]);
int ki_poll(struct pollfd* fds, nfds_t nfds, int timeout);
int ki_select(int nfds,
@@ -154,6 +156,13 @@ int ki_getaddrinfo(const char* node,
const struct addrinfo* hints,
struct addrinfo** res);
struct hostent* ki_gethostbyname(const char* name);
+int ki_getnameinfo(const struct sockaddr *sa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ unsigned int flags);
int ki_getpeername(int fd, struct sockaddr* addr, socklen_t* len);
int ki_getsockname(int fd, struct sockaddr* addr, socklen_t* len);
int ki_getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_object.cc b/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
index 853947fc92..c9f3f2efc9 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
@@ -99,7 +99,7 @@ Error KernelObject::AcquireFsAndRelPath(const std::string& path,
// Given a path, acquire the associated filesystem and node, creating the
// node if needed based on the provided flags.
Error KernelObject::AcquireFsAndNode(const std::string& path,
- int oflags,
+ int oflags, mode_t mflags,
ScopedFilesystem* out_fs,
ScopedNode* out_node) {
Path rel_parts;
@@ -109,7 +109,7 @@ Error KernelObject::AcquireFsAndNode(const std::string& path,
if (error)
return error;
- error = (*out_fs)->Open(rel_parts, oflags, out_node);
+ error = (*out_fs)->OpenWithMode(rel_parts, oflags, mflags, out_node);
if (error)
return error;
@@ -143,7 +143,7 @@ Error KernelObject::SetCWD(const std::string& path) {
ScopedFilesystem fs;
ScopedNode node;
- Error error = AcquireFsAndNode(abs_path, O_RDONLY, &fs, &node);
+ Error error = AcquireFsAndNode(abs_path, O_RDONLY, 0, &fs, &node);
if (error)
return error;
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_object.h b/native_client_sdk/src/libraries/nacl_io/kernel_object.h
index 5563cf339c..2f707e09b7 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.h
@@ -62,7 +62,7 @@ class KernelObject {
// specified by the |oflags|.
// Assumes |out_fs| and |out_node| are non-NULL.
Error AcquireFsAndNode(const std::string& path,
- int oflags,
+ int oflags, mode_t mflags,
ScopedFilesystem* out_fs,
ScopedNode* out_node);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
index 7574d062a0..b5cf443c7d 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
@@ -104,17 +104,17 @@ Error KernelProxy::Init(PepperInterface* ppapi) {
// Open the first three in order to get STDIN, STDOUT, STDERR
int fd;
- fd = open("/dev/stdin", O_RDONLY);
+ fd = open("/dev/stdin", O_RDONLY, 0);
assert(fd == 0);
if (fd < 0)
rtn = errno;
- fd = open("/dev/stdout", O_WRONLY);
+ fd = open("/dev/stdout", O_WRONLY, 0);
assert(fd == 1);
if (fd < 0)
rtn = errno;
- fd = open("/dev/stderr", O_WRONLY);
+ fd = open("/dev/stderr", O_WRONLY, 0);
assert(fd == 2);
if (fd < 0)
rtn = errno;
@@ -199,11 +199,11 @@ int KernelProxy::open_resource(const char* path) {
return AllocateFD(handle, path);
}
-int KernelProxy::open(const char* path, int open_flags) {
+int KernelProxy::open(const char* path, int open_flags, mode_t mode) {
ScopedFilesystem fs;
ScopedNode node;
- Error error = AcquireFsAndNode(path, open_flags, &fs, &node);
+ Error error = AcquireFsAndNode(path, open_flags, mode, &fs, &node);
if (error) {
errno = error;
return -1;
@@ -324,7 +324,7 @@ char* KernelProxy::getwd(char* buf) {
}
int KernelProxy::chmod(const char* path, mode_t mode) {
- int fd = KernelProxy::open(path, O_RDONLY);
+ int fd = open(path, O_RDONLY, mode);
if (-1 == fd)
return -1;
@@ -345,10 +345,6 @@ int KernelProxy::lchown(const char* path, uid_t owner, gid_t group) {
return 0;
}
-int KernelProxy::utime(const char* filename, const struct utimbuf* times) {
- return 0;
-}
-
int KernelProxy::mkdir(const char* path, mode_t mode) {
ScopedFilesystem fs;
Path rel;
@@ -388,7 +384,7 @@ int KernelProxy::rmdir(const char* path) {
}
int KernelProxy::stat(const char* path, struct stat* buf) {
- int fd = open(path, O_RDONLY);
+ int fd = open(path, O_RDONLY, 0);
if (-1 == fd)
return -1;
@@ -680,6 +676,23 @@ int KernelProxy::ioctl(int fd, int request, va_list args) {
return 0;
}
+int KernelProxy::futimens(int fd, const struct timespec times[2]) {
+ ScopedKernelHandle handle;
+ Error error = AcquireHandle(fd, &handle);
+ if (error) {
+ errno = error;
+ return -1;
+ }
+
+ error = handle->node()->Futimens(times);
+ if (error) {
+ errno = error;
+ return -1;
+ }
+
+ return 0;
+}
+
off_t KernelProxy::lseek(int fd, off_t offset, int whence) {
ScopedKernelHandle handle;
Error error = AcquireHandle(fd, &handle);
@@ -718,7 +731,7 @@ int KernelProxy::unlink(const char* path) {
}
int KernelProxy::truncate(const char* path, off_t len) {
- int fd = KernelProxy::open(path, O_WRONLY);
+ int fd = open(path, O_WRONLY, 0);
if (-1 == fd)
return -1;
@@ -786,8 +799,7 @@ int KernelProxy::remove(const char* path) {
return 0;
}
-// TODO(noelallen): Needs implementation.
-int KernelProxy::fchmod(int fd, int mode) {
+int KernelProxy::fchmod(int fd, mode_t mode) {
ScopedKernelHandle handle;
Error error = AcquireHandle(fd, &handle);
if (error) {
@@ -795,6 +807,12 @@ int KernelProxy::fchmod(int fd, int mode) {
return -1;
}
+ error = handle->node()->Fchmod(mode);
+ if (error) {
+ errno = error;
+ return -1;
+ }
+
return 0;
}
@@ -843,20 +861,18 @@ int KernelProxy::fcntl(int fd, int request, va_list args) {
}
int KernelProxy::access(const char* path, int amode) {
- ScopedFilesystem fs;
- Path rel;
+ struct stat buf;
+ int rtn = stat(path, &buf);
+ if (rtn != 0)
+ return rtn;
- Error error = AcquireFsAndRelPath(path, &fs, &rel);
- if (error) {
- errno = error;
+ if (((amode & R_OK) && !(buf.st_mode & S_IREAD)) ||
+ ((amode & W_OK) && !(buf.st_mode & S_IWRITE)) ||
+ ((amode & X_OK) && !(buf.st_mode & S_IEXEC))) {
+ errno = EACCES;
return -1;
}
- error = fs->Access(rel, amode);
- if (error) {
- errno = error;
- return -1;
- }
return 0;
}
@@ -866,10 +882,14 @@ int KernelProxy::readlink(const char* path, char* buf, size_t count) {
return -1;
}
-int KernelProxy::utimes(const char* filename, const struct timeval times[2]) {
- LOG_TRACE("utimes is not implemented.");
- errno = EINVAL;
- return -1;
+int KernelProxy::utimens(const char* path, const struct timespec times[2]) {
+ int fd = open(path, O_RDONLY, 0);
+ if (-1 == fd)
+ return -1;
+
+ int result = futimens(fd, times);
+ close(fd);
+ return result;
}
// TODO(noelallen): Needs implementation.
@@ -1356,6 +1376,17 @@ int KernelProxy::getaddrinfo(const char* node,
return host_resolver_.getaddrinfo(node, service, hints, res);
}
+int KernelProxy::getnameinfo(const struct sockaddr *sa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ int flags) {
+ return host_resolver_.getnameinfo(sa, salen, host, hostlen, serv, servlen,
+ flags);
+}
+
struct hostent* KernelProxy::gethostbyname(const char* name) {
return host_resolver_.gethostbyname(name);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
index 0ac85407f1..78a8cf88d6 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.h
@@ -67,7 +67,7 @@ class KernelProxy : protected KernelObject {
virtual int open_resource(const char* file);
// KernelHandle and FD allocation and manipulation functions.
- virtual int open(const char* path, int open_flags);
+ virtual int open(const char* path, int open_flags, mode_t mode);
virtual int close(int fd);
virtual int dup(int fd);
virtual int dup2(int fd, int newfd);
@@ -89,7 +89,6 @@ class KernelProxy : protected KernelObject {
virtual int chown(const char* path, uid_t owner, gid_t group);
virtual int fchown(int fd, uid_t owner, gid_t group);
virtual int lchown(const char* path, uid_t owner, gid_t group);
- virtual int utime(const char* filename, const struct utimbuf* times);
// System calls that take a path as an argument: The kernel proxy will look
// for the Node associated to the path. To find the node, the kernel proxy
@@ -108,7 +107,7 @@ class KernelProxy : protected KernelObject {
virtual ssize_t read(int fd, void* buf, size_t nbyte);
virtual ssize_t write(int fd, const void* buf, size_t nbyte);
- virtual int fchmod(int fd, int prot);
+ virtual int fchmod(int fd, mode_t mode);
virtual int fcntl(int fd, int request, va_list args);
virtual int fstat(int fd, struct stat* buf);
virtual int getdents(int fd, void* buf, unsigned int count);
@@ -118,6 +117,7 @@ class KernelProxy : protected KernelObject {
virtual int fdatasync(int fd);
virtual int isatty(int fd);
virtual int ioctl(int fd, int request, va_list args);
+ virtual int futimens(int fd, const struct timespec times[2]);
// lseek() relies on the filesystem's Stat() to determine whether or not the
// file handle corresponding to fd is a directory
@@ -135,7 +135,7 @@ class KernelProxy : protected KernelObject {
// access() uses the Filesystem's Stat().
virtual int access(const char* path, int amode);
virtual int readlink(const char* path, char* buf, size_t count);
- virtual int utimes(const char* filename, const struct timeval times[2]);
+ virtual int utimens(const char* path, const struct timespec times[2]);
virtual int link(const char* oldpath, const char* newpath);
virtual int symlink(const char* oldpath, const char* newpath);
@@ -177,6 +177,13 @@ class KernelProxy : protected KernelObject {
const char* service,
const struct addrinfo* hints,
struct addrinfo** res);
+ virtual int getnameinfo(const struct sockaddr *sa,
+ socklen_t salen,
+ char *host,
+ size_t hostlen,
+ char *serv,
+ size_t servlen,
+ int flags);
virtual int getpeername(int fd, struct sockaddr* addr, socklen_t* len);
virtual int getsockname(int fd, struct sockaddr* addr, socklen_t* len);
virtual int getsockopt(int fd,
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
index ee7bf373d3..b60636717a 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
@@ -116,7 +116,7 @@ extern int stat(const char* path, struct stat* buf) NOTHROW;
int symlink(const char* oldpath, const char* newpath) NOTHROW;
int umount(const char* path) NOTHROW;
int NAME(unlink)(const char* path) NOTHROW;
-int utime(const char* filename, const struct utimbuf* times);
+int utime(const char* filename, const struct utimbuf* times) NOTHROW;
read_ssize_t NAME(write)(int fd, const void* buf, size_t nbyte);
#ifdef PROVIDES_SOCKET_API
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc
index 271aa6eef0..621e0bd5e9 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc
@@ -264,8 +264,8 @@ int WRAP(munmap)(void* addr, size_t length) {
return REAL(munmap)(addr, length);
}
-int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) {
- *newfd = ki_open(pathname, oflag);
+int WRAP(open)(const char* pathname, int oflag, mode_t mode, int* newfd) {
+ *newfd = ki_open(pathname, oflag, mode);
ERRNO_RTN(*newfd);
}
@@ -338,13 +338,11 @@ static void assign_real_pointers() {
}
#define CHECK_REAL(func) \
- if (!REAL(func)) \
- assign_real_pointers();
-
-#define CHECK_REAL_NOSYS(func) \
- CHECK_REAL(func) \
- if (!REAL(func)) \
- return ENOSYS;
+ if (!REAL(func)) { \
+ assign_real_pointers(); \
+ if (!REAL(func)) \
+ return ENOSYS; \
+ }
// "real" functions, i.e. the unwrapped original functions.
@@ -436,7 +434,7 @@ int _real_lseek(int fd, int64_t offset, int whence, int64_t* new_offset) {
int _real_lstat(const char* path, struct stat* buf) {
struct nacl_abi_stat st;
- CHECK_REAL(fstat);
+ CHECK_REAL(lstat);
int err = REAL(lstat)(path, (struct stat*)&st);
if (err) {
@@ -468,9 +466,9 @@ int _real_munmap(void* addr, size_t length) {
return REAL(munmap)(addr, length);
}
-int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) {
+int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) {
CHECK_REAL(open);
- return REAL(open)(pathname, oflag, cmode, newfd);
+ return REAL(open)(pathname, oflag, mode, newfd);
}
int _real_open_resource(const char* file, int* fd) {
@@ -504,7 +502,7 @@ int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
}
int _real_getcwd(char* pathname, size_t len) {
- CHECK_REAL_NOSYS(getcwd);
+ CHECK_REAL(getcwd);
return REAL(getcwd)(pathname, len);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc
index c384e3b7c2..c4d0df8607 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc
@@ -48,7 +48,7 @@ int _real_munmap(void* addr, size_t length) {
return ENOSYS;
}
-int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) {
+int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) {
return ENOSYS;
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
index 0cc3e9045f..308a0929ba 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc
@@ -25,6 +25,7 @@
#include "nacl_io/kernel_wrap_real.h"
#include "nacl_io/log.h"
#include "nacl_io/osmman.h"
+#include "nacl_io/ostime.h"
namespace {
@@ -41,8 +42,11 @@ void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) {
nacl_buf->nacl_abi_st_blksize = buf->st_blksize;
nacl_buf->nacl_abi_st_blocks = buf->st_blocks;
nacl_buf->nacl_abi_st_atime = buf->st_atime;
+ nacl_buf->nacl_abi_st_atimensec = buf->st_atimensec;
nacl_buf->nacl_abi_st_mtime = buf->st_mtime;
+ nacl_buf->nacl_abi_st_mtimensec = buf->st_mtimensec;
nacl_buf->nacl_abi_st_ctime = buf->st_ctime;
+ nacl_buf->nacl_abi_st_ctimensec = buf->st_ctimensec;
}
void nacl_stat_to_stat(const nacl_abi_stat* nacl_buf, struct stat* buf) {
@@ -58,8 +62,11 @@ void nacl_stat_to_stat(const nacl_abi_stat* nacl_buf, struct stat* buf) {
buf->st_blksize = nacl_buf->nacl_abi_st_blksize;
buf->st_blocks = nacl_buf->nacl_abi_st_blocks;
buf->st_atime = nacl_buf->nacl_abi_st_atime;
+ buf->st_atimensec = nacl_buf->nacl_abi_st_atimensec;
buf->st_mtime = nacl_buf->nacl_abi_st_mtime;
+ buf->st_mtimensec = nacl_buf->nacl_abi_st_mtimensec;
buf->st_ctime = nacl_buf->nacl_abi_st_ctime;
+ buf->st_ctimensec = nacl_buf->nacl_abi_st_ctimensec;
}
} // namespace
@@ -272,8 +279,8 @@ int WRAP(munmap)(void* addr, size_t length) {
return REAL(munmap)(addr, length);
}
-int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) {
- *newfd = ki_open(pathname, oflag);
+int WRAP(open)(const char* pathname, int oflag, mode_t mode, int* newfd) {
+ *newfd = ki_open(pathname, oflag, mode);
RTN_ERRNO_IF(*newfd < 0);
return 0;
}
@@ -517,14 +524,12 @@ static void assign_real_pointers() {
}
}
-#define CHECK_REAL(func) \
- if (!REAL(func)) \
- assign_real_pointers();
-
-#define CHECK_REAL_NOSYS(func) \
- CHECK_REAL(func) \
- if (!REAL(func)) \
- return ENOSYS;
+#define CHECK_REAL(func) \
+ if (!REAL(func)) { \
+ assign_real_pointers(); \
+ if (!REAL(func)) \
+ return ENOSYS; \
+ }
// "real" functions, i.e. the unwrapped original functions.
@@ -534,7 +539,8 @@ int _real_close(int fd) {
}
void _real_exit(int status) {
- CHECK_REAL(exit);
+ if (!REAL(exit))
+ assign_real_pointers();
REAL(exit)(status);
}
@@ -606,9 +612,9 @@ int _real_munmap(void* addr, size_t length) {
return REAL(munmap)(addr, length);
}
-int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) {
+int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) {
CHECK_REAL(open);
- return REAL(open)(pathname, oflag, cmode, newfd);
+ return REAL(open)(pathname, oflag, mode, newfd);
}
int _real_open_resource(const char* file, int* fd) {
@@ -632,7 +638,7 @@ int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
}
int _real_getcwd(char* pathname, size_t len) {
- CHECK_REAL_NOSYS(getcwd);
+ CHECK_REAL(getcwd);
return REAL(getcwd)(pathname, len);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc
index f560d3b125..fecd72f991 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_newlib.cc
@@ -185,8 +185,8 @@ int WRAP(munmap)(void* addr, size_t length) {
return REAL(munmap)(addr, length);
}
-int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) {
- *newfd = ki_open(pathname, oflag);
+int WRAP(open)(const char* pathname, int oflag, mode_t mode, int* newfd) {
+ *newfd = ki_open(pathname, oflag, mode);
ERRNO_RTN(*newfd);
}
@@ -269,13 +269,11 @@ static void assign_real_pointers() {
}
#define CHECK_REAL(func) \
- if (!REAL(func)) \
- assign_real_pointers();
-
-#define CHECK_REAL_NOSYS(func) \
- CHECK_REAL(func) \
- if (!REAL(func)) \
- return ENOSYS;
+ if (!REAL(func)) { \
+ assign_real_pointers(); \
+ if (!REAL(func)) \
+ return ENOSYS; \
+ }
// "real" functions, i.e. the unwrapped original functions.
@@ -285,7 +283,8 @@ int _real_close(int fd) {
}
void _real_exit(int status) {
- CHECK_REAL(exit);
+ if (!REAL(exit))
+ assign_real_pointers();
REAL(exit)(status);
}
@@ -335,9 +334,9 @@ int _real_munmap(void* addr, size_t length) {
return REAL(munmap)(addr, length);
}
-int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) {
+int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) {
CHECK_REAL(open);
- return REAL(open)(pathname, oflag, cmode, newfd);
+ return REAL(open)(pathname, oflag, mode, newfd);
}
int _real_open_resource(const char* file, int* fd) {
@@ -360,7 +359,7 @@ int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) {
}
int _real_getcwd(char* pathname, size_t len) {
- CHECK_REAL_NOSYS(getcwd);
+ CHECK_REAL(getcwd);
return REAL(getcwd)(pathname, len);
}
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h
index 3dd9297020..86b65e4544 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h
@@ -26,7 +26,7 @@ int _real_mmap(void** addr,
int fd,
int64_t offset);
int _real_munmap(void* addr, size_t length);
-int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd);
+int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd);
int _real_open_resource(const char* file, int* fd);
int _real_read(int fd, void* buf, size_t count, size_t* nread);
int _real_rmdir(const char* pathname);
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_win.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_win.cc
index d6177881b1..18c903dba8 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_win.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_win.cc
@@ -129,9 +129,6 @@ int _mkdir(const char* path) {
}
int _open(const char* path, int oflag, ...) {
-#if 0
- // TODO(binji): ki_open should use the pmode parameter. When it does, this
- // will be necessary to add in.
va_list list;
int pmode = 0;
if (oflag & _O_CREAT) {
@@ -139,8 +136,7 @@ int _open(const char* path, int oflag, ...) {
pmode = va_arg(list, int);
va_end(list);
}
-#endif
- return ki_open(path, oflag);
+ return ki_open(path, oflag, (mode_t) pmode);
}
int _sopen(const char* path, int oflag, int shflag) {
diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc
index 599c789b5f..9493dfb21c 100644
--- a/native_client_sdk/src/libraries/nacl_io/library.dsc
+++ b/native_client_sdk/src/libraries/nacl_io/library.dsc
@@ -65,68 +65,70 @@
"stream/stream_event_emitter.cc",
"stream/stream_fs.cc",
"stream/stream_node.cc",
- "syscalls/accept.c",
"syscalls/access.c",
- "syscalls/bind.c",
"syscalls/cfgetispeed.c",
"syscalls/cfgetospeed.c",
"syscalls/cfsetispeed.c",
"syscalls/cfsetospeed.c",
"syscalls/cfsetspeed.c",
"syscalls/chown.c",
- "syscalls/connect.c",
"syscalls/fchown.c",
"syscalls/fcntl.c",
- "syscalls/freeaddrinfo.c",
"syscalls/ftruncate.c",
- "syscalls/gai_strerror.c",
- "syscalls/getaddrinfo.c",
+ "syscalls/futimes.c",
"syscalls/getcwd.c",
- "syscalls/gethostbyname.c",
- "syscalls/getpeername.c",
- "syscalls/getsockname.c",
- "syscalls/getsockopt.c",
"syscalls/getwd.c",
- "syscalls/herror.c",
- "syscalls/hstrerror.c",
- "syscalls/htonl.c",
- "syscalls/htons.c",
- "syscalls/inet_addr.c",
- "syscalls/inet_aton.c",
- "syscalls/inet_ntoa.c",
- "syscalls/inet_ntop.cc",
- "syscalls/inet_pton.c",
"syscalls/ioctl.c",
"syscalls/isatty.c",
"syscalls/kill.c",
"syscalls/killpg.c",
"syscalls/lchown.c",
- "syscalls/listen.c",
"syscalls/mount.c",
- "syscalls/ntohl.c",
- "syscalls/ntohs.c",
"syscalls/pipe.c",
"syscalls/poll.c",
"syscalls/realpath.c",
- "syscalls/recv.c",
- "syscalls/recvfrom.c",
- "syscalls/recvmsg.c",
"syscalls/remove.c",
"syscalls/rename.c",
"syscalls/select.c",
- "syscalls/send.c",
- "syscalls/sendmsg.c",
- "syscalls/sendto.c",
- "syscalls/setsockopt.c",
- "syscalls/shutdown.c",
"syscalls/sigaction.c",
"syscalls/signal.c",
"syscalls/sigpause.c",
"syscalls/sigpending.c",
"syscalls/sigset.c",
"syscalls/sigsuspend.c",
- "syscalls/socket.c",
- "syscalls/socketpair.c",
+ "syscalls/socket/accept.c",
+ "syscalls/socket/bind.c",
+ "syscalls/socket/connect.c",
+ "syscalls/socket/freeaddrinfo.c",
+ "syscalls/socket/gai_strerror.c",
+ "syscalls/socket/getaddrinfo.c",
+ "syscalls/socket/gethostbyname.c",
+ "syscalls/socket/getnameinfo.c",
+ "syscalls/socket/getpeername.c",
+ "syscalls/socket/getsockname.c",
+ "syscalls/socket/getsockopt.c",
+ "syscalls/socket/herror.c",
+ "syscalls/socket/hstrerror.c",
+ "syscalls/socket/htonl.c",
+ "syscalls/socket/htons.c",
+ "syscalls/socket/inet_addr.c",
+ "syscalls/socket/inet_aton.c",
+ "syscalls/socket/inet_ntoa.c",
+ "syscalls/socket/inet_ntop.cc",
+ "syscalls/socket/inet_pton.c",
+ "syscalls/socket/listen.c",
+ "syscalls/socket/ntohl.c",
+ "syscalls/socket/ntohs.c",
+ "syscalls/socket/recv.c",
+ "syscalls/socket/recvfrom.c",
+ "syscalls/socket/recvmsg.c",
+ "syscalls/socket/send.c",
+ "syscalls/socket/sendmsg.c",
+ "syscalls/socket/sendto.c",
+ "syscalls/socket/setsockopt.c",
+ "syscalls/socket/shutdown.c",
+ "syscalls/socket/socket.c",
+ "syscalls/socket/socketpair.c",
"syscalls/symlink.c",
"syscalls/tcdrain.c",
"syscalls/tcflow.c",
@@ -231,7 +233,9 @@
"sys/signal.h",
"sys/socket.h",
"sys/termios.h",
+ "sys/time.h",
"sys/utsname.h",
+ "utime.h",
],
'DEST': 'include/newlib',
},
@@ -250,7 +254,9 @@
"sys/select.h",
"sys/socket.h",
"sys/termios.h",
+ "sys/time.h",
"sys/utsname.h",
+ "utime.h",
],
'DEST': 'include/pnacl',
},
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc
index d29602d92f..118874dc18 100644
--- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.cc
@@ -75,24 +75,8 @@ Error MemFs::FindNode(const Path& path, int type, ScopedNode* out_node) {
return 0;
}
-Error MemFs::Access(const Path& path, int a_mode) {
- ScopedNode node;
- Error error = FindNode(path, 0, &node);
-
- if (error)
- return error;
-
- int obj_mode = node->GetMode();
- if (((a_mode & R_OK) && !(obj_mode & S_IREAD)) ||
- ((a_mode & W_OK) && !(obj_mode & S_IWRITE)) ||
- ((a_mode & X_OK) && !(obj_mode & S_IEXEC))) {
- return EACCES;
- }
-
- return 0;
-}
-
-Error MemFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
+Error MemFs::OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node) {
out_node->reset(NULL);
ScopedNode node;
@@ -112,6 +96,7 @@ Error MemFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
error = node->Init(open_flags);
if (error)
return error;
+ node->SetMode(mode);
error = parent->AddChild(path.Basename(), node);
if (error)
@@ -129,7 +114,7 @@ Error MemFs::Open(const Path& path, int open_flags, ScopedNode* out_node) {
return EEXIST;
if (open_flags & O_TRUNC)
- static_cast<MemFsNode*>(node.get())->Resize(0);
+ node->FTruncate(0);
}
*out_node = node;
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.h b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.h
index 6212b6e7e6..51ccc061be 100644
--- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.h
@@ -29,8 +29,8 @@ class MemFs : public Filesystem {
virtual Error FindNode(const Path& path, int type, ScopedNode* out_node);
public:
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int perm);
virtual Error Rmdir(const Path& path);
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
index 0040df3fae..8d2833289b 100644
--- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc
@@ -37,6 +37,7 @@ MemFsNode::MemFsNode(Filesystem* filesystem)
}
MemFsNode::~MemFsNode() {
+ free(data_);
}
Error MemFsNode::Read(const HandleAttr& attr,
@@ -95,26 +96,37 @@ Error MemFsNode::Resize(off_t new_length) {
return EINVAL;
size_t new_size = static_cast<size_t>(new_length);
+ size_t new_capacity = data_capacity_;
if (new_size > data_capacity_) {
// While the node size is small, grow exponentially. When it starts to get
// larger, grow linearly.
size_t extra = std::min(new_size, kMaxResizeIncrement);
- data_capacity_ = new_size + extra;
- } else {
- data_capacity_ = new_size;
+ new_capacity = new_size + extra;
+ } else if (new_length < stat_.st_size) {
+ // Shrinking capacity
+ new_capacity = new_size;
}
- data_ = (char*)realloc(data_, data_capacity_);
- if (data_capacity_ != 0) {
- assert(data_ != NULL);
- if (data_ == NULL)
- return ENOMEM;
- if (new_length > stat_.st_size)
- memset(data_ + stat_.st_size, 0, new_length - stat_.st_size);
+ if (new_capacity != data_capacity_) {
+ data_ = (char*)realloc(data_, new_capacity);
+ if (new_capacity != 0) {
+ assert(data_ != NULL);
+ if (data_ == NULL)
+ return ENOMEM;
+ }
+ data_capacity_ = new_capacity;
}
+ if (new_length > stat_.st_size)
+ memset(data_ + stat_.st_size, 0, new_length - stat_.st_size);
stat_.st_size = new_length;
return 0;
}
+Error MemFsNode::Fchmod(mode_t mode) {
+ AUTO_LOCK(node_lock_);
+ SetMode(mode);
+ return 0;
+}
+
} // namespace nacl_io
diff --git a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h
index 77a327a31f..100b3eca71 100644
--- a/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h
+++ b/native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.h
@@ -27,6 +27,7 @@ class MemFsNode : public Node {
size_t count,
int* out_bytes);
virtual Error FTruncate(off_t size);
+ virtual Error Fchmod(mode_t mode);
private:
Error Resize(off_t size);
diff --git a/native_client_sdk/src/libraries/nacl_io/nacl_io.cc b/native_client_sdk/src/libraries/nacl_io/nacl_io.cc
index 1459ab19f5..141c4d7a5d 100644
--- a/native_client_sdk/src/libraries/nacl_io/nacl_io.cc
+++ b/native_client_sdk/src/libraries/nacl_io/nacl_io.cc
@@ -8,12 +8,16 @@
#include "nacl_io/kernel_intercept.h"
#include "nacl_io/kernel_proxy.h"
-void nacl_io_init() {
- ki_init(NULL);
+int nacl_io_init() {
+ return ki_init(NULL);
}
-void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface) {
- ki_init_ppapi(NULL, instance, get_interface);
+int nacl_io_uninit() {
+ return ki_uninit();
+}
+
+int nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface) {
+ return ki_init_ppapi(NULL, instance, get_interface);
}
int nacl_io_register_fs_type(const char* fs_type, fuse_operations* fuse_ops) {
diff --git a/native_client_sdk/src/libraries/nacl_io/nacl_io.h b/native_client_sdk/src/libraries/nacl_io/nacl_io.h
index a26f39d8b5..c6ed472621 100644
--- a/native_client_sdk/src/libraries/nacl_io/nacl_io.h
+++ b/native_client_sdk/src/libraries/nacl_io/nacl_io.h
@@ -29,7 +29,7 @@ typedef void (*nacl_io_mount_callback_t)(const char* source,
* NOTE: If you initialize nacl_io with this constructor, you cannot
* use any filesystems that require PPAPI; e.g. persistent storage, etc.
*/
-void nacl_io_init();
+int nacl_io_init();
/**
* Initialize nacl_io with PPAPI support.
@@ -49,7 +49,15 @@ void nacl_io_init();
* |get_interface| can be retrieved via
* pp::Module::Get()->get_browser_interface()
*/
-void nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface);
+int nacl_io_init_ppapi(PP_Instance instance, PPB_GetInterface get_interface);
+
+/**
+ * Uninitialize nacl_io.
+ *
+ * This removes interception for POSIX C-library function and releases
+ * any associated resources.
+ */
+int nacl_io_uninit();
void nacl_io_set_exit_callback(nacl_io_exit_callback_t exit_callback,
void* user_data);
diff --git a/native_client_sdk/src/libraries/nacl_io/node.cc b/native_client_sdk/src/libraries/nacl_io/node.cc
index 373f96656e..b91726fb11 100644
--- a/native_client_sdk/src/libraries/nacl_io/node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/node.cc
@@ -176,6 +176,14 @@ Error Node::Tcsetattr(int optional_actions, const struct termios* termios_p) {
return EINVAL;
}
+Error Node::Futimens(const struct timespec times[2]) {
+ return 0;
+}
+
+Error Node::Fchmod(mode_t mode) {
+ return EINVAL;
+}
+
int Node::GetLinks() {
return stat_.st_nlink;
}
@@ -199,6 +207,12 @@ void Node::SetType(int type) {
stat_.st_mode |= type;
}
+void Node::SetMode(int mode) {
+ assert((mode & S_IFMT) == 0);
+ stat_.st_mode &= S_IFMT;
+ stat_.st_mode |= mode;
+}
+
bool Node::IsaDir() {
return GetType() == S_IFDIR;
}
diff --git a/native_client_sdk/src/libraries/nacl_io/node.h b/native_client_sdk/src/libraries/nacl_io/node.h
index ac311fd02d..8fb4ab97bd 100644
--- a/native_client_sdk/src/libraries/nacl_io/node.h
+++ b/native_client_sdk/src/libraries/nacl_io/node.h
@@ -89,9 +89,12 @@ class Node : public sdk_util::RefObject {
virtual Error Tcgetattr(struct termios* termios_p);
virtual Error Tcsetattr(int optional_actions,
const struct termios* termios_p);
+ virtual Error Futimens(const struct timespec times[2]);
+ virtual Error Fchmod(mode_t mode);
virtual int GetLinks();
virtual int GetMode();
+ virtual void SetMode(int mode);
virtual int GetType();
virtual void SetType(int type);
// Assume that |out_size| is non-NULL.
diff --git a/native_client_sdk/src/libraries/nacl_io/ostime.h b/native_client_sdk/src/libraries/nacl_io/ostime.h
index d3b52a51c4..e48ef22d64 100644
--- a/native_client_sdk/src/libraries/nacl_io/ostime.h
+++ b/native_client_sdk/src/libraries/nacl_io/ostime.h
@@ -19,6 +19,14 @@ int clock_settime(clockid_t clock_id, const struct timespec* tp);
#else
#include <time.h>
+#include <utime.h>
+#include <sys/time.h>
+
+#ifdef __GLIBC__
+#define st_atimensec st_atim.tv_nsec
+#define st_mtimensec st_mtim.tv_nsec
+#define st_ctimensec st_ctim.tv_nsec
+#endif
#endif
diff --git a/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc b/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc
index 93dbf18672..abee3894e8 100644
--- a/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.cc
@@ -22,15 +22,11 @@ Error PassthroughFs::Init(const FsInitArgs& args) {
void PassthroughFs::Destroy() {
}
-Error PassthroughFs::Access(const Path& path, int a_mode) {
- // There is no underlying 'access' syscall in NaCl. It just returns ENOSYS.
- return ENOSYS;
-}
-
-Error PassthroughFs::Open(const Path& path, int mode, ScopedNode* out_node) {
+Error PassthroughFs::OpenWithMode(const Path& path, int open_flags,
+ mode_t mode, ScopedNode* out_node) {
out_node->reset(NULL);
int real_fd;
- int error = _real_open(path.Join().c_str(), mode, 0666, &real_fd);
+ int error = _real_open(path.Join().c_str(), open_flags, mode, &real_fd);
if (error)
return error;
diff --git a/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.h b/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.h
index a26ca7118d..8c7c86e2ab 100644
--- a/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/passthroughfs/passthrough_fs.h
@@ -18,8 +18,8 @@ class PassthroughFs : public Filesystem {
virtual void Destroy();
public:
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int open_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error OpenResource(const Path& path, ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int perm);
diff --git a/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc b/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc
index 8f5ef61a89..703874fa60 100644
--- a/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.cc
@@ -84,11 +84,8 @@ StreamFs::~StreamFs() {
pthread_cond_destroy(&message_cond_);
}
-Error StreamFs::Access(const Path& path, int a_mode) {
- return EACCES;
-}
-
-Error StreamFs::Open(const Path& path, int o_flags, ScopedNode* out_node) {
+Error StreamFs::OpenWithMode(const Path& path, int o_flags, mode_t mode,
+ ScopedNode* out_node) {
return EACCES;
}
diff --git a/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.h b/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.h
index 28e1ddadfc..d9f77c78e1 100644
--- a/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.h
+++ b/native_client_sdk/src/libraries/nacl_io/stream/stream_fs.h
@@ -54,8 +54,8 @@ class StreamFs : public Filesystem {
// of a MountSocketWork object.
static PP_CompletionCallback GetRunCompletion(Work* work);
- virtual Error Access(const Path& path, int a_mode);
- virtual Error Open(const Path& path, int o_flags, ScopedNode* out_node);
+ virtual Error OpenWithMode(const Path& path, int o_flags, mode_t mode,
+ ScopedNode* out_node);
virtual Error Unlink(const Path& path);
virtual Error Mkdir(const Path& path, int permissions);
virtual Error Rmdir(const Path& path);
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/futimes.c b/native_client_sdk/src/libraries/nacl_io/syscalls/futimes.c
new file mode 100644
index 0000000000..811474ea21
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/futimes.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include "nacl_io/kernel_intercept.h"
+#include "nacl_io/kernel_wrap.h"
+
+int futimes(int fd, const struct timeval times[2]) {
+ return ki_futimes(fd, times);
+}
+
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/accept.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/accept.c
index 1536cc824a..1536cc824a 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/accept.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/accept.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/bind.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/bind.c
index cb48d4c5d5..cb48d4c5d5 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/bind.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/bind.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/connect.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/connect.c
index 46f083fbea..46f083fbea 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/connect.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/connect.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/freeaddrinfo.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/freeaddrinfo.c
index b11993775d..b11993775d 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/freeaddrinfo.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/freeaddrinfo.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/gai_strerror.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/gai_strerror.c
index 265b1e0770..265b1e0770 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/gai_strerror.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/gai_strerror.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/getaddrinfo.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getaddrinfo.c
index 1433756fb9..1433756fb9 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/getaddrinfo.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getaddrinfo.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/gethostbyname.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/gethostbyname.c
index d370075e1b..d370075e1b 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/gethostbyname.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/gethostbyname.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getnameinfo.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getnameinfo.c
new file mode 100644
index 0000000000..78794ebcb7
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getnameinfo.c
@@ -0,0 +1,20 @@
+/* Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+#include "nacl_io/kernel_intercept.h"
+#include "nacl_io/kernel_wrap.h"
+
+#ifdef __native_client__
+#ifdef __BIONIC__
+// bionic has a slightly different signatute to glibc for getnameinfo
+int getnameinfo(const struct sockaddr* sa, socklen_t salen, char* host,
+ size_t hostlen, char* serv, size_t servlen, int flags) {
+#else
+int getnameinfo(const struct sockaddr* sa, socklen_t salen, char* host,
+ socklen_t hostlen, char* serv, socklen_t servlen,
+ unsigned int flags) {
+#endif
+ return ki_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
+}
+#endif
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/getpeername.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getpeername.c
index c700e692cb..c700e692cb 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/getpeername.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getpeername.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/getsockname.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getsockname.c
index 6f9d1ee196..6f9d1ee196 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/getsockname.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getsockname.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/getsockopt.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getsockopt.c
index c5ef7f7bbb..c5ef7f7bbb 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/getsockopt.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/getsockopt.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/herror.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/herror.c
index 01bcd91bf1..01bcd91bf1 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/herror.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/herror.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/hstrerror.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/hstrerror.c
index 2c7aad2d0e..2c7aad2d0e 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/hstrerror.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/hstrerror.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/htonl.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/htonl.c
index d0f5f108f1..d0f5f108f1 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/htonl.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/htonl.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/htons.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/htons.c
index 74e550c7c1..74e550c7c1 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/htons.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/htons.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_addr.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_addr.c
index 98dbe8f94c..98dbe8f94c 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_addr.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_addr.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_aton.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_aton.c
index 7c4542b9d2..7c4542b9d2 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_aton.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_aton.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntoa.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_ntoa.c
index 4f78f21db4..4f78f21db4 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntoa.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_ntoa.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_ntop.cc
index 4eaf0efd3a..4eaf0efd3a 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_ntop.cc
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_ntop.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_pton.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_pton.c
index 3a74afdde4..3a74afdde4 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/inet_pton.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_pton.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/listen.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/listen.c
index 06f7d0cd30..06f7d0cd30 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/listen.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/listen.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/ntohl.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/ntohl.c
index c7b6369c40..c7b6369c40 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/ntohl.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/ntohl.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/ntohs.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/ntohs.c
index af0875930c..af0875930c 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/ntohs.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/ntohs.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/recv.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/recv.c
index c22c0e4f0f..c22c0e4f0f 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/recv.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/recv.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/recvfrom.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvfrom.c
index 1cacabcb4e..1cacabcb4e 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/recvfrom.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvfrom.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/recvmsg.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvmsg.c
index d165b167f2..d165b167f2 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/recvmsg.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvmsg.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/send.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/send.c
index 92a367cc57..92a367cc57 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/send.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/send.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/sendmsg.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/sendmsg.c
index 830d43c399..830d43c399 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/sendmsg.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/sendmsg.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/sendto.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/sendto.c
index 03c62427af..03c62427af 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/sendto.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/sendto.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/setsockopt.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/setsockopt.c
index e273a411ed..e273a411ed 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/setsockopt.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/setsockopt.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/shutdown.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/shutdown.c
index e6e213b6f0..e6e213b6f0 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/shutdown.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/shutdown.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/socket.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/socket.c
index 3c1dad7ce0..3c1dad7ce0 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/socket.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/socket.c
diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/socketpair.c b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/socketpair.c
index 1e7a4d7074..1e7a4d7074 100644
--- a/native_client_sdk/src/libraries/nacl_io/syscalls/socketpair.c
+++ b/native_client_sdk/src/libraries/nacl_io/syscalls/socket/socketpair.c
diff --git a/native_client_sdk/src/libraries/ppapi/library.dsc b/native_client_sdk/src/libraries/ppapi/library.dsc
index b213395ae3..cdafc890e1 100644
--- a/native_client_sdk/src/libraries/ppapi/library.dsc
+++ b/native_client_sdk/src/libraries/ppapi/library.dsc
@@ -100,6 +100,7 @@
'ppb_file_chooser_dev.h',
'ppb_font_dev.h',
'ppb_memory_dev.h',
+ 'ppb_messaging_deprecated.h',
'ppb_opengles2ext_dev.h',
'ppb_printing_dev.h',
'ppb_trace_event_dev.h',
diff --git a/native_client_sdk/src/libraries/ppapi_cpp/library.dsc b/native_client_sdk/src/libraries/ppapi_cpp/library.dsc
index 1ca014e6c2..a72b23d1e5 100644
--- a/native_client_sdk/src/libraries/ppapi_cpp/library.dsc
+++ b/native_client_sdk/src/libraries/ppapi_cpp/library.dsc
@@ -114,6 +114,7 @@
'logging.h',
'media_stream_audio_track.h',
'media_stream_video_track.h',
+ 'message_handler.h',
'message_loop.h',
'module_embedder.h',
'module.h',
diff --git a/native_client_sdk/src/libraries/ppapi_simple/ps.h b/native_client_sdk/src/libraries/ppapi_simple/ps.h
index fdc1c10d1a..1e345af89d 100644
--- a/native_client_sdk/src/libraries/ppapi_simple/ps.h
+++ b/native_client_sdk/src/libraries/ppapi_simple/ps.h
@@ -1,6 +1,6 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
#ifndef PPAPI_SIMPLE_PS_H_
#define PPAPI_SIMPLE_PS_H_
@@ -45,7 +45,6 @@ EXTERN_C_BEGIN
*/
PP_Instance PSGetInstanceId(void);
-
/**
* PSGetInterface
*
@@ -54,7 +53,6 @@ PP_Instance PSGetInstanceId(void);
*/
const void* PSGetInterface(const char *name);
-
/**
* PSUserCreateInstance
*
@@ -67,20 +65,6 @@ const void* PSGetInterface(const char *name);
*/
extern void* PSUserCreateInstance(PP_Instance inst);
-
-/**
- * PPAPI_SIMPLE_USE_MAIN
- *
- * For use with C projects, this macro calls the provided factory with
- * configuration information.
- */
-#define PPAPI_SIMPLE_USE_MAIN(factory, func) \
-void* PSUserCreateInstance(PP_Instance inst) { \
- return factory(inst, func); \
-}
-
-
EXTERN_C_END
-
-#endif // PPAPI_SIMPLE_PS_H_
+#endif /* PPAPI_SIMPLE_PS_H_ */
diff --git a/native_client_sdk/src/libraries/ppapi_simple/ps_instance.h b/native_client_sdk/src/libraries/ppapi_simple/ps_instance.h
index c2a3304ea9..21209d13e5 100644
--- a/native_client_sdk/src/libraries/ppapi_simple/ps_instance.h
+++ b/native_client_sdk/src/libraries/ppapi_simple/ps_instance.h
@@ -214,4 +214,4 @@ class PSInstance : public pp::Instance, pp::MouseLock, pp::Graphics3DClient {
char* exit_message_;
};
-#endif // PPAPI_MAIN_PS_INSTANCE_H_
+#endif // PPAPI_SIMPLE_PS_INSTANCE_H_
diff --git a/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc b/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc
index eabbeaace6..8ab1213e53 100644
--- a/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc
+++ b/native_client_sdk/src/libraries/ppapi_simple/ps_main.cc
@@ -2,15 +2,48 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifdef __native_client__
+#include <irt.h>
+#include <irt_ppapi.h>
+#endif
+
+#include <stdio.h>
+
+#include "nacl_io/nacl_io.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h"
-
#include "ppapi_simple/ps_instance.h"
#include "ppapi_simple/ps_main.h"
+extern "C" int PpapiPluginMain();
-void* PSMainCreate(PP_Instance inst, PSMainFunc_t func) {
+void* PSMainCreate(PP_Instance inst, PSMainFunc_t entry_point) {
PSInstance* pInst = new PSInstance(inst);
- pInst->SetMain(func);
+ pInst->SetMain(entry_point);
return pInst;
}
+
+/**
+ * main entry point for ppapi_simple applications. This differs from the
+ * regular ppapi main entry point in that it will fall back to running
+ * the user's main code in the case that the PPAPI hooks are not found.
+ * This allows ppapi_simple binary to run within chrome (with PPAPI present)
+ * and also under sel_ldr (no PPAPI).
+ */
+#ifdef __native_client__
+extern "C" int __nacl_main(int argc, char* argv[]) {
+ struct nacl_irt_ppapihook hooks;
+ if (nacl_interface_query(NACL_IRT_PPAPIHOOK_v0_1, &hooks, sizeof(hooks)) ==
+ sizeof(hooks)) {
+ return PpapiPluginMain();
+ }
+#else
+int main(int argc, char* argv[]) {
+#endif
+ // By default, or if not running in the browser we simply run the main
+ // entry point directly, on the main thread.
+ nacl_io_init();
+ int rtn = PSUserMainGet()(argc, argv);
+ nacl_io_uninit();
+ return rtn;
+}
diff --git a/native_client_sdk/src/libraries/ppapi_simple/ps_main.h b/native_client_sdk/src/libraries/ppapi_simple/ps_main.h
index c269d3abaa..2b42ac45b0 100644
--- a/native_client_sdk/src/libraries/ppapi_simple/ps_main.h
+++ b/native_client_sdk/src/libraries/ppapi_simple/ps_main.h
@@ -18,8 +18,16 @@ typedef int (*PSMainFunc_t)(int argc, char *argv[]);
* Constructs an instance SimpleInstance and configures it to call into
* the provided "main" function.
*/
-void* PSMainCreate(PP_Instance inst, PSMainFunc_t func);
+void* PSMainCreate(PP_Instance inst, PSMainFunc_t entry_point);
+/**
+ * PSUserMainGet
+ *
+ * Prototype for the user provided function which retrieves the user's main
+ * function.
+ * This is normally defined using the PPAPI_SIMPLE_REGISTER_MAIN macro.
+ */
+PSMainFunc_t PSUserMainGet();
/**
* PPAPI_SIMPLE_REGISTER_MAIN
@@ -27,8 +35,13 @@ void* PSMainCreate(PP_Instance inst, PSMainFunc_t func);
* Constructs a PSInstance object and configures it to use call the provided
* 'main' function on its own thread once initialization is complete.
*/
-#define PPAPI_SIMPLE_REGISTER_MAIN(main) \
- PPAPI_SIMPLE_USE_MAIN(PSMainCreate, main)
+#define PPAPI_SIMPLE_REGISTER_MAIN(main_func) \
+ PSMainFunc_t PSUserMainGet() { \
+ return main_func; \
+ } \
+ void* PSUserCreateInstance(PP_Instance inst) { \
+ return PSMainCreate(inst, main_func); \
+ }
EXTERN_C_END
diff --git a/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium b/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium
index 87702bed1d..9c527b53bf 100644
--- a/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium
+++ b/native_client_sdk/src/libraries/third_party/newlib-extras/README.chromium
@@ -28,3 +28,4 @@ Local Modifications:
* Added SOCK_CLOEXEC and SOCK_NONBLOCK socket type flags.
* Make sure SA_SIGINFO is defined under __native_client__
* Removed ss_len field from sockaddr_storage in sys/socket.h.
+* Added _ALIGNBYTES and _ALIGN() in sys/socket.h.
diff --git a/native_client_sdk/src/libraries/third_party/newlib-extras/sys/select.h b/native_client_sdk/src/libraries/third_party/newlib-extras/sys/select.h
index f0595fdad0..9aa755db4a 100644
--- a/native_client_sdk/src/libraries/third_party/newlib-extras/sys/select.h
+++ b/native_client_sdk/src/libraries/third_party/newlib-extras/sys/select.h
@@ -6,15 +6,13 @@
#include <sys/types.h>
#include <time.h>
-#include "sdk_util/macros.h"
-
-EXTERN_C_BEGIN
+__BEGIN_DECLS
int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout) __THROW;
-EXTERN_C_END
+__END_DECLS
#endif /* sys/select.h */
diff --git a/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h b/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
index b7555faed3..86c687e4d5 100644
--- a/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
+++ b/native_client_sdk/src/libraries/third_party/newlib-extras/sys/socket.h
@@ -59,7 +59,7 @@ typedef _BSD_SA_FAMILY_T_ sa_family_t;
typedef _BSD_SOCKLEN_T_ socklen_t;
#undef _BSD_SOCKLEN_T_
#endif
-
+
/*
* Types
*/
@@ -355,6 +355,18 @@ struct cmsgcred {
gid_t cmcred_groups[CMGROUP_MAX]; /* groups */
};
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#ifndef _ALIGNBYTES
+#define _ALIGNBYTES (sizeof(int) - 1)
+#endif
+#ifndef _ALIGN
+#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
+#endif
+
/* given pointer to struct cmsghdr, return pointer to data */
#define CMSG_DATA(cmsg) ((unsigned char *)(cmsg) + \
_ALIGN(sizeof(struct cmsghdr)))
@@ -370,7 +382,7 @@ struct cmsgcred {
#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
/* RFC 2292 additions */
-
+
#define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))
#define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l))
diff --git a/native_client_sdk/src/resources/Makefile.example.template b/native_client_sdk/src/resources/Makefile.example.template
index ca1605fd2e..3d6ceb0203 100644
--- a/native_client_sdk/src/resources/Makefile.example.template
+++ b/native_client_sdk/src/resources/Makefile.example.template
@@ -47,18 +47,8 @@ CHROME_ARGS += --allow-nacl-socket-api=localhost
[[]]
TARGET = {{targets[0]['NAME']}}
-[[if sel_ldr and targets[0].get('SEL_LDR_LIBS'):]]
-ifdef SEL_LDR
-[[ ExpandDict('DEPS', targets[0].get('SEL_LDR_DEPS', []))]]
-[[ ExpandDict('LIBS', targets[0].get('SEL_LDR_LIBS', []))]]
-else
-[[ ExpandDict('DEPS', targets[0].get('DEPS', []))]]
-[[ ExpandDict('LIBS', targets[0].get('LIBS', []))]]
-endif
-[[else:]]
-[[ ExpandDict('DEPS', targets[0].get('DEPS', []))]]
-[[ ExpandDict('LIBS', targets[0].get('LIBS', []))]]
-[[]]
+[[ExpandDict('DEPS', targets[0].get('DEPS', []))]]
+[[ExpandDict('LIBS', targets[0].get('LIBS', []))]]
[[for target in targets:]]
[[ source_list = (s for s in sorted(target['SOURCES']) if not s.endswith('.h'))]]
diff --git a/native_client_sdk/src/test_all.py b/native_client_sdk/src/test_all.py
index 9f468b413c..6f2113a79e 100755
--- a/native_client_sdk/src/test_all.py
+++ b/native_client_sdk/src/test_all.py
@@ -30,6 +30,7 @@ EXTRACT_PACKAGES = ['nacl_x86_glibc']
TOOLCHAIN_OUT = os.path.join(build_paths.OUT_DIR, 'sdk_tests', 'toolchain')
TEST_MODULES = [
+ 'build_version_test',
'create_html_test',
'create_nmf_test',
'easy_template_test',
diff --git a/native_client_sdk/src/tests/nacl_io_socket_test/main.cc b/native_client_sdk/src/tests/nacl_io_socket_test/main.cc
index ef7b09433a..61066a250a 100644
--- a/native_client_sdk/src/tests/nacl_io_socket_test/main.cc
+++ b/native_client_sdk/src/tests/nacl_io_socket_test/main.cc
@@ -5,16 +5,6 @@
#include <string>
#include "gtest/gtest.h"
-
-#if defined(SEL_LDR)
-
-int main(int argc, char* argv[]) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-#else
-
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/var.h"
#include "ppapi_simple/ps_main.h"
@@ -54,13 +44,13 @@ class GTestEventListener : public ::testing::EmptyTestEventListener {
int example_main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
- ::testing::UnitTest::GetInstance()->listeners()
- .Append(new GTestEventListener());
+ if (PSGetInstanceId() != 0) {
+ ::testing::UnitTest::GetInstance()->listeners()
+ .Append(new GTestEventListener());
+ }
return RUN_ALL_TESTS();
}
// Register the function to call once the Instance Object is initialized.
// see: pappi_simple/ps_main.h
PPAPI_SIMPLE_REGISTER_MAIN(example_main);
-
-#endif
diff --git a/native_client_sdk/src/tests/nacl_io_test/dev_fs_for_testing.h b/native_client_sdk/src/tests/nacl_io_test/dev_fs_for_testing.h
index a898a12641..b16c215332 100644
--- a/native_client_sdk/src/tests/nacl_io_test/dev_fs_for_testing.h
+++ b/native_client_sdk/src/tests/nacl_io_test/dev_fs_for_testing.h
@@ -20,6 +20,15 @@ class DevFsForTesting : public nacl_io::DevFs {
Init(args);
}
+ bool Exists(const char* filename) {
+ nacl_io::ScopedNode node;
+ if (Open(nacl_io::Path(filename), O_RDONLY, &node))
+ return false;
+
+ struct stat buf;
+ return node->GetStat(&buf) == 0;
+ }
+
int num_nodes() { return (int)inode_pool_.size(); }
};
diff --git a/native_client_sdk/src/tests/nacl_io_test/event_test.cc b/native_client_sdk/src/tests/nacl_io_test/event_test.cc
index b450f3c860..8084df0732 100644
--- a/native_client_sdk/src/tests/nacl_io_test/event_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/event_test.cc
@@ -273,8 +273,8 @@ TEST_F(SelectPollTest, PollMemPipe) {
int fds[2];
// Both FDs for regular files should be read/write but not exception.
- fds[0] = kp->open("/test.txt", O_CREAT | O_WRONLY);
- fds[1] = kp->open("/test.txt", O_RDONLY);
+ fds[0] = kp->open("/test.txt", O_CREAT | O_WRONLY, 0777);
+ fds[1] = kp->open("/test.txt", O_RDONLY, 0);
ASSERT_GT(fds[0], -1);
ASSERT_GT(fds[1], -1);
@@ -302,8 +302,8 @@ TEST_F(SelectPollTest, SelectMemPipe) {
int fds[2];
// Both FDs for regular files should be read/write but not exception.
- fds[0] = kp->open("/test.txt", O_CREAT | O_WRONLY);
- fds[1] = kp->open("/test.txt", O_RDONLY);
+ fds[0] = kp->open("/test.txt", O_CREAT | O_WRONLY, 0777);
+ fds[1] = kp->open("/test.txt", O_RDONLY, 0);
ASSERT_GT(fds[0], -1);
ASSERT_GT(fds[1], -1);
SetFDs(fds, 2);
@@ -344,8 +344,8 @@ TEST_F(SelectPollTest, SelectPartialFdset) {
int fds[2];
// Both FDs for regular files should be read/write but not exception.
- fds[0] = kp->open("/test.txt", O_CREAT | O_WRONLY);
- fds[1] = kp->open("/test.txt", O_RDONLY);
+ fds[0] = kp->open("/test.txt", O_CREAT | O_WRONLY, 0777);
+ fds[1] = kp->open("/test.txt", O_RDONLY, 0);
ASSERT_GT(fds[0], -1);
ASSERT_GT(fds[1], -1);
ASSERT_LT(fds[1], 8);
diff --git a/native_client_sdk/src/tests/nacl_io_test/filesystem_test.cc b/native_client_sdk/src/tests/nacl_io_test/filesystem_test.cc
index 6089b01122..d9579917e2 100644
--- a/native_client_sdk/src/tests/nacl_io_test/filesystem_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/filesystem_test.cc
@@ -28,6 +28,15 @@ class MemFsForTesting : public MemFs {
EXPECT_EQ(0, Init(args));
}
+ bool Exists(const char* filename) {
+ ScopedNode node;
+ if (Open(Path(filename), O_RDONLY, &node))
+ return false;
+
+ struct stat buf;
+ return node->GetStat(&buf) == 0;
+ }
+
int num_nodes() { return (int)inode_pool_.size(); }
};
@@ -42,13 +51,13 @@ TEST(FilesystemTest, Sanity) {
off_t result_size = 0;
int result_bytes = 0;
+ struct stat buf;
char buf1[1024];
// A memory filesystem starts with one directory node: the root.
EXPECT_EQ(1, fs.num_nodes());
// Fail to open non existent file
- EXPECT_EQ(ENOENT, fs.Access(Path("/foo"), R_OK | W_OK));
EXPECT_EQ(ENOENT, fs.Open(Path("/foo"), O_RDWR, &result_node));
EXPECT_EQ(NULL, result_node.get());
EXPECT_EQ(1, fs.num_nodes());
@@ -59,14 +68,16 @@ TEST(FilesystemTest, Sanity) {
// We now have a directory and a file. The file has a two references
// one returned to the test, one for the name->inode map.
- EXPECT_EQ(2, fs.num_nodes());
- EXPECT_EQ(2, file->RefCount());
- EXPECT_EQ(0, fs.Access(Path("/foo"), R_OK | W_OK));
- EXPECT_EQ(EACCES, fs.Access(Path("/foo"), X_OK));
+ ASSERT_EQ(2, fs.num_nodes());
+ ASSERT_EQ(2, file->RefCount());
+ ASSERT_EQ(0, file->GetStat(&buf));
+ ASSERT_EQ(0, buf.st_mode & S_IXUSR);
// All access should be allowed on the root directory.
- EXPECT_EQ(0, fs.Access(Path("/"), R_OK | W_OK | X_OK));
- // Open the root directory for write should fail.
+ EXPECT_EQ(0, fs.Open(Path("/"), O_RDONLY, &root));
+ ASSERT_EQ(0, root->GetStat(&buf));
+ ASSERT_EQ(S_IRWXU, buf.st_mode & S_IRWXU);
+ // Opening a directory for write should fail.
EXPECT_EQ(EISDIR, fs.Open(Path("/"), O_RDWR, &root));
EXPECT_EQ(2, fs.num_nodes());
@@ -157,8 +168,7 @@ TEST(FilesystemTest, Sanity) {
EXPECT_EQ(1, fs.num_nodes());
// Verify the directory is gone
- EXPECT_EQ(ENOENT, fs.Access(Path("/foo"), F_OK));
- EXPECT_EQ(ENOENT, fs.Open(Path("/foo"), O_RDWR, &file));
+ EXPECT_EQ(ENOENT, fs.Open(Path("/foo"), O_RDONLY, &file));
EXPECT_EQ(NULL_NODE, file.get());
}
@@ -213,25 +223,25 @@ TEST(FilesystemTest, MemFsRename) {
ScopedNode file;
ASSERT_EQ(0, fs.Open(Path("/dir1/file"), O_RDWR | O_CREAT | O_EXCL, &file));
- ASSERT_EQ(0, fs.Access(Path("/dir1/file"), R_OK));
+ ASSERT_TRUE(fs.Exists("/dir1/file"));
ASSERT_EQ(4, fs.num_nodes());
// Move from one directory to another should ok
ASSERT_EQ(0, fs.Rename(Path("/dir1/file"), Path("/dir2/new_file")));
- ASSERT_NE(0, fs.Access(Path("/dir1/file"), R_OK));
- ASSERT_EQ(0, fs.Access(Path("/dir2/new_file"), R_OK));
+ ASSERT_FALSE(fs.Exists("/dir1/file"));
+ ASSERT_TRUE(fs.Exists("/dir2/new_file"));
ASSERT_EQ(4, fs.num_nodes());
// Move within the same directory
ASSERT_EQ(0, fs.Rename(Path("/dir2/new_file"), Path("/dir2/new_file2")));
- ASSERT_NE(0, fs.Access(Path("/dir2/new_file"), R_OK));
- ASSERT_EQ(0, fs.Access(Path("/dir2/new_file2"), R_OK));
+ ASSERT_FALSE(fs.Exists("/dir2/new_file"));
+ ASSERT_TRUE(fs.Exists("/dir2/new_file2"));
ASSERT_EQ(4, fs.num_nodes());
// Move to another directory but without a filename
ASSERT_EQ(0, fs.Rename(Path("/dir2/new_file2"), Path("/dir1")));
- ASSERT_NE(0, fs.Access(Path("/dir2/new_file2"), R_OK));
- ASSERT_EQ(0, fs.Access(Path("/dir1/new_file2"), R_OK));
+ ASSERT_FALSE(fs.Exists("/dir2/new_file2"));
+ ASSERT_TRUE(fs.Exists("/dir1/new_file2"));
ASSERT_EQ(4, fs.num_nodes());
}
@@ -244,8 +254,8 @@ TEST(FilesystemTest, MemFsRenameDir) {
// Renaming one directory to another should work
ASSERT_EQ(0, fs.Rename(Path("/dir1"), Path("/dir2")));
- ASSERT_NE(0, fs.Access(Path("/dir1"), R_OK));
- ASSERT_EQ(0, fs.Access(Path("/dir2"), R_OK));
+ ASSERT_FALSE(fs.Exists("/dir1"));
+ ASSERT_TRUE(fs.Exists("/dir2"));
EXPECT_EQ(2, fs.num_nodes());
// Reset to initial state
@@ -254,8 +264,8 @@ TEST(FilesystemTest, MemFsRenameDir) {
// Renaming a directory to a new name within another
ASSERT_EQ(0, fs.Rename(Path("/dir1"), Path("/dir2/foo")));
- ASSERT_EQ(0, fs.Access(Path("/dir2"), R_OK));
- ASSERT_EQ(0, fs.Access(Path("/dir2/foo"), R_OK));
+ ASSERT_TRUE(fs.Exists("/dir2"));
+ ASSERT_TRUE(fs.Exists("/dir2/foo"));
EXPECT_EQ(3, fs.num_nodes());
// Reset to initial state
@@ -273,7 +283,7 @@ TEST(FilesystemTest, DevAccess) {
FakePepperInterface pepper;
DevFsForTesting fs(&pepper);
ScopedNode invalid_node, valid_node;
- ASSERT_EQ(ENOENT, fs.Access(Path("/foo"), F_OK));
+ ASSERT_FALSE(fs.Exists("/foo"));
// Creating non-existent file should return EACCES
ASSERT_EQ(EACCES, fs.Open(Path("/foo"), O_CREAT | O_RDWR, &invalid_node));
@@ -295,11 +305,12 @@ TEST(FilesystemTest, DevNull) {
DevFsForTesting fs(&pepper);
ScopedNode dev_null;
int result_bytes = 0;
+ struct stat buf;
- ASSERT_EQ(0, fs.Access(Path("/null"), R_OK | W_OK));
- ASSERT_EQ(EACCES, fs.Access(Path("/null"), X_OK));
ASSERT_EQ(0, fs.Open(Path("/null"), O_RDWR, &dev_null));
ASSERT_NE(NULL_NODE, dev_null.get());
+ ASSERT_EQ(0, dev_null->GetStat(&buf));
+ ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU);
// Writing to /dev/null should write everything.
const char msg[] = "Dummy test message.";
@@ -319,11 +330,12 @@ TEST(FilesystemTest, DevZero) {
DevFsForTesting fs(&pepper);
ScopedNode dev_zero;
int result_bytes = 0;
+ struct stat buf;
- ASSERT_EQ(0, fs.Access(Path("/zero"), R_OK | W_OK));
- ASSERT_EQ(EACCES, fs.Access(Path("/zero"), X_OK));
ASSERT_EQ(0, fs.Open(Path("/zero"), O_RDWR, &dev_zero));
ASSERT_NE(NULL_NODE, dev_zero.get());
+ ASSERT_EQ(0, dev_zero->GetStat(&buf));
+ ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU);
// Writing to /dev/zero should write everything.
HandleAttr attrs;
@@ -350,11 +362,12 @@ TEST(FilesystemTest, DISABLED_DevUrandom) {
DevFsForTesting fs(&pepper);
ScopedNode dev_urandom;
int result_bytes = 0;
+ struct stat buf;
- ASSERT_EQ(0, fs.Access(Path("/urandom"), R_OK | W_OK));
- ASSERT_EQ(EACCES, fs.Access(Path("/urandom"), X_OK));
ASSERT_EQ(0, fs.Open(Path("/urandom"), O_RDWR, &dev_urandom));
ASSERT_NE(NULL_NODE, dev_urandom.get());
+ ASSERT_EQ(0, dev_urandom->GetStat(&buf));
+ ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU);
// Writing to /dev/urandom should write everything.
const char msg[] = "Dummy test message.";
diff --git a/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc b/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
index a75246d8f9..e0833ceecc 100644
--- a/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/fuse_fs_test.cc
@@ -14,6 +14,7 @@
#include "nacl_io/kernel_handle.h"
#include "nacl_io/kernel_intercept.h"
#include "nacl_io/kernel_proxy.h"
+#include "nacl_io/ostime.h"
using namespace nacl_io;
@@ -30,8 +31,12 @@ class FuseFsForTesting : public FuseFs {
// Implementation of a simple flat memory filesystem.
struct File {
+ File() : mode(0666) { memset(&times, 0, sizeof(times)); }
+
std::string name;
std::vector<uint8_t> data;
+ mode_t mode;
+ timespec times[2];
};
typedef std::vector<File> Files;
@@ -74,8 +79,12 @@ int testfs_getattr(const char* path, struct stat* stbuf) {
if (file == NULL)
return -ENOENT;
- stbuf->st_mode = S_IFREG | 0666;
+ stbuf->st_mode = S_IFREG | file->mode;
stbuf->st_size = file->data.size();
+ stbuf->st_atime = file->times[0].tv_sec;
+ stbuf->st_atimensec = file->times[0].tv_nsec;
+ stbuf->st_mtime = file->times[1].tv_sec;
+ stbuf->st_mtimensec = file->times[1].tv_nsec;
return 0;
}
@@ -95,7 +104,7 @@ int testfs_readdir(const char* path,
return 0;
}
-int testfs_create(const char* path, mode_t, struct fuse_file_info* fi) {
+int testfs_create(const char* path, mode_t mode, struct fuse_file_info* fi) {
if (!IsValidPath(path))
return -ENOENT;
@@ -108,6 +117,7 @@ int testfs_create(const char* path, mode_t, struct fuse_file_info* fi) {
file = &g_files.back();
file->name = &path[1]; // Skip initial /
}
+ file->mode = mode;
return 0;
}
@@ -158,32 +168,72 @@ int testfs_write(const char* path,
return size;
}
+int testfs_utimens(const char* path, const struct timespec times[2]) {
+ File* file = FindFile(path);
+ if (file == NULL)
+ return -ENOENT;
+
+ file->times[0] = times[0];
+ file->times[1] = times[1];
+ return 0;
+}
+
+int testfs_chmod(const char* path, mode_t mode) {
+ File* file = FindFile(path);
+ if (file == NULL)
+ return -ENOENT;
+
+ file->mode = mode;
+ return 0;
+}
+
const char hello_world[] = "Hello, World!\n";
fuse_operations g_fuse_operations = {
- 0, // flag_nopath
- 0, // flag_reserved
- NULL, // init
- NULL, // destroy
- NULL, // access
- testfs_create, // create
- NULL, // fgetattr
- NULL, // fsync
- NULL, // ftruncate
- testfs_getattr, // getattr
- NULL, // mkdir
- NULL, // mknod
- testfs_open, // open
- NULL, // opendir
- testfs_read, // read
- testfs_readdir, // readdir
- NULL, // release
- NULL, // releasedir
- NULL, // rename
- NULL, // rmdir
- NULL, // truncate
- NULL, // unlink
- testfs_write, // write
+ 0, // flag_nopath
+ 0, // flag_reserved
+ testfs_getattr, // getattr
+ NULL, // readlink
+ NULL, // mknod
+ NULL, // mkdir
+ NULL, // unlink
+ NULL, // rmdir
+ NULL, // symlink
+ NULL, // rename
+ NULL, // link
+ testfs_chmod, // chmod
+ NULL, // chown
+ NULL, // truncate
+ testfs_open, // open
+ testfs_read, // read
+ testfs_write, // write
+ NULL, // statfs
+ NULL, // flush
+ NULL, // release
+ NULL, // fsync
+ NULL, // setxattr
+ NULL, // getxattr
+ NULL, // listxattr
+ NULL, // removexattr
+ NULL, // opendir
+ testfs_readdir, // readdir
+ NULL, // releasedir
+ NULL, // fsyncdir
+ NULL, // init
+ NULL, // destroy
+ NULL, // access
+ testfs_create, // create
+ NULL, // ftruncate
+ NULL, // fgetattr
+ NULL, // lock
+ testfs_utimens, // utimens
+ NULL, // bmap
+ NULL, // ioctl
+ NULL, // poll
+ NULL, // write_buf
+ NULL, // read_buf
+ NULL, // flock
+ NULL, // fallocate
};
class FuseFsTest : public ::testing::Test {
@@ -222,9 +272,25 @@ TEST_F(FuseFsTest, OpenAndRead) {
int bytes_read = 0;
HandleAttr attr;
ASSERT_EQ(0, node->Read(attr, &buffer[0], sizeof(buffer), &bytes_read));
- // FUSE always fills the buffer (padding with \0) unless in direct_io mode.
- ASSERT_EQ(sizeof(buffer), bytes_read);
+ ASSERT_EQ(strlen(hello_world), bytes_read);
ASSERT_STREQ(hello_world, buffer);
+
+ // Try to read past the end of the file.
+ attr.offs = strlen(hello_world) - 7;
+ ASSERT_EQ(0, node->Read(attr, &buffer[0], sizeof(buffer), &bytes_read));
+ ASSERT_EQ(7, bytes_read);
+ ASSERT_STREQ("World!\n", buffer);
+}
+
+TEST_F(FuseFsTest, CreateWithMode) {
+ ScopedNode node;
+ struct stat statbuf;
+
+ ASSERT_EQ(0, fs_.OpenWithMode(Path("/hello"),
+ O_RDWR | O_CREAT, 0723, &node));
+ EXPECT_EQ(0, node->GetStat(&statbuf));
+ EXPECT_EQ(S_IFREG, statbuf.st_mode & S_IFMT);
+ EXPECT_EQ(0723, statbuf.st_mode & ~S_IFMT);
}
TEST_F(FuseFsTest, CreateAndWrite) {
@@ -241,8 +307,7 @@ TEST_F(FuseFsTest, CreateAndWrite) {
char buffer[40] = {0};
int bytes_read = 0;
ASSERT_EQ(0, node->Read(attr, &buffer[0], sizeof(buffer), &bytes_read));
- // FUSE always fills the buffer (padding with \0) unless in direct_io mode.
- ASSERT_EQ(sizeof(buffer), bytes_read);
+ ASSERT_EQ(strlen(message), bytes_read);
ASSERT_STREQ(message, buffer);
}
@@ -303,6 +368,40 @@ TEST_F(FuseFsTest, GetDents) {
EXPECT_STREQ("foobar", entries[3].d_name);
}
+TEST_F(FuseFsTest, Utimens) {
+ struct stat statbuf;
+ ScopedNode node;
+
+ struct timespec times[2];
+ times[0].tv_sec = 1000;
+ times[0].tv_nsec = 2000;
+ times[1].tv_sec = 3000;
+ times[1].tv_nsec = 4000;
+
+ ASSERT_EQ(0, fs_.Open(Path("/hello"), O_RDONLY, &node));
+ EXPECT_EQ(0, node->Futimens(times));
+
+ EXPECT_EQ(0, node->GetStat(&statbuf));
+ EXPECT_EQ(times[0].tv_sec, statbuf.st_atime);
+ EXPECT_EQ(times[0].tv_nsec, statbuf.st_atimensec);
+ EXPECT_EQ(times[1].tv_sec, statbuf.st_mtime);
+ EXPECT_EQ(times[1].tv_nsec, statbuf.st_mtimensec);
+}
+
+TEST_F(FuseFsTest, Fchmod) {
+ struct stat statbuf;
+ ScopedNode node;
+
+ ASSERT_EQ(0, fs_.Open(Path("/hello"), O_RDONLY, &node));
+ ASSERT_EQ(0, node->GetStat(&statbuf));
+ EXPECT_EQ(0666, statbuf.st_mode & ~S_IFMT);
+
+ ASSERT_EQ(0, node->Fchmod(0777));
+
+ ASSERT_EQ(0, node->GetStat(&statbuf));
+ EXPECT_EQ(0777, statbuf.st_mode & ~S_IFMT);
+}
+
namespace {
class KernelProxyFuseTest : public ::testing::Test {
@@ -337,19 +436,19 @@ void KernelProxyFuseTest::TearDown() {
TEST_F(KernelProxyFuseTest, Basic) {
// Write a file.
- int fd = ki_open("/hello", O_WRONLY | O_CREAT);
+ int fd = ki_open("/hello", O_WRONLY | O_CREAT, 0777);
ASSERT_GT(fd, -1);
ASSERT_EQ(sizeof(hello_world),
ki_write(fd, hello_world, sizeof(hello_world)));
EXPECT_EQ(0, ki_close(fd));
// Then read it back in.
- fd = ki_open("/hello", O_RDONLY);
+ fd = ki_open("/hello", O_RDONLY, 0);
ASSERT_GT(fd, -1);
char buffer[30];
memset(buffer, 0, sizeof(buffer));
- ASSERT_EQ(sizeof(buffer), ki_read(fd, buffer, sizeof(buffer)));
+ ASSERT_EQ(sizeof(hello_world), ki_read(fd, buffer, sizeof(buffer)));
EXPECT_STREQ(hello_world, buffer);
EXPECT_EQ(0, ki_close(fd));
}
diff --git a/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc b/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
index 883fdffd12..417249720e 100644
--- a/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc
@@ -48,6 +48,15 @@ class Html5FsForTesting : public Html5Fs {
Error error = Init(args);
EXPECT_EQ(expected_error, error);
}
+
+ bool Exists(const char* filename) {
+ ScopedNode node;
+ if (Open(Path(filename), O_RDONLY, &node))
+ return false;
+
+ struct stat buf;
+ return node->GetStat(&buf) == 0;
+ }
};
class Html5FsTest : public ::testing::Test {
@@ -143,7 +152,7 @@ TEST_F(Html5FsTest, PassFilesystemResource) {
ScopedRef<Html5FsForTesting> fs(
new Html5FsForTesting(map, &ppapi_));
- ASSERT_EQ(0, fs->Access(Path("/foo"), R_OK | W_OK | X_OK));
+ ASSERT_TRUE(fs->Exists("/foo"));
ppapi_html5_.GetCoreInterface()->ReleaseResource(filesystem);
}
@@ -156,18 +165,8 @@ TEST_F(Html5FsTest, MountSubtree) {
map["SOURCE"] = "/foo";
ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
- ASSERT_EQ(0, fs->Access(Path("/bar"), R_OK | W_OK | X_OK));
- ASSERT_EQ(ENOENT, fs->Access(Path("/foo/bar"), F_OK));
-}
-
-TEST_F(Html5FsTest, Access) {
- EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddEmptyFile("/foo", NULL));
-
- StringMap_t map;
- ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
-
- ASSERT_EQ(0, fs->Access(Path("/foo"), R_OK | W_OK | X_OK));
- ASSERT_EQ(ENOENT, fs->Access(Path("/bar"), F_OK));
+ ASSERT_TRUE(fs->Exists("/bar"));
+ ASSERT_FALSE(fs->Exists("/foo/bar"));
}
TEST_F(Html5FsTest, Mkdir) {
@@ -178,7 +177,7 @@ TEST_F(Html5FsTest, Mkdir) {
EXPECT_EQ(EEXIST, fs->Mkdir(Path("/"), 0644));
Path path("/foo");
- ASSERT_EQ(ENOENT, fs->Access(path, F_OK));
+ ASSERT_FALSE(fs->Exists("/foo"));
ASSERT_EQ(0, fs->Mkdir(path, 0644));
struct stat stat;
@@ -189,15 +188,16 @@ TEST_F(Html5FsTest, Mkdir) {
}
TEST_F(Html5FsTest, Remove) {
- EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddEmptyFile("/foo", NULL));
+ const char* kPath = "/foo";
+ EXPECT_TRUE(ppapi_html5_.filesystem_template()->AddEmptyFile(kPath, NULL));
StringMap_t map;
ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
- Path path("/foo");
- ASSERT_EQ(0, fs->Access(path, F_OK));
+ Path path(kPath);
+ ASSERT_TRUE(fs->Exists(kPath));
ASSERT_EQ(0, fs->Remove(path));
- EXPECT_EQ(ENOENT, fs->Access(path, F_OK));
+ EXPECT_FALSE(fs->Exists(kPath));
}
TEST_F(Html5FsTest, Unlink) {
@@ -207,10 +207,12 @@ TEST_F(Html5FsTest, Unlink) {
StringMap_t map;
ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
+ ASSERT_TRUE(fs->Exists("/dir"));
+ ASSERT_TRUE(fs->Exists("/file"));
+ ASSERT_EQ(0, fs->Unlink(Path("/file")));
ASSERT_EQ(EISDIR, fs->Unlink(Path("/dir")));
- EXPECT_EQ(0, fs->Unlink(Path("/file")));
- EXPECT_EQ(ENOENT, fs->Access(Path("/file"), F_OK));
- EXPECT_EQ(0, fs->Access(Path("/dir"), F_OK));
+ EXPECT_FALSE(fs->Exists("/file"));
+ EXPECT_TRUE(fs->Exists("/dir"));
}
TEST_F(Html5FsTest, Rmdir) {
@@ -222,8 +224,8 @@ TEST_F(Html5FsTest, Rmdir) {
ASSERT_EQ(ENOTDIR, fs->Rmdir(Path("/file")));
EXPECT_EQ(0, fs->Rmdir(Path("/dir")));
- EXPECT_EQ(ENOENT, fs->Access(Path("/dir"), F_OK));
- EXPECT_EQ(0, fs->Access(Path("/file"), F_OK));
+ EXPECT_FALSE(fs->Exists("/dir"));
+ EXPECT_TRUE(fs->Exists("/file"));
}
TEST_F(Html5FsTest, Rename) {
@@ -232,21 +234,19 @@ TEST_F(Html5FsTest, Rename) {
StringMap_t map;
ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
- Path path("/foo");
- Path newpath("/bar");
- ASSERT_EQ(0, fs->Access(path, F_OK));
- ASSERT_EQ(0, fs->Rename(path, newpath));
- EXPECT_EQ(ENOENT, fs->Access(path, F_OK));
- EXPECT_EQ(0, fs->Access(newpath, F_OK));
+ ASSERT_TRUE(fs->Exists("/foo"));
+ ASSERT_EQ(0, fs->Rename(Path("/foo"), Path("/bar")));
+ EXPECT_FALSE(fs->Exists("/foo"));
+ EXPECT_TRUE(fs->Exists("/bar"));
}
TEST_F(Html5FsTest, OpenForCreate) {
StringMap_t map;
ScopedRef<Html5FsForTesting> fs(new Html5FsForTesting(map, &ppapi_));
- Path path("/foo");
- EXPECT_EQ(ENOENT, fs->Access(path, F_OK));
+ EXPECT_FALSE(fs->Exists("/foo"));
+ Path path("/foo");
ScopedNode node;
ASSERT_EQ(0, fs->Open(path, O_CREAT | O_RDWR, &node));
@@ -389,8 +389,7 @@ TEST_F(Html5FsTest, GetStat) {
struct stat statbuf;
EXPECT_EQ(0, node->GetStat(&statbuf));
EXPECT_EQ(S_IFREG, statbuf.st_mode & S_IFMT);
- EXPECT_EQ(S_IRUSR | S_IRGRP | S_IROTH |
- S_IWUSR | S_IWGRP | S_IWOTH, statbuf.st_mode & ~S_IFMT);
+ EXPECT_EQ(S_IRALL | S_IWALL | S_IXALL, statbuf.st_mode & ~S_IFMT);
EXPECT_EQ(strlen(contents), statbuf.st_size);
EXPECT_EQ(access_time, statbuf.st_atime);
EXPECT_EQ(creation_time, statbuf.st_ctime);
@@ -408,8 +407,7 @@ TEST_F(Html5FsTest, GetStat) {
EXPECT_EQ(0, fs->Open(Path("/dir"), O_RDONLY, &node));
EXPECT_EQ(0, node->GetStat(&statbuf));
EXPECT_EQ(S_IFDIR, statbuf.st_mode & S_IFMT);
- EXPECT_EQ(S_IRUSR | S_IRGRP | S_IROTH |
- S_IWUSR | S_IWGRP | S_IWOTH, statbuf.st_mode & ~S_IFMT);
+ EXPECT_EQ(S_IRALL | S_IWALL | S_IXALL, statbuf.st_mode & ~S_IFMT);
EXPECT_EQ(0, statbuf.st_size);
EXPECT_EQ(access_time, statbuf.st_atime);
EXPECT_EQ(creation_time, statbuf.st_ctime);
@@ -472,6 +470,10 @@ TEST_F(Html5FsTest, GetDents) {
ScopedNode node;
ASSERT_EQ(0, fs->Open(Path("/file"), O_RDWR, &node));
+ struct stat stat;
+ ASSERT_EQ(0, node->GetStat(&stat));
+ ino_t file1_ino = stat.st_ino;
+
// Should fail for regular files.
const size_t kMaxDirents = 5;
dirent dirents[kMaxDirents];
@@ -508,6 +510,11 @@ TEST_F(Html5FsTest, GetDents) {
// Add another file...
ASSERT_EQ(0, fs->Open(Path("/file2"), O_CREAT, &node));
+ ASSERT_EQ(0, node->GetStat(&stat));
+ ino_t file2_ino = stat.st_ino;
+
+ // These files SHOULD not hash to the same value but COULD.
+ EXPECT_NE(file1_ino, file2_ino);
// Read the root directory again.
memset(&dirents[0], 0, sizeof(dirents));
@@ -523,6 +530,13 @@ TEST_F(Html5FsTest, GetDents) {
EXPECT_EQ(sizeof(dirent), dirents[i].d_off);
EXPECT_EQ(sizeof(dirent), dirents[i].d_reclen);
dirnames.insert(dirents[i].d_name);
+
+ if (!strcmp(dirents[i].d_name, "file")) {
+ EXPECT_EQ(dirents[i].d_ino, file1_ino);
+ }
+ if (!strcmp(dirents[i].d_name, "file2")) {
+ EXPECT_EQ(dirents[i].d_ino, file2_ino);
+ }
}
EXPECT_EQ(1, dirnames.count("file"));
diff --git a/native_client_sdk/src/tests/nacl_io_test/http_fs_test.cc b/native_client_sdk/src/tests/nacl_io_test/http_fs_test.cc
index 307fb61fcb..0c521dca4d 100644
--- a/native_client_sdk/src/tests/nacl_io_test/http_fs_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/http_fs_test.cc
@@ -78,15 +78,6 @@ class HttpFsLargeFileTest : public HttpFsTest {
} // namespace
-TEST_P(HttpFsTest, Access) {
- ASSERT_TRUE(ppapi_.server_template()->AddEntity("foo", "", NULL));
-
- ASSERT_EQ(0, fs_.Access(Path("/foo"), R_OK));
- ASSERT_EQ(EACCES, fs_.Access(Path("/foo"), W_OK));
- ASSERT_EQ(EACCES, fs_.Access(Path("/foo"), X_OK));
- ASSERT_EQ(ENOENT, fs_.Access(Path("/bar"), F_OK));
-}
-
TEST_P(HttpFsTest, OpenAndCloseServerError) {
EXPECT_TRUE(ppapi_.server_template()->AddError("file", 500));
@@ -178,8 +169,7 @@ TEST_P(HttpFsTest, GetStat) {
struct stat statbuf;
EXPECT_EQ(0, node->GetStat(&statbuf));
- EXPECT_EQ(S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
- statbuf.st_mode);
+ EXPECT_EQ(S_IFREG | S_IRUSR | S_IRGRP | S_IROTH, statbuf.st_mode);
EXPECT_EQ(strlen(contents), statbuf.st_size);
// These are not currently set.
EXPECT_EQ(0, statbuf.st_atime);
@@ -253,8 +243,7 @@ TEST_P(HttpFsLargeFileTest, GetStat) {
struct stat statbuf;
EXPECT_EQ(0, node->GetStat(&statbuf));
- EXPECT_EQ(S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
- statbuf.st_mode);
+ EXPECT_EQ(S_IFREG | S_IRUSR | S_IRGRP | S_IROTH, statbuf.st_mode);
EXPECT_EQ(size, statbuf.st_size);
// These are not currently set.
EXPECT_EQ(0, statbuf.st_atime);
@@ -270,6 +259,21 @@ INSTANTIATE_TEST_CASE_P(Default,
::testing::Values((uint32_t)kStringMapParamCacheNone,
(uint32_t)kStringMapParamCacheStat));
+TEST(HttpFsDirTest, Root) {
+ StringMap_t args;
+ HttpFsForTesting fs(args, NULL);
+
+ // Check root node is directory
+ ScopedNode node;
+ ASSERT_EQ(0, fs.Open(Path("/"), O_RDONLY, &node));
+ ASSERT_TRUE(node->IsaDir());
+
+ // We have to r+w access to the root node
+ struct stat buf;
+ ASSERT_EQ(0, node->GetStat(&buf));
+ ASSERT_EQ(S_IXUSR | S_IRUSR, buf.st_mode & S_IRWXU);
+}
+
TEST(HttpFsDirTest, Mkdir) {
StringMap_t args;
HttpFsForTesting fs(args, NULL);
@@ -369,24 +373,27 @@ TEST(HttpFsDirTest, ParseManifest) {
}
TEST(HttpFsBlobUrlTest, Basic) {
- const char* kUrl =
- "blob:http%3A//example.com/6b87a5a6-713e-46a4-9f0c-78066406455d";
+ const char* kUrl = "blob:http%3A//example.com/6b87a5a6-713e";
+ const char* kContent = "hello";
FakePepperInterfaceURLLoader ppapi;
- ASSERT_TRUE(ppapi.server_template()->SetBlobEntity(kUrl, "", NULL));
+ ASSERT_TRUE(ppapi.server_template()->SetBlobEntity(kUrl, kContent, NULL));
StringMap_t args;
args["SOURCE"] = kUrl;
HttpFsForTesting fs(args, &ppapi);
- // We have to read from the mount root to read a Blob URL.
- ASSERT_EQ(0, fs.Access(Path("/"), R_OK));
- ASSERT_EQ(EACCES, fs.Access(Path("/"), W_OK));
- ASSERT_EQ(EACCES, fs.Access(Path("/"), X_OK));
+ // Any other path than / should fail.
+ ScopedNode node;
+ ASSERT_EQ(ENOENT, fs.Open(Path("/blah"), R_OK, &node));
- // Any other path will fail.
- ScopedNode foo;
- ASSERT_EQ(ENOENT, fs.Access(Path(""), R_OK));
- ASSERT_EQ(ENOENT, fs.Access(Path("."), R_OK));
- ASSERT_EQ(ENOENT, fs.Access(Path("blah"), R_OK));
+ // Check access to blob file
+ ASSERT_EQ(0, fs.Open(Path("/"), O_RDONLY, &node));
+ ASSERT_EQ(true, node->IsaFile());
+
+ // Verify file size and permissions
+ struct stat buf;
+ ASSERT_EQ(0, node->GetStat(&buf));
+ ASSERT_EQ(S_IRUSR, buf.st_mode & S_IRWXU);
+ ASSERT_EQ(strlen(kContent), buf.st_size);
}
diff --git a/native_client_sdk/src/tests/nacl_io_test/js_fs_test.cc b/native_client_sdk/src/tests/nacl_io_test/js_fs_test.cc
index 58e94c3516..b1167633c3 100644
--- a/native_client_sdk/src/tests/nacl_io_test/js_fs_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/js_fs_test.cc
@@ -518,27 +518,6 @@ const int JsFsNodeTest::fd = 123;
} // namespace
-TEST_F(JsFsTest, Access) {
- int a_mode = R_OK | W_OK | X_OK;
-
- PP_Var expected;
- ASSERT_EQ(true, CreateDict(&expected));
- ASSERT_EQ(true, SetDictKeyValue(&expected, "id", 1));
- ASSERT_EQ(true, SetDictKeyValue(&expected, "cmd", "access"));
- ASSERT_EQ(true, SetDictKeyValue(&expected, "path", "/foo"));
- ASSERT_EQ(true, SetDictKeyValue(&expected, "amode", a_mode));
-
- PP_Var response;
- ASSERT_EQ(true, CreateDict(&response));
- ASSERT_EQ(true, SetDictKeyValue(&response, "id", 1));
- ASSERT_EQ(true, SetDictKeyValue(&response, "error", 0));
-
- Expect(expected, response);
- StartJsThread();
-
- EXPECT_EQ(0, fs_->Access(Path("/foo"), a_mode));
-}
-
TEST_F(JsFsTest, Open) {
PP_Var expected;
ASSERT_EQ(true, CreateDict(&expected));
diff --git a/native_client_sdk/src/tests/nacl_io_test/jspipe_test.cc b/native_client_sdk/src/tests/nacl_io_test/jspipe_test.cc
index ea2ba54679..0a8e867e72 100644
--- a/native_client_sdk/src/tests/nacl_io_test/jspipe_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/jspipe_test.cc
@@ -122,10 +122,11 @@ class JSPipeNodeTest : public ::testing::Test {
void SetUp() {
name_ = "jspipe1";
- ASSERT_EQ(0, fs_.Access(Path("/jspipe1"), R_OK | W_OK));
- ASSERT_EQ(EACCES, fs_.Access(Path("/jspipe1"), X_OK));
ASSERT_EQ(0, fs_.Open(Path("/jspipe1"), O_RDWR, &pipe_dev_));
ASSERT_NE(NULL_NODE, pipe_dev_.get());
+ struct stat buf;
+ ASSERT_EQ(0, pipe_dev_->GetStat(&buf));
+ ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU);
}
/**
@@ -433,7 +434,7 @@ TEST_F(JSPipeTest, JSPipeSelect) {
fd_set writefds;
fd_set errorfds;
- int pipe_fd = ki_open("/dev/jspipe1", O_RDONLY);
+ int pipe_fd = ki_open("/dev/jspipe1", O_RDONLY, 0);
ASSERT_GT(pipe_fd, 0) << "jspipe1 open failed: " << errno;
FD_ZERO(&readfds);
diff --git a/native_client_sdk/src/tests/nacl_io_test/kernel_object_test.cc b/native_client_sdk/src/tests/nacl_io_test/kernel_object_test.cc
index 4350aaedb4..e168d790d9 100644
--- a/native_client_sdk/src/tests/nacl_io_test/kernel_object_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/kernel_object_test.cc
@@ -32,7 +32,8 @@ class FilesystemForTesting : public Filesystem {
public:
Error Access(const Path& path, int a_mode) { return ENOSYS; }
- Error Open(const Path& path, int mode, ScopedNode* out_node) {
+ Error OpenWithMode(const Path& path, int open_flags,
+ mode_t mode, ScopedNode* out_node) {
out_node->reset(NULL);
return ENOSYS;
}
diff --git a/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc b/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc
index a84442c73c..7009e0ca6b 100644
--- a/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc
@@ -85,7 +85,7 @@ static int ki_fcntl_wrapper(int fd, int request, ...) {
* or the filesystem node but directly in the FD mapping.
*/
TEST_F(KernelProxyTest, Fcntl_GETFD) {
- int fd = ki_open("/test", O_RDWR | O_CREAT);
+ int fd = ki_open("/test", O_RDWR | O_CREAT, 0777);
ASSERT_NE(-1, fd);
// FD flags should start as zero.
@@ -116,7 +116,7 @@ TEST_F(KernelProxyTest, FileLeak) {
for (int file_num = 0; file_num < 4096; file_num++) {
sprintf(filename, "/foo%i.tmp", file_num++);
- int fd = ki_open(filename, O_WRONLY | O_CREAT);
+ int fd = ki_open(filename, O_WRONLY | O_CREAT, 0777);
ASSERT_GT(fd, -1);
ASSERT_EQ(1, root->ChildCount());
ASSERT_EQ(buffer_size, ki_write(fd, garbage, buffer_size));
@@ -232,7 +232,7 @@ TEST_F(KernelProxyTest, SignalSigwinch) {
TEST_F(KernelProxyTest, Rename) {
// Create a dummy file
- int file1 = ki_open("/test1.txt", O_RDWR | O_CREAT);
+ int file1 = ki_open("/test1.txt", O_RDWR | O_CREAT, 0777);
ASSERT_GT(file1, -1);
ASSERT_EQ(0, ki_close(file1));
@@ -293,27 +293,27 @@ TEST_F(KernelProxyTest, FDPathMapping) {
EXPECT_EQ(0, ki_mkdir("/example", S_IREAD | S_IWRITE));
ki_chdir("/foo");
- fd1 = ki_open("/example", O_RDONLY);
+ fd1 = ki_open("/example", O_RDONLY, 0);
EXPECT_NE(-1, fd1);
EXPECT_EQ(ki_fchdir(fd1), 0);
EXPECT_EQ(text, ki_getcwd(text, sizeof(text)));
EXPECT_STREQ("/example", text);
EXPECT_EQ(0, ki_chdir("/foo"));
- fd2 = ki_open("../example", O_RDONLY);
+ fd2 = ki_open("../example", O_RDONLY, 0);
EXPECT_NE(-1, fd2);
EXPECT_EQ(0, ki_fchdir(fd2));
EXPECT_EQ(text, ki_getcwd(text, sizeof(text)));
EXPECT_STREQ("/example", text);
EXPECT_EQ(0, ki_chdir("/foo"));
- fd3 = ki_open("../test", O_CREAT | O_RDWR);
+ fd3 = ki_open("../test", O_CREAT | O_RDWR, 0777);
EXPECT_NE(-1, fd3);
EXPECT_EQ(-1, ki_fchdir(fd3));
EXPECT_EQ(ENOTDIR, errno);
EXPECT_EQ(0, ki_chdir("/foo"));
- fd4 = ki_open("bar", O_RDONLY);
+ fd4 = ki_open("bar", O_RDONLY, 0);
EXPECT_EQ(0, ki_fchdir(fd4));
EXPECT_EQ(text, ki_getcwd(text, sizeof(text)));
EXPECT_STREQ("/foo/bar", text);
@@ -360,19 +360,19 @@ TEST_F(KernelProxyTest, MemMountIO) {
EXPECT_EQ(0, ki_mkdir("/foo", S_IREAD | S_IWRITE));
// Fail to open "/foo/bar"
- EXPECT_EQ(-1, ki_open("/foo/bar", O_RDONLY));
+ EXPECT_EQ(-1, ki_open("/foo/bar", O_RDONLY, 0));
EXPECT_EQ(ENOENT, errno);
// Create bar "/foo/bar"
- fd1 = ki_open("/foo/bar", O_RDWR | O_CREAT);
+ fd1 = ki_open("/foo/bar", O_RDWR | O_CREAT, 0777);
ASSERT_NE(-1, fd1);
// Open (optionally create) bar "/foo/bar"
- fd2 = ki_open("/foo/bar", O_RDWR | O_CREAT);
+ fd2 = ki_open("/foo/bar", O_RDWR | O_CREAT, 0777);
ASSERT_NE(-1, fd2);
// Fail to exclusively create bar "/foo/bar"
- EXPECT_EQ(-1, ki_open("/foo/bar", O_RDONLY | O_CREAT | O_EXCL));
+ EXPECT_EQ(-1, ki_open("/foo/bar", O_RDONLY | O_CREAT | O_EXCL, 0777));
EXPECT_EQ(EEXIST, errno);
// Write hello and world to same node with different descriptors
@@ -380,7 +380,7 @@ TEST_F(KernelProxyTest, MemMountIO) {
EXPECT_EQ(5, ki_write(fd2, "WORLD", 5));
EXPECT_EQ(5, ki_write(fd1, "HELLO", 5));
- fd3 = ki_open("/foo/bar", O_RDONLY);
+ fd3 = ki_open("/foo/bar", O_RDONLY, 0);
ASSERT_NE(-1, fd3);
len = ki_read(fd3, text, sizeof(text));
@@ -390,7 +390,7 @@ TEST_F(KernelProxyTest, MemMountIO) {
EXPECT_EQ(0, ki_close(fd1));
EXPECT_EQ(0, ki_close(fd2));
- fd1 = ki_open("/foo/bar", O_WRONLY | O_APPEND);
+ fd1 = ki_open("/foo/bar", O_WRONLY | O_APPEND, 0);
ASSERT_NE(-1, fd1);
EXPECT_EQ(5, ki_write(fd1, "WORLD", 5));
@@ -399,7 +399,7 @@ TEST_F(KernelProxyTest, MemMountIO) {
text[len] = 0;
EXPECT_STREQ("WORLD", text);
- fd2 = ki_open("/foo/bar", O_RDONLY);
+ fd2 = ki_open("/foo/bar", O_RDONLY, 0);
ASSERT_NE(-1, fd2);
len = ki_read(fd2, text, sizeof(text));
if (len > 0)
@@ -415,9 +415,9 @@ TEST_F(KernelProxyTest, MemMountFTruncate) {
// Open a file write only, write some text, then test that using a
// separate file descriptor pointing to it that it is correctly
// truncated at a specified number of bytes (2).
- fd1 = ki_open("/trunc", O_WRONLY | O_CREAT);
+ fd1 = ki_open("/trunc", O_WRONLY | O_CREAT, 0777);
ASSERT_NE(-1, fd1);
- fd2 = ki_open("/trunc", O_RDONLY);
+ fd2 = ki_open("/trunc", O_RDONLY, 0);
ASSERT_NE(-1, fd2);
EXPECT_EQ(5, ki_write(fd1, "HELLO", 5));
EXPECT_EQ(0, ki_ftruncate(fd1, 2));
@@ -435,20 +435,20 @@ TEST_F(KernelProxyTest, MemMountTruncate) {
// Open a file write only, write some text, then test that by
// referring to it by its path and truncating it we correctly truncate
// it at a specified number of bytes (2).
- fd1 = ki_open("/trunc", O_WRONLY | O_CREAT);
+ fd1 = ki_open("/trunc", O_WRONLY | O_CREAT, 0777);
ASSERT_NE(-1, fd1);
EXPECT_EQ(5, ki_write(fd1, "HELLO", 5));
EXPECT_EQ(0, ki_close(fd1));
EXPECT_EQ(0, ki_truncate("/trunc", 2));
// Verify the text is only 2 bytes long with new file descriptor.
- fd1 = ki_open("/trunc", O_RDONLY);
+ fd1 = ki_open("/trunc", O_RDONLY, 0);
ASSERT_NE(-1, fd1);
EXPECT_EQ(2, ki_read(fd1, text, sizeof(text)));
EXPECT_EQ(0, ki_close(fd1));
}
TEST_F(KernelProxyTest, MemMountLseek) {
- int fd = ki_open("/foo", O_CREAT | O_RDWR);
+ int fd = ki_open("/foo", O_CREAT | O_RDWR, 0777);
ASSERT_GT(fd, -1);
ASSERT_EQ(9, ki_write(fd, "Some text", 9));
@@ -468,7 +468,7 @@ TEST_F(KernelProxyTest, MemMountLseek) {
}
TEST_F(KernelProxyTest, CloseTwice) {
- int fd = ki_open("/foo", O_CREAT | O_RDWR);
+ int fd = ki_open("/foo", O_CREAT | O_RDWR, 0777);
ASSERT_GT(fd, -1);
EXPECT_EQ(9, ki_write(fd, "Some text", 9));
@@ -481,7 +481,7 @@ TEST_F(KernelProxyTest, CloseTwice) {
}
TEST_F(KernelProxyTest, MemMountDup) {
- int fd = ki_open("/foo", O_CREAT | O_RDWR);
+ int fd = ki_open("/foo", O_CREAT | O_RDWR, 0777);
ASSERT_GT(fd, -1);
int dup_fd = ki_dup(fd);
@@ -495,7 +495,7 @@ TEST_F(KernelProxyTest, MemMountDup) {
ASSERT_EQ(dup2_fd, ki_dup2(fd, dup2_fd));
ASSERT_EQ(9, ki_lseek(dup2_fd, 0, SEEK_CUR));
- int new_fd = ki_open("/bar", O_CREAT | O_RDWR);
+ int new_fd = ki_open("/bar", O_CREAT | O_RDWR, 0777);
ASSERT_EQ(fd, ki_dup2(new_fd, fd));
// fd, new_fd -> "/bar"
@@ -513,7 +513,7 @@ TEST_F(KernelProxyTest, MemMountDup) {
}
TEST_F(KernelProxyTest, Lstat) {
- int fd = ki_open("/foo", O_CREAT | O_RDWR);
+ int fd = ki_open("/foo", O_CREAT | O_RDWR, 0777);
ASSERT_GT(fd, -1);
ASSERT_EQ(0, ki_mkdir("/bar", S_IREAD | S_IWRITE));
@@ -530,8 +530,17 @@ TEST_F(KernelProxyTest, Lstat) {
EXPECT_EQ(ENOENT, errno);
}
+TEST_F(KernelProxyTest, OpenWithMode) {
+ int fd = ki_open("/foo", O_CREAT | O_RDWR, 0723);
+ ASSERT_GT(fd, -1);
+
+ struct stat buf;
+ EXPECT_EQ(0, ki_lstat("/foo", &buf));
+ EXPECT_EQ(0723, buf.st_mode & ~S_IFMT);
+}
+
TEST_F(KernelProxyTest, UseAfterClose) {
- int fd = ki_open("/dummy", O_CREAT | O_WRONLY);
+ int fd = ki_open("/dummy", O_CREAT | O_WRONLY, 0777);
ASSERT_GT(fd, -1);
EXPECT_EQ(5, ki_write(fd, "hello", 5));
EXPECT_EQ(0, ki_close(fd));
@@ -627,7 +636,7 @@ TEST_F(KernelProxyMountTest, MountAndIoctl) {
char path[100];
snprintf(path, 100, "dev/fs/%d", g_fs_dev);
- int fd = ki_open(path, O_RDONLY);
+ int fd = ki_open(path, O_RDONLY, 0);
ASSERT_GT(fd, -1);
EXPECT_EQ(0, ki_ioctl_wrapper(fd, 0xdeadbeef));
@@ -701,8 +710,8 @@ class KernelProxyMMapTest_Node : public Node {
class KernelProxyMMapTest_Filesystem : public Filesystem {
public:
- virtual Error Access(const Path& path, int a_mode) { return 0; }
- virtual Error Open(const Path& path, int mode, ScopedNode* out_node) {
+ virtual Error OpenWithMode(const Path& path, int open_flags,
+ mode_t mode, ScopedNode* out_node) {
out_node->reset(new KernelProxyMMapTest_Node(this));
return 0;
}
@@ -748,7 +757,7 @@ class KernelProxyMMapTest : public ::testing::Test {
TEST_F(KernelProxyMMapTest, MMap) {
ASSERT_EQ(0, ki_umount("/"));
ASSERT_EQ(0, ki_mount("", "/", "mmapfs", 0, NULL));
- int fd = ki_open("/file", O_RDWR | O_CREAT);
+ int fd = ki_open("/file", O_RDWR | O_CREAT, 0777);
ASSERT_NE(-1, fd);
void* addr1 = ki_mmap(NULL, 0x800, PROT_READ, MAP_PRIVATE, fd, 0);
@@ -830,8 +839,8 @@ class KernelProxyErrorTest : public ::testing::Test {
TEST_F(KernelProxyErrorTest, WriteError) {
ScopedRef<MockFs> mock_fs(fs());
ScopedRef<MockNode> mock_node(new MockNode(&*mock_fs));
- EXPECT_CALL(*mock_fs, Open(_, _, _))
- .WillOnce(DoAll(SetArgPointee<2>(mock_node), Return(0)));
+ EXPECT_CALL(*mock_fs, OpenWithMode(_, _, _, _))
+ .WillOnce(DoAll(SetArgPointee<3>(mock_node), Return(0)));
EXPECT_CALL(*mock_node, Write(_, _, _, _))
.WillOnce(DoAll(SetArgPointee<3>(0), // Wrote 0 bytes.
@@ -839,7 +848,7 @@ TEST_F(KernelProxyErrorTest, WriteError) {
EXPECT_CALL(*mock_node, Destroy()).Times(1);
- int fd = ki_open("/dummy", O_WRONLY);
+ int fd = ki_open("/dummy", O_WRONLY, 0);
EXPECT_NE(0, fd);
char buf[20];
@@ -852,8 +861,8 @@ TEST_F(KernelProxyErrorTest, WriteError) {
TEST_F(KernelProxyErrorTest, ReadError) {
ScopedRef<MockFs> mock_fs(fs());
ScopedRef<MockNode> mock_node(new MockNode(&*mock_fs));
- EXPECT_CALL(*mock_fs, Open(_, _, _))
- .WillOnce(DoAll(SetArgPointee<2>(mock_node), Return(0)));
+ EXPECT_CALL(*mock_fs, OpenWithMode(_, _, _, _))
+ .WillOnce(DoAll(SetArgPointee<3>(mock_node), Return(0)));
EXPECT_CALL(*mock_node, Read(_, _, _, _))
.WillOnce(DoAll(SetArgPointee<3>(0), // Read 0 bytes.
@@ -861,7 +870,7 @@ TEST_F(KernelProxyErrorTest, ReadError) {
EXPECT_CALL(*mock_node, Destroy()).Times(1);
- int fd = ki_open("/dummy", O_RDONLY);
+ int fd = ki_open("/dummy", O_RDONLY, 0);
EXPECT_NE(0, fd);
char buf[20];
diff --git a/native_client_sdk/src/tests/nacl_io_test/kernel_wrap_test.cc b/native_client_sdk/src/tests/nacl_io_test/kernel_wrap_test.cc
index 2bb619872c..00f2e448ce 100644
--- a/native_client_sdk/src/tests/nacl_io_test/kernel_wrap_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/kernel_wrap_test.cc
@@ -19,12 +19,13 @@
#include "nacl_io/osmman.h"
#include "nacl_io/ossocket.h"
#include "nacl_io/ostermios.h"
+#include "nacl_io/ostime.h"
+#include "ppapi_simple/ps.h"
#if defined(__native_client__) && !defined(__GLIBC__)
extern "C" {
-// TODO(sbc): remove once these get added to the newlib toolchain headers.
+// TODO(sbc): remove once this gets added to the newlib toolchain headers.
int fchdir(int fd);
-int utimes(const char *filename, const struct timeval times[2]);
}
#endif
@@ -39,30 +40,48 @@ using ::testing::StrEq;
namespace {
-#define COMPARE_FIELD(f) \
- if (arg->f != statbuf->f) { \
- *result_listener << "mismatch of field \"" #f \
- "\". " \
- "expected: " << statbuf->f << " actual: " << arg->f; \
- return false; \
+#define COMPARE_FIELD(actual, expected, f) \
+ if (actual != expected) { \
+ *result_listener << "mismatch of field \"" f \
+ "\". " \
+ "expected: " << expected << " actual: " << actual; \
+ return false; \
}
-MATCHER_P(IsEqualToStatbuf, statbuf, "") {
- COMPARE_FIELD(st_dev);
- COMPARE_FIELD(st_ino);
- COMPARE_FIELD(st_mode);
- COMPARE_FIELD(st_nlink);
- COMPARE_FIELD(st_uid);
- COMPARE_FIELD(st_gid);
- COMPARE_FIELD(st_rdev);
- COMPARE_FIELD(st_size);
- COMPARE_FIELD(st_atime);
- COMPARE_FIELD(st_mtime);
- COMPARE_FIELD(st_ctime);
+#define COMPARE_FIELD_SIMPLE(f) COMPARE_FIELD(arg->f, other->f, #f)
+
+MATCHER_P(IsEqualToStatbuf, other, "") {
+ COMPARE_FIELD_SIMPLE(st_dev);
+ COMPARE_FIELD_SIMPLE(st_ino);
+ COMPARE_FIELD_SIMPLE(st_mode);
+ COMPARE_FIELD_SIMPLE(st_nlink);
+ COMPARE_FIELD_SIMPLE(st_uid);
+ COMPARE_FIELD_SIMPLE(st_gid);
+ COMPARE_FIELD_SIMPLE(st_rdev);
+ COMPARE_FIELD_SIMPLE(st_size);
+ COMPARE_FIELD_SIMPLE(st_atime);
+ COMPARE_FIELD_SIMPLE(st_mtime);
+ COMPARE_FIELD_SIMPLE(st_ctime);
+ return true;
+}
+
+MATCHER_P(IsEqualToUtimbuf, other, "") {
+ COMPARE_FIELD(arg[0].tv_sec, other->actime, "actime");
+ COMPARE_FIELD(arg[1].tv_sec, other->modtime, "modtime");
+ return true;
+}
+
+MATCHER_P(IsEqualToTimeval, other, "") {
+ COMPARE_FIELD(arg[0].tv_sec, other[0].tv_sec, "[0].tv_sec");
+ COMPARE_FIELD(arg[0].tv_nsec, other[0].tv_usec * 1000, "[0].tv_usec");
+ COMPARE_FIELD(arg[1].tv_sec, other[1].tv_sec, "[1].tv_sec");
+ COMPARE_FIELD(arg[1].tv_nsec, other[1].tv_usec * 1000, "[1].tv_usec");
return true;
}
#undef COMPARE_FIELD
+#undef COMPARE_FIELD_SIMPLE
+
ACTION_P(SetErrno, value) {
errno = value;
@@ -126,7 +145,7 @@ class KernelWrapTest : public ::testing::Test {
errno = 0;
// Initializing the KernelProxy opens stdin/stdout/stderr.
- EXPECT_CALL(mock, open(_, _))
+ EXPECT_CALL(mock, open(_, _, _))
.WillOnce(Return(0))
.WillOnce(Return(1))
.WillOnce(Return(2));
@@ -301,6 +320,14 @@ TEST_F(KernelWrapTest, fsync) {
ASSERT_EQ(kDummyErrno, errno);
}
+TEST_F(KernelWrapTest, futimes) {
+ struct timeval times[2] = {{123, 234}, {345, 456}};
+ EXPECT_CALL(mock, futimens(kDummyInt, IsEqualToTimeval(times)))
+ .WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1)));
+ EXPECT_EQ(-1, futimes(kDummyInt, times));
+ ASSERT_EQ(kDummyErrno, errno);
+}
+
TEST_F(KernelWrapTest, getcwd) {
char buffer[PATH_MAX];
char result[PATH_MAX];
@@ -449,12 +476,12 @@ TEST_F(KernelWrapTest, munmap) {
TEST_F(KernelWrapTest, open) {
// We pass O_RDONLY because we do not want an error in flags translation
- EXPECT_CALL(mock, open(kDummyConstChar, 0))
+ EXPECT_CALL(mock, open(kDummyConstChar, 0, 0))
.WillOnce(Return(kDummyInt2))
.WillOnce(Return(kDummyInt2));
- EXPECT_EQ(kDummyInt2, open(kDummyConstChar, 0));
- EXPECT_EQ(kDummyInt2, open(kDummyConstChar, 0));
+ EXPECT_EQ(kDummyInt2, open(kDummyConstChar, 0, 0));
+ EXPECT_EQ(kDummyInt2, open(kDummyConstChar, 0, 0));
}
TEST_F(KernelWrapTest, pipe) {
@@ -614,14 +641,15 @@ TEST_F(KernelWrapTest, unlink) {
}
TEST_F(KernelWrapTest, utime) {
- const struct utimbuf* times = NULL;
- EXPECT_CALL(mock, utime(kDummyConstChar, times)).WillOnce(Return(kDummyInt));
- EXPECT_EQ(kDummyInt, utime(kDummyConstChar, times));
+ const struct utimbuf times = {123, 456};
+ EXPECT_CALL(mock, utimens(kDummyConstChar, IsEqualToUtimbuf(&times)))
+ .WillOnce(Return(kDummyInt));
+ EXPECT_EQ(kDummyInt, utime(kDummyConstChar, &times));
}
TEST_F(KernelWrapTest, utimes) {
- struct timeval* times = NULL;
- EXPECT_CALL(mock, utimes(kDummyConstChar, times))
+ struct timeval times[2] = {{123, 234}, {345, 456}};
+ EXPECT_CALL(mock, utimens(kDummyConstChar, IsEqualToTimeval(times)))
.WillOnce(DoAll(SetErrno(kDummyErrno), Return(-1)));
EXPECT_EQ(-1, utimes(kDummyConstChar, times));
ASSERT_EQ(kDummyErrno, errno);
@@ -633,13 +661,14 @@ TEST_F(KernelWrapTest, write) {
EXPECT_EQ(kDummyInt3, write(kDummyInt, kDummyVoidPtr, kDummyInt2));
}
-#if defined SEL_LDR
class KernelWrapTestUninit : public ::testing::Test {
void SetUp() {
ASSERT_EQ(0, ki_push_state_for_testing());
+ kernel_wrap_uninit();
}
void TearDown() {
+ kernel_wrap_init();
ki_pop_state_for_testing();
}
};
@@ -647,6 +676,8 @@ class KernelWrapTestUninit : public ::testing::Test {
TEST_F(KernelWrapTestUninit, Mkdir_Uninitialised) {
// If we are running within chrome we can't use these calls without
// nacl_io initialized.
+ if (PSGetInstanceId() != 0)
+ return;
EXPECT_EQ(0, mkdir("./foo", S_IREAD | S_IWRITE));
EXPECT_EQ(0, rmdir("./foo"));
}
@@ -654,6 +685,8 @@ TEST_F(KernelWrapTestUninit, Mkdir_Uninitialised) {
TEST_F(KernelWrapTestUninit, Getcwd_Uninitialised) {
// If we are running within chrome we can't use these calls without
// nacl_io initialized.
+ if (PSGetInstanceId() != 0)
+ return;
char dir[PATH_MAX];
ASSERT_NE((char*)NULL, getcwd(dir, PATH_MAX));
// Verify that the CWD ends with 'nacl_io_test'
@@ -661,7 +694,6 @@ TEST_F(KernelWrapTestUninit, Getcwd_Uninitialised) {
ASSERT_GT(strlen(dir), strlen(suffix));
ASSERT_EQ(0, strcmp(dir+strlen(dir)-strlen(suffix), suffix));
}
-#endif
#if defined(PROVIDES_SOCKET_API) and !defined(__BIONIC__)
TEST_F(KernelWrapTest, poll) {
diff --git a/native_client_sdk/src/tests/nacl_io_test/main.cc b/native_client_sdk/src/tests/nacl_io_test/main.cc
index 326c18f12c..31414e64c5 100644
--- a/native_client_sdk/src/tests/nacl_io_test/main.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/main.cc
@@ -5,17 +5,6 @@
#include <string>
#include "gtest/gtest.h"
-
-#if defined(SEL_LDR)
-
-int main(int argc, char* argv[]) {
- setenv("TERM", "xterm-256color", 0);
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-#else
-
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/var.h"
#include "ppapi_simple/ps_main.h"
@@ -54,14 +43,15 @@ class GTestEventListener : public ::testing::EmptyTestEventListener {
};
int example_main(int argc, char* argv[]) {
+ setenv("TERM", "xterm-256color", 0);
::testing::InitGoogleTest(&argc, argv);
- ::testing::UnitTest::GetInstance()->listeners()
- .Append(new GTestEventListener());
+ if (PSGetInstanceId() != 0) {
+ ::testing::UnitTest::GetInstance()->listeners()
+ .Append(new GTestEventListener());
+ }
return RUN_ALL_TESTS();
}
// Register the function to call once the Instance Object is initialized.
// see: pappi_simple/ps_main.h
PPAPI_SIMPLE_REGISTER_MAIN(example_main);
-
-#endif
diff --git a/native_client_sdk/src/tests/nacl_io_test/mem_fs_node_test.cc b/native_client_sdk/src/tests/nacl_io_test/mem_fs_node_test.cc
index dc521c6986..9b6e347fac 100644
--- a/native_client_sdk/src/tests/nacl_io_test/mem_fs_node_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/mem_fs_node_test.cc
@@ -36,6 +36,15 @@ class MemFsForTesting : public MemFs {
EXPECT_EQ(0, Init(args));
}
+ bool Exists(const char* filename) {
+ ScopedNode node;
+ if (Open(Path(filename), O_RDONLY, &node))
+ return false;
+
+ struct stat buf;
+ return node->GetStat(&buf) == 0;
+ }
+
int num_nodes() { return inode_pool_.size(); }
};
@@ -118,6 +127,25 @@ TEST(MemFsNodeTest, File) {
EXPECT_EQ(NULL_NODE, result_node.get());
}
+TEST(MemFsNodeTest, Fchmod) {
+ MemFsNodeForTesting file;
+
+ ASSERT_EQ(0, file.Init(0));
+ EXPECT_EQ(S_IRALL | S_IWALL, file.GetMode());
+
+ struct stat s;
+ ASSERT_EQ(0, file.GetStat(&s));
+ EXPECT_EQ(S_IFREG | S_IRALL | S_IWALL, s.st_mode);
+
+ // Change to read-only.
+ EXPECT_EQ(0, file.Fchmod(S_IRALL));
+
+ EXPECT_EQ(S_IRALL, file.GetMode());
+
+ ASSERT_EQ(0, file.GetStat(&s));
+ EXPECT_EQ(S_IFREG | S_IRALL, s.st_mode);
+}
+
TEST(MemFsNodeTest, FTruncate) {
MemFsNodeForTesting file;
off_t result_size = 0;
@@ -220,6 +248,12 @@ TEST(MemFsNodeTest, Directory) {
EXPECT_EQ(EISDIR, root.Read(attr, buf1, sizeof(buf1), &result_bytes));
EXPECT_EQ(EISDIR, root.Write(attr, buf1, sizeof(buf1), &result_bytes));
+ // Chmod test
+ EXPECT_EQ(0, root.Fchmod(S_IRALL | S_IWALL));
+ EXPECT_EQ(S_IRALL | S_IWALL, root.GetMode());
+ // Change it back.
+ EXPECT_EQ(0, root.Fchmod(S_IRALL | S_IWALL | S_IXALL));
+
// Test directory operations
MemFsNodeForTesting* raw_file = new MemFsNodeForTesting;
EXPECT_EQ(0, raw_file->Init(0));
diff --git a/native_client_sdk/src/tests/nacl_io_test/mock_fs.h b/native_client_sdk/src/tests/nacl_io_test/mock_fs.h
index 8fe3b34c0d..0ed03878c2 100644
--- a/native_client_sdk/src/tests/nacl_io_test/mock_fs.h
+++ b/native_client_sdk/src/tests/nacl_io_test/mock_fs.h
@@ -25,6 +25,7 @@ class MockFs : public nacl_io::Filesystem {
MOCK_METHOD0(Destroy, void());
MOCK_METHOD2(Access, Error(const Path&, int));
MOCK_METHOD3(Open, Error(const Path&, int, ScopedNode*));
+ MOCK_METHOD4(OpenWithMode, Error(const Path&, int, mode_t, ScopedNode*));
MOCK_METHOD2(OpenResource, Error(const Path&, ScopedNode*));
MOCK_METHOD1(Unlink, Error(const Path&));
MOCK_METHOD2(Mkdir, Error(const Path&, int));
diff --git a/native_client_sdk/src/tests/nacl_io_test/mock_kernel_proxy.h b/native_client_sdk/src/tests/nacl_io_test/mock_kernel_proxy.h
index 03059a9e4b..e121c6ca8b 100644
--- a/native_client_sdk/src/tests/nacl_io_test/mock_kernel_proxy.h
+++ b/native_client_sdk/src/tests/nacl_io_test/mock_kernel_proxy.h
@@ -26,13 +26,14 @@ class MockKernelProxy : public nacl_io::KernelProxy {
MOCK_METHOD1(dup, int(int));
MOCK_METHOD2(dup2, int(int, int));
MOCK_METHOD1(fchdir, int(int));
- MOCK_METHOD2(fchmod, int(int, int));
+ MOCK_METHOD2(fchmod, int(int, mode_t));
MOCK_METHOD3(fchown, int(int, uid_t, gid_t));
MOCK_METHOD3(fcntl, int(int, int, va_list));
+ MOCK_METHOD1(fdatasync, int(int));
MOCK_METHOD2(ftruncate, int(int, off_t));
MOCK_METHOD2(fstat, int(int, struct stat*));
MOCK_METHOD1(fsync, int(int));
- MOCK_METHOD1(fdatasync, int(int));
+ MOCK_METHOD2(futimens, int(int, const struct timespec[2]));
MOCK_METHOD2(getcwd, char*(char*, size_t));
MOCK_METHOD3(getdents, int(int, void*, unsigned int));
MOCK_METHOD1(getwd, char*(char*));
@@ -48,7 +49,8 @@ class MockKernelProxy : public nacl_io::KernelProxy {
MOCK_METHOD5(mount, int(const char*, const char*, const char*, unsigned long,
const void*));
MOCK_METHOD2(munmap, int(void*, size_t));
- MOCK_METHOD2(open, int(const char*, int));
+ MOCK_METHOD3(open, int(const char*, int, mode_t));
+ MOCK_METHOD1(open_resource, int(const char*));
MOCK_METHOD1(pipe, int(int[2]));
MOCK_METHOD3(read, ssize_t(int, void*, size_t));
MOCK_METHOD3(readlink, int(const char*, char*, size_t count));
@@ -61,13 +63,11 @@ class MockKernelProxy : public nacl_io::KernelProxy {
MOCK_METHOD2(tcflush, int(int, int));
MOCK_METHOD2(tcgetattr, int(int, struct termios*));
MOCK_METHOD3(tcsetattr, int(int, int, const struct termios*));
- MOCK_METHOD1(umount, int(const char*));
MOCK_METHOD2(truncate, int(const char*, off_t));
+ MOCK_METHOD1(umount, int(const char*));
MOCK_METHOD1(unlink, int(const char*));
- MOCK_METHOD2(utime, int(const char*, const struct utimbuf*));
- MOCK_METHOD2(utimes, int(const char*, const struct timeval[2]));
+ MOCK_METHOD2(utimens, int(const char*, const struct timespec[2]));
MOCK_METHOD3(write, ssize_t(int, const void*, size_t));
- MOCK_METHOD1(open_resource, int(const char*));
#ifdef PROVIDES_SOCKET_API
MOCK_METHOD3(poll, int(struct pollfd*, nfds_t, int));
diff --git a/native_client_sdk/src/tests/nacl_io_test/tty_test.cc b/native_client_sdk/src/tests/nacl_io_test/tty_test.cc
index 6a390e0572..7d129f93a0 100644
--- a/native_client_sdk/src/tests/nacl_io_test/tty_test.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/tty_test.cc
@@ -37,10 +37,11 @@ class TtyNodeTest : public ::testing::Test {
TtyNodeTest() : fs_(&ppapi_) {}
void SetUp() {
- ASSERT_EQ(0, fs_.Access(Path("/tty"), R_OK | W_OK));
- ASSERT_EQ(EACCES, fs_.Access(Path("/tty"), X_OK));
ASSERT_EQ(0, fs_.Open(Path("/tty"), O_RDWR, &dev_tty_));
ASSERT_NE(NULL_NODE, dev_tty_.get());
+ struct stat buf;
+ ASSERT_EQ(0, dev_tty_->GetStat(&buf));
+ ASSERT_EQ(S_IRUSR | S_IWUSR, buf.st_mode & S_IRWXU);
}
protected:
@@ -187,7 +188,7 @@ TEST_F(TtyTest, TtySelect) {
fd_set writefds;
fd_set errorfds;
- int tty_fd = ki_open("/dev/tty", O_RDONLY);
+ int tty_fd = ki_open("/dev/tty", O_RDONLY, 0);
ASSERT_GT(tty_fd, 0) << "tty open failed: " << errno;
FD_ZERO(&readfds);
@@ -230,7 +231,7 @@ TEST_F(TtyTest, TtySelect) {
}
TEST_F(TtyTest, TtyICANON) {
- int tty_fd = ki_open("/dev/tty", O_RDONLY);
+ int tty_fd = ki_open("/dev/tty", O_RDONLY, 0);
ASSERT_EQ(0, IsReadable(tty_fd));
@@ -263,7 +264,7 @@ static void sighandler(int sig) { g_received_signal = sig; }
TEST_F(TtyTest, WindowSize) {
// Get current window size
struct winsize old_winsize = {0};
- int tty_fd = ki_open("/dev/tty", O_RDONLY);
+ int tty_fd = ki_open("/dev/tty", O_RDONLY, 0);
ASSERT_EQ(0, ki_ioctl_wrapper(tty_fd, TIOCGWINSZ, &old_winsize));
// Install signal handler
@@ -311,7 +312,7 @@ static void* resize_thread_main(void* arg) {
TEST_F(TtyTest, ResizeDuringSelect) {
// Test that a window resize during a call
// to select(3) will cause it to fail with EINTR.
- int tty_fd = ki_open("/dev/tty", O_RDONLY);
+ int tty_fd = ki_open("/dev/tty", O_RDONLY, 0);
fd_set readfds;
fd_set errorfds;
@@ -346,7 +347,7 @@ static void* input_thread_main(void* arg) {
usleep(50 * 1000);
- int fd = ki_open("/dev/tty", O_RDONLY);
+ int fd = ki_open("/dev/tty", O_RDONLY, 0);
thiz->TtyWrite(fd, "test\n");
return NULL;
}
@@ -354,7 +355,7 @@ static void* input_thread_main(void* arg) {
TEST_F(TtyTest, InputDuringSelect) {
// Test that input which occurs while in select causes
// select to return.
- int tty_fd = ki_open("/dev/tty", O_RDONLY);
+ int tty_fd = ki_open("/dev/tty", O_RDONLY, 0);
fd_set readfds;
fd_set errorfds;
diff --git a/native_client_sdk/src/tests/sdk_util_test/main.cc b/native_client_sdk/src/tests/sdk_util_test/main.cc
index 7dedcc62ae..a715b1bfac 100644
--- a/native_client_sdk/src/tests/sdk_util_test/main.cc
+++ b/native_client_sdk/src/tests/sdk_util_test/main.cc
@@ -5,16 +5,6 @@
#include <string>
#include "gtest/gtest.h"
-
-#if defined(SEL_LDR)
-
-int main(int argc, char* argv[]) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
-#else
-
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/var.h"
#include "ppapi_simple/ps_main.h"
@@ -54,13 +44,13 @@ class GTestEventListener : public ::testing::EmptyTestEventListener {
int example_main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
- ::testing::UnitTest::GetInstance()->listeners()
- .Append(new GTestEventListener());
+ if (PSGetInstanceId() != 0) {
+ ::testing::UnitTest::GetInstance()->listeners()
+ .Append(new GTestEventListener());
+ }
return RUN_ALL_TESTS();
}
// Register the function to call once the Instance Object is initialized.
// see: pappi_simple/ps_main.h
PPAPI_SIMPLE_REGISTER_MAIN(example_main);
-
-#endif
diff --git a/native_client_sdk/src/tools/common.mk b/native_client_sdk/src/tools/common.mk
index 15cf783d2a..a4e827ad05 100644
--- a/native_client_sdk/src/tools/common.mk
+++ b/native_client_sdk/src/tools/common.mk
@@ -204,6 +204,9 @@ TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain)
#
# Check for required minimum SDK version.
+# A makefile can declare NACL_SDK_VERSION_MIN of the form "<major>.<position>",
+# where <major> is the major Chromium version number, and <position> is the
+# Chromium Cr-Commit-Position number. eg. "39.295386".
#
ifdef NACL_SDK_VERSION_MIN
VERSION_CHECK:=$(shell $(GETOS) --check-version=$(NACL_SDK_VERSION_MIN) 2>&1)
@@ -326,10 +329,6 @@ else
POSIX_FLAGS ?= -g -O0 -pthread -MMD -DNACL_SDK_DEBUG
endif
-ifdef STANDALONE
-POSIX_FLAGS += -DSEL_LDR=1
-endif
-
NACL_CFLAGS ?= -Wno-long-long -Werror
NACL_CXXFLAGS ?= -Wno-long-long -Werror
NACL_LDFLAGS += -Wl,-as-needed -pthread
diff --git a/native_client_sdk/src/tools/genhttpfs.py b/native_client_sdk/src/tools/genhttpfs.py
index b6c848b7ff..4e9aa92007 100755
--- a/native_client_sdk/src/tools/genhttpfs.py
+++ b/native_client_sdk/src/tools/genhttpfs.py
@@ -3,23 +3,27 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# This scripts generates a manifest file for the MountHttp file system.
-# Files and directory paths are specified on the command-line. The names
-# with glob and directories are recursed to form a list of files.
-#
-# For each file, the mode bits, size and path relative to the CWD are written
-# to the output file which is stdout by default.
-#
+"""This script generates a manifest file for nacl_io's HTTP file-system.
+Files and directory paths are specified on the command-line. The names
+with glob and directories are recursed to form a list of files.
+
+For each file, the mode bits, size and path relative to the CWD are written
+to the output file which is stdout by default.
+"""
import glob
import optparse
import os
import sys
+import urllib
+
+class Error(Exception):
+ pass
def main(argv):
- parser = optparse.OptionParser(
- usage='Usage: %prog [options] filename ...')
+ parser = optparse.OptionParser(description=__doc__,
+ usage='Usage: %prog [options] <filename>...')
parser.add_option('-C', '--srcdir',
help='Change directory.', dest='srcdir', default=None)
parser.add_option('-o', '--output',
@@ -39,12 +43,15 @@ def main(argv):
if options.srcdir:
os.chdir(options.srcdir)
+ if not args:
+ parser.error("One or more pathnames must be specified. See --help.")
+
# Generate a set of unique file names bases on the input globs
fileset = set()
for fileglob in args:
filelist = glob.glob(fileglob)
if not filelist:
- raise RuntimeError('Could not find match for "%s".\n' % fileglob)
+ raise Error('Could not find match for "%s".\n' % fileglob)
for filename in filelist:
if os.path.isfile(filename):
fileset |= set([filename])
@@ -53,18 +60,19 @@ def main(argv):
for root, _, files in os.walk(filename):
fileset |= set([os.path.join(root, name) for name in files])
continue
- raise RuntimeError('Can not handle path "%s".\n' % filename)
+ raise Error('Can not handle path "%s".\n' % filename)
cwd = os.path.abspath(os.getcwd())
cwdlen = len(cwd)
for filename in sorted(fileset):
relname = os.path.abspath(filename)
if cwd not in relname:
- raise RuntimeError('%s is not relative to CWD %s.\n' % filename, cwd)
+ raise Error('%s is not relative to CWD %s.\n' % filename, cwd)
relname = relname[cwdlen:]
stat = os.stat(filename)
mode = '-r--'
- outfile.write('%s %d %s\n' % (mode, stat.st_size, relname))
+ name = urllib.quote(relname)
+ outfile.write('%s %d %s\n' % (mode, stat.st_size, name))
return 0
@@ -72,6 +80,6 @@ def main(argv):
if __name__ == '__main__':
try:
sys.exit(main(sys.argv[1:]))
- except OSError, e:
+ except Error, e:
sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e))
sys.exit(1)
diff --git a/native_client_sdk/src/tools/getos.py b/native_client_sdk/src/tools/getos.py
index c4e31c3188..8416b56f07 100755
--- a/native_client_sdk/src/tools/getos.py
+++ b/native_client_sdk/src/tools/getos.py
@@ -68,6 +68,7 @@ def GetSDKVersion():
version = None
revision = None
+ commit_position = None
for line in open(readme):
if ':' in line:
name, value = line.split(':', 1)
@@ -75,17 +76,19 @@ def GetSDKVersion():
version = value.strip()
if name == "Chrome Revision":
revision = value.strip()
+ if name == "Chrome Commit Position":
+ commit_position = value.strip()
- if revision == None or version == None:
+ if revision is None or version is None or commit_position is None:
raise Error("error parsing SDK README: %s" % readme)
try:
- revision = int(revision)
version = int(version)
+ revision = int(revision)
except ValueError:
raise Error("error parsing SDK README: %s" % readme)
- return (version, revision)
+ return (version, revision, commit_position)
def GetSystemArch(platform):
@@ -181,6 +184,10 @@ def GetNaClArch(platform):
def ParseVersion(version):
+ """Parses a version number of the form '<major>.<position>'.
+
+ <position> is the Cr-Commit-Position number.
+ """
if '.' in version:
version = version.split('.')
else:
@@ -192,6 +199,22 @@ def ParseVersion(version):
raise Error('error parsing SDK version: %s' % version)
+def CheckVersion(required_version):
+ """Determines whether the current SDK version meets the required version.
+
+ Args:
+ required_version: (major, position) pair, where position is the
+ Cr-Commit-Position number.
+
+ Raises:
+ Error: The SDK version is older than required_version.
+ """
+ version = GetSDKVersion()[:2]
+ if version < required_version:
+ raise Error("SDK version too old (current: %d.%d, required: %d.%d)"
+ % (version[0], version[1], required_version[0], required_version[1]))
+
+
def main(args):
parser = optparse.OptionParser()
parser.add_option('--arch', action='store_true',
@@ -205,9 +228,13 @@ def main(args):
help='Print major version of the NaCl SDK.')
parser.add_option('--sdk-revision', action='store_true',
help='Print revision number of the NaCl SDK.')
+ parser.add_option('--sdk-commit-position', action='store_true',
+ help='Print commit position of the NaCl SDK.')
parser.add_option('--check-version',
+ metavar='MAJOR.POSITION',
help='Check that the SDK version is at least as great as the '
- 'version passed in.')
+ 'version passed in. MAJOR is the major version number and POSITION '
+ 'is the Cr-Commit-Position number.')
options, _ = parser.parse_args(args)
@@ -230,13 +257,11 @@ def main(args):
out = GetSDKVersion()[0]
elif options.sdk_revision:
out = GetSDKVersion()[1]
+ elif options.sdk_commit_position:
+ out = GetSDKVersion()[2]
elif options.check_version:
required_version = ParseVersion(options.check_version)
- version = GetSDKVersion()
- if version < required_version:
- raise Error("SDK version too old (current: %s.%s, required: %s.%s)"
- % (version[0], version[1],
- required_version[0], required_version[1]))
+ CheckVersion(required_version)
out = None
if out:
diff --git a/native_client_sdk/src/tools/tests/getos_test.py b/native_client_sdk/src/tools/tests/getos_test.py
index 498c52ac36..f47fffb11a 100755
--- a/native_client_sdk/src/tools/tests/getos_test.py
+++ b/native_client_sdk/src/tools/tests/getos_test.py
@@ -117,14 +117,51 @@ class TestGetosWithTempdir(TestCaseExtended):
def testGetSDKVersion(self):
"""correctly parses README to find SDK version."""
- expected_version = (16, 196)
+ expected_version = (16, 100, 'f00baacabba6e-refs/heads/master@{#100}')
with open(os.path.join(self.tempdir, 'README'), 'w') as out:
- out.write('Version: %s\n' % expected_version[0])
- out.write('Chrome Revision: %s\n' % expected_version[1])
+ out.write('Version: %d\n' % expected_version[0])
+ out.write('Chrome Revision: %d\n' % expected_version[1])
+ out.write('Chrome Commit Position: %s\n' % expected_version[2])
version = getos.GetSDKVersion()
self.assertEqual(version, expected_version)
+ def testParseVersion(self):
+ """correctly parses a version given to --check-version."""
+ check_version_string = '15.100'
+ self.assertEquals((15, 100), getos.ParseVersion(check_version_string))
+
+ def testCheckVersion(self):
+ """correctly rejects SDK versions earlier than the required one."""
+ actual_version = (16, 100, 'f00baacabba6e-refs/heads/master@{#100}')
+ with open(os.path.join(self.tempdir, 'README'), 'w') as out:
+ out.write('Version: %d\n' % actual_version[0])
+ out.write('Chrome Revision: %d\n' % actual_version[1])
+ out.write('Chrome Commit Position: %s\n' % actual_version[2])
+
+ required_version = (15, 150)
+ getos.CheckVersion(required_version)
+
+ required_version = (16, 99)
+ getos.CheckVersion(required_version)
+
+ required_version = (16, 100)
+ getos.CheckVersion(required_version)
+
+ required_version = (16, 101)
+ self.assertRaisesRegexp(
+ getos.Error,
+ r'SDK version too old \(current: 16.100, required: 16.101\)',
+ getos.CheckVersion,
+ required_version)
+
+ required_version = (17, 50)
+ self.assertRaisesRegexp(
+ getos.Error,
+ r'SDK version too old \(current: 16.100, required: 17.50\)',
+ getos.CheckVersion,
+ required_version)
+
if __name__ == '__main__':
unittest.main()