OLD | NEW |
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 // The entire file is wrapped in this #if. We do this so this .cc file can be | 5 // The entire file is wrapped in this #if. We do this so this .cc file can be |
6 // compiled, even on a non-Windows build. | 6 // compiled, even on a non-Windows build. |
7 #if defined(WIN32) | 7 #if defined(WIN32) |
8 | 8 |
9 #include "nacl_io/kernel_wrap.h" | 9 #include "nacl_io/kernel_wrap.h" |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 off_t _lseek(int fd, off_t offset, int whence) { | 123 off_t _lseek(int fd, off_t offset, int whence) { |
124 return ki_lseek(fd, offset, whence); | 124 return ki_lseek(fd, offset, whence); |
125 } | 125 } |
126 | 126 |
127 int _mkdir(const char* path) { | 127 int _mkdir(const char* path) { |
128 return ki_mkdir(path, 0777); | 128 return ki_mkdir(path, 0777); |
129 } | 129 } |
130 | 130 |
131 int _open(const char* path, int oflag, ...) { | 131 int _open(const char* path, int oflag, ...) { |
132 #if 0 | |
133 // TODO(binji): ki_open should use the pmode parameter. When it does, this | |
134 // will be necessary to add in. | |
135 va_list list; | 132 va_list list; |
136 int pmode = 0; | 133 int pmode = 0; |
137 if (oflag & _O_CREAT) { | 134 if (oflag & _O_CREAT) { |
138 va_start(list, oflag); | 135 va_start(list, oflag); |
139 pmode = va_arg(list, int); | 136 pmode = va_arg(list, int); |
140 va_end(list); | 137 va_end(list); |
141 } | 138 } |
142 #endif | 139 return ki_open(path, oflag, (mode_t) pmode); |
143 return ki_open(path, oflag); | |
144 } | 140 } |
145 | 141 |
146 int _sopen(const char* path, int oflag, int shflag) { | 142 int _sopen(const char* path, int oflag, int shflag) { |
147 return ki_open(path, oflag); | 143 return ki_open(path, oflag); |
148 } | 144 } |
149 | 145 |
150 errno_t _sopen_s(int* pfh, const char* path, int oflag, int shflag, int pmode) { | 146 errno_t _sopen_s(int* pfh, const char* path, int oflag, int shflag, int pmode) { |
151 *pfh = ki_open(path, oflag); | 147 *pfh = ki_open(path, oflag); |
152 return (*pfh < 0) ? errno : 0; | 148 return (*pfh < 0) ? errno : 0; |
153 } | 149 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // Do nothing for Windows, we replace the library at link time. | 225 // Do nothing for Windows, we replace the library at link time. |
230 void kernel_wrap_init() { | 226 void kernel_wrap_init() { |
231 } | 227 } |
232 | 228 |
233 void kernel_wrap_uninit() { | 229 void kernel_wrap_uninit() { |
234 } | 230 } |
235 | 231 |
236 EXTERN_C_END | 232 EXTERN_C_END |
237 | 233 |
238 #endif // defined(WIN32) | 234 #endif // defined(WIN32) |
OLD | NEW |