 Chromium Code Reviews
 Chromium Code Reviews Issue 23498015:
  [NaCl SDK] Support non blocking TCP/UDP  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 23498015:
  [NaCl SDK] Support non blocking TCP/UDP  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: native_client_sdk/src/libraries/nacl_io/mount_node_stream.cc | 
| diff --git a/native_client_sdk/src/libraries/nacl_io/mount_node_stream.cc b/native_client_sdk/src/libraries/nacl_io/mount_node_stream.cc | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..8de1b6673b87b51293a9906633c24a8bff720b3d | 
| --- /dev/null | 
| +++ b/native_client_sdk/src/libraries/nacl_io/mount_node_stream.cc | 
| @@ -0,0 +1,53 @@ | 
| +// Copyright (c) 2013 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/mount_node_stream.h" | 
| + | 
| +#include <errno.h> | 
| +#include <fcntl.h> | 
| +#include <pthread.h> | 
| +#include <string.h> | 
| + | 
| +#include "nacl_io/ioctl.h" | 
| +#include "nacl_io/mount_stream.h" | 
| +#include "sdk_util/atomicops.h" | 
| + | 
| + | 
| +namespace nacl_io { | 
| + | 
| +MountNodeStream::MountNodeStream(Mount* mnt) | 
| + : MountNode(mnt), | 
| + read_timeout_(-1), | 
| + write_timeout_(-1), | 
| + stream_state_flags_(0) { | 
| +} | 
| + | 
| +Error MountNodeStream::Init(int perm) { | 
| + MountNode::Init(perm); | 
| + if (perm & O_NONBLOCK) | 
| + SetStreamFlags(SSF_NON_BLOCK); | 
| + | 
| + return 0; | 
| +} | 
| + | 
| +void MountNodeStream::SetStreamFlags(uint32_t bits) { | 
| + sdk_util::AtomicOrFetch(&stream_state_flags_, bits); | 
| +} | 
| + | 
| +void MountNodeStream::ClearStreamFlags(uint32_t bits) { | 
| + sdk_util::AtomicAndFetch(&stream_state_flags_, ~bits); | 
| +} | 
| + | 
| +uint32_t MountNodeStream::GetStreamFlags() { | 
| + return stream_state_flags_; | 
| +} | 
| + | 
| +void MountNodeStream::QueueInput() {} | 
| +void MountNodeStream::QueueOutput() {} | 
| + | 
| +MountStream* MountNodeStream::mount_stream() { | 
| + return reinterpret_cast<MountStream*>(mount_); | 
| 
binji
2013/09/15 22:18:58
static_cast
 
noelallen1
2013/09/17 21:21:54
Done.
 | 
| +} | 
| + | 
| +} // namespace nacl_io |