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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "nacl_io/mount_node_stream.h"
6
7 #include <errno.h>
8 #include <fcntl.h>
9 #include <pthread.h>
10 #include <string.h>
11
12 #include "nacl_io/ioctl.h"
13 #include "nacl_io/mount_stream.h"
14 #include "sdk_util/atomicops.h"
15
16
17 namespace nacl_io {
18
19 MountNodeStream::MountNodeStream(Mount* mnt)
20 : MountNode(mnt),
21 read_timeout_(-1),
22 write_timeout_(-1),
23 stream_state_flags_(0) {
24 }
25
26 Error MountNodeStream::Init(int perm) {
27 MountNode::Init(perm);
28 if (perm & O_NONBLOCK)
29 SetStreamFlags(SSF_NON_BLOCK);
30
31 return 0;
32 }
33
34 void MountNodeStream::SetStreamFlags(uint32_t bits) {
35 sdk_util::AtomicOrFetch(&stream_state_flags_, bits);
36 }
37
38 void MountNodeStream::ClearStreamFlags(uint32_t bits) {
39 sdk_util::AtomicAndFetch(&stream_state_flags_, ~bits);
40 }
41
42 uint32_t MountNodeStream::GetStreamFlags() {
43 return stream_state_flags_;
44 }
45
46 bool MountNodeStream::TestStreamFlags(uint32_t bits) {
47 return (stream_state_flags_ & bits) == bits;
48 }
49
50
51 void MountNodeStream::QueueInput() {}
52 void MountNodeStream::QueueOutput() {}
53
54 MountStream* MountNodeStream::mount_stream() {
55 return static_cast<MountStream*>(mount_);
56 }
57
58 } // namespace nacl_io
OLDNEW
« 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