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

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

Issue 17234004: [NaCl SDK] Fix SDK waterfall: unistd.h does not exist on windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
11 #ifndef WIN32
12 // Needed for SEEK_SET/SEEK_CUR/SEEK_END.
13 #include <unistd.h>
14 #endif
15
16 #include "nacl_io/mount.h" 11 #include "nacl_io/mount.h"
17 #include "nacl_io/mount_node.h" 12 #include "nacl_io/mount_node.h"
13 #include "nacl_io/osunistd.h"
18 14
19 // It is only legal to construct a handle while the kernel lock is held. 15 // It is only legal to construct a handle while the kernel lock is held.
20 KernelHandle::KernelHandle(Mount* mnt, MountNode* node) 16 KernelHandle::KernelHandle(Mount* mnt, MountNode* node)
21 : mount_(mnt), node_(node), offs_(0) {} 17 : mount_(mnt), node_(node), offs_(0) {}
22 18
23 Error KernelHandle::Init(int open_mode) { 19 Error KernelHandle::Init(int open_mode) {
24 if (open_mode & O_APPEND) { 20 if (open_mode & O_APPEND) {
25 size_t node_size; 21 size_t node_size;
26 Error error = node_->GetSize(&offs_); 22 Error error = node_->GetSize(&offs_);
27 if (error) 23 if (error)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // end and the new end. 60 // end and the new end.
65 if (new_offset > node_size) { 61 if (new_offset > node_size) {
66 error = node_->FTruncate(new_offset); 62 error = node_->FTruncate(new_offset);
67 if (error) 63 if (error)
68 return EINVAL; 64 return EINVAL;
69 } 65 }
70 66
71 *out_offset = offs_ = new_offset; 67 *out_offset = offs_ = new_offset;
72 return 0; 68 return 0;
73 } 69 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/sdk_files.list ('k') | native_client_sdk/src/libraries/nacl_io/library.dsc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698