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

Unified Diff: native_client_sdk/src/libraries/nacl_io/mount_node_stream.cc

Issue 23498015: [NaCl SDK] Support non blocking TCP/UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c3cbc23c32975b10a36ecf75aec3d4a3b62e2beb
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/mount_node_stream.cc
@@ -0,0 +1,58 @@
+// 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_;
+}
+
+bool MountNodeStream::TestStreamFlags(uint32_t bits) {
+ return (stream_state_flags_ & bits) == bits;
+}
+
+
+void MountNodeStream::QueueInput() {}
+void MountNodeStream::QueueOutput() {}
+
+MountStream* MountNodeStream::mount_stream() {
+ return static_cast<MountStream*>(mount_);
+}
+
+} // namespace nacl_io
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/mount_node_stream.h ('k') | native_client_sdk/src/libraries/nacl_io/mount_node_tcp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698