Merge from Chromium at DEPS revision 228962

This commit was generated by merge_to_master.py.

Change-Id: I23bd7d7766f213fd52f28ae5e1ecc6ae9df905ea
diff --git a/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc b/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc
index 4b6c565..af9b754 100644
--- a/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc
+++ b/native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc
@@ -15,6 +15,7 @@
 #include <algorithm>
 
 #include "nacl_io/ioctl.h"
+#include "nacl_io/kernel_handle.h"
 #include "nacl_io/mount.h"
 #include "nacl_io/pepper_interface.h"
 #include "sdk_util/auto_lock.h"
@@ -76,11 +77,10 @@
   return emitter_.get();
 }
 
-Error MountNodeTty::Write(size_t offs,
-                     const void* buf,
-                     size_t count,
-                     int* out_bytes) {
-
+Error MountNodeTty::Write(const HandleAttr& attr,
+                          const void* buf,
+                          size_t count,
+                          int* out_bytes) {
   AUTO_LOCK(output_lock_);
   *out_bytes = 0;
 
@@ -102,7 +102,10 @@
 }
 
 
-Error MountNodeTty::Read(size_t offs, void* buf, size_t count, int* out_bytes) {
+Error MountNodeTty::Read(const HandleAttr& attr,
+                         void* buf,
+                         size_t count,
+                         int* out_bytes) {
   EventListenerLock wait(GetEventEmitter());
   *out_bytes = 0;
 
@@ -151,7 +154,8 @@
 
 Error MountNodeTty::Echo(const char* string, int count) {
   int wrote;
-  Error error = Write(0, string, count, &wrote);
+  HandleAttr data;
+  Error error = Write(data, string, count, &wrote);
   if (error != 0 || wrote != count) {
     // TOOD(sbc): Do something more useful in response to a
     // failure to echo.
@@ -228,9 +232,10 @@
   return 0;
 }
 
-Error MountNodeTty::Ioctl(int request, char* arg) {
+Error MountNodeTty::VIoctl(int request, va_list args) {
   switch (request) {
     case TIOCNACLOUTPUT: {
+      struct tioc_nacl_output* arg = va_arg(args, struct tioc_nacl_output*);
       AUTO_LOCK(output_lock_);
       if (arg == NULL) {
         output_handler_.handler = NULL;
@@ -238,18 +243,18 @@
       }
       if (output_handler_.handler != NULL)
         return EALREADY;
-      output_handler_ = *reinterpret_cast<tioc_nacl_output*>(arg);
+      output_handler_ = *arg;
       return 0;
     }
     case TIOCNACLINPUT: {
       // This ioctl is used to deliver data from the user to this tty node's
       // input buffer.
       struct tioc_nacl_input_string* message =
-        reinterpret_cast<struct tioc_nacl_input_string*>(arg);
+        va_arg(args, struct tioc_nacl_input_string*);
       return ProcessInput(message);
     }
     case TIOCSWINSZ: {
-      struct winsize* size = reinterpret_cast<struct winsize*>(arg);
+      struct winsize* size = va_arg(args, struct winsize*);
       {
         AUTO_LOCK(node_lock_);
         rows_ = size->ws_row;
@@ -266,7 +271,7 @@
       return 0;
     }
     case TIOCGWINSZ: {
-      struct winsize* size = reinterpret_cast<struct winsize*>(arg);
+      struct winsize* size = va_arg(args, struct winsize*);
       size->ws_row = rows_;
       size->ws_col = cols_;
       return 0;