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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_handle.cc

Issue 22587003: [NaCl SDK] Add UDP and TCP Sockets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 7 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/kernel_handle.h" 5 #include "nacl_io/kernel_handle.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 10
(...skipping 11 matching lines...) Expand all
22 22
23 KernelHandle::KernelHandle(const ScopedMount& mnt, const ScopedMountNode& node) 23 KernelHandle::KernelHandle(const ScopedMount& mnt, const ScopedMountNode& node)
24 : mount_(mnt), node_(node), offs_(0) {} 24 : mount_(mnt), node_(node), offs_(0) {}
25 25
26 KernelHandle::~KernelHandle() { 26 KernelHandle::~KernelHandle() {
27 // Force release order for cases where mount_ is not ref'd by mounting. 27 // Force release order for cases where mount_ is not ref'd by mounting.
28 node_.reset(NULL); 28 node_.reset(NULL);
29 mount_.reset(NULL); 29 mount_.reset(NULL);
30 } 30 }
31 31
32 // Returns the MountNodeSocket* if this node is a socket.
33 MountNodeSocket* KernelHandle::socket_node() {
34 if (node_.get() && node_->IsaSock())
35 return reinterpret_cast<MountNodeSocket*>(node_.get());
binji 2013/08/09 23:08:27 static_cast
36 return NULL;
37 }
38
32 Error KernelHandle::Init(int open_mode) { 39 Error KernelHandle::Init(int open_mode) {
33 if (open_mode & O_APPEND) { 40 if (open_mode & O_APPEND) {
34 Error error = node_->GetSize(&offs_); 41 Error error = node_->GetSize(&offs_);
35 if (error) 42 if (error)
36 return error; 43 return error;
37 } 44 }
38 45
39 return 0; 46 return 0;
40 } 47 }
41 48
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 106
100 Error KernelHandle::GetDents(struct dirent* pdir, size_t nbytes, int* cnt) { 107 Error KernelHandle::GetDents(struct dirent* pdir, size_t nbytes, int* cnt) {
101 AUTO_LOCK(offs_lock_); 108 AUTO_LOCK(offs_lock_);
102 Error error = node_->GetDents(offs_, pdir, nbytes, cnt); 109 Error error = node_->GetDents(offs_, pdir, nbytes, cnt);
103 if (0 == error) 110 if (0 == error)
104 offs_ += *cnt; 111 offs_ += *cnt;
105 return error; 112 return error;
106 } 113 }
107 114
108 } // namespace nacl_io 115 } // namespace nacl_io
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_handle.h ('k') | native_client_sdk/src/libraries/nacl_io/kernel_intercept.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698