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

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

Issue 59883020: [NaCl SDK] nacl_io: Enable isatty running under sel_ldr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 <sys/types.h> // Include something that will define __GLIBC__. 5 #include <sys/types.h> // Include something that will define __GLIBC__.
6 6
7 // The entire file is wrapped in this #if. We do this so this .cc file can be 7 // The entire file is wrapped in this #if. We do this so this .cc file can be
8 // compiled, even on a non-newlib build. 8 // compiled, even on a non-newlib build.
9 #if defined(__native_client__) && !defined(__GLIBC__) 9 #if defined(__native_client__) && !defined(__GLIBC__)
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 OP(fdio, read); \ 60 OP(fdio, read); \
61 OP(fdio, write); \ 61 OP(fdio, write); \
62 OP(fdio, seek); \ 62 OP(fdio, seek); \
63 OP(fdio, fstat); \ 63 OP(fdio, fstat); \
64 OP(fdio, getdents); \ 64 OP(fdio, getdents); \
65 OP(dev_fdio, fchdir); \ 65 OP(dev_fdio, fchdir); \
66 OP(dev_fdio, fchmod); \ 66 OP(dev_fdio, fchmod); \
67 OP(dev_fdio, fsync); \ 67 OP(dev_fdio, fsync); \
68 OP(dev_fdio, fdatasync); \ 68 OP(dev_fdio, fdatasync); \
69 OP(dev_fdio, ftruncate); \ 69 OP(dev_fdio, ftruncate); \
70 OP(dev_fdio, isatty); \
70 OP(dev_filename, open); \ 71 OP(dev_filename, open); \
71 OP(dev_filename, stat); \ 72 OP(dev_filename, stat); \
72 OP(dev_filename, mkdir); \ 73 OP(dev_filename, mkdir); \
73 OP(dev_filename, rmdir); \ 74 OP(dev_filename, rmdir); \
74 OP(dev_filename, chdir); \ 75 OP(dev_filename, chdir); \
75 OP(dev_filename, getcwd); \ 76 OP(dev_filename, getcwd); \
76 OP(dev_filename, unlink); \ 77 OP(dev_filename, unlink); \
77 OP(dev_filename, truncate); \ 78 OP(dev_filename, truncate); \
78 OP(dev_filename, lstat); \ 79 OP(dev_filename, lstat); \
79 OP(dev_filename, link); \ 80 OP(dev_filename, link); \
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 146 }
146 147
147 int WRAP(fdatasync)(int fd) { 148 int WRAP(fdatasync)(int fd) {
148 return (ki_fdatasync(fd) < 0) ? errno : 0; 149 return (ki_fdatasync(fd) < 0) ? errno : 0;
149 } 150 }
150 151
151 int WRAP(ftruncate)(int fd, off_t length) { 152 int WRAP(ftruncate)(int fd, off_t length) {
152 return (ki_ftruncate(fd, length) < 0) ? errno : 0; 153 return (ki_ftruncate(fd, length) < 0) ? errno : 0;
153 } 154 }
154 155
156 int WRAP(isatty)(int fd, int* result) {
157 *result = ki_isatty(fd);
158 if (*result == 1)
159 return errno;
160 return 0;
161 }
162
155 int WRAP(mmap)(void** addr, size_t length, int prot, int flags, int fd, 163 int WRAP(mmap)(void** addr, size_t length, int prot, int flags, int fd,
156 off_t offset) { 164 off_t offset) {
157 if (flags & MAP_ANONYMOUS) 165 if (flags & MAP_ANONYMOUS)
158 return REAL(mmap)(addr, length, prot, flags, fd, offset); 166 return REAL(mmap)(addr, length, prot, flags, fd, offset);
159 167
160 *addr = ki_mmap(*addr, length, prot, flags, fd, offset); 168 *addr = ki_mmap(*addr, length, prot, flags, fd, offset);
161 return *addr == (void*)-1 ? errno : 0; 169 return *addr == (void*)-1 ? errno : 0;
162 } 170 }
163 171
164 int WRAP(munmap)(void* addr, size_t length) { 172 int WRAP(munmap)(void* addr, size_t length) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 int _real_close(int fd) { 267 int _real_close(int fd) {
260 CHECK_REAL(close); 268 CHECK_REAL(close);
261 return REAL(close)(fd); 269 return REAL(close)(fd);
262 } 270 }
263 271
264 int _real_fstat(int fd, struct stat* buf) { 272 int _real_fstat(int fd, struct stat* buf) {
265 CHECK_REAL(fstat); 273 CHECK_REAL(fstat);
266 return REAL(fstat)(fd, buf); 274 return REAL(fstat)(fd, buf);
267 } 275 }
268 276
277 int _real_isatty(int fd, int* result) {
278 CHECK_REAL(isatty);
279 return REAL(isatty)(fd, result);
280 }
281
269 int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t* nread) { 282 int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t* nread) {
270 CHECK_REAL(getdents); 283 CHECK_REAL(getdents);
271 return REAL(getdents)(fd, static_cast<dirent*>(nacl_buf), nacl_count, nread); 284 return REAL(getdents)(fd, static_cast<dirent*>(nacl_buf), nacl_count, nread);
272 } 285 }
273 286
274 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { 287 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) {
275 CHECK_REAL(seek); 288 CHECK_REAL(seek);
276 return REAL(seek)(fd, offset, whence, new_offset); 289 return REAL(seek)(fd, offset, whence, new_offset);
277 } 290 }
278 291
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 void kernel_wrap_uninit() { 340 void kernel_wrap_uninit() {
328 if (s_wrapped) { 341 if (s_wrapped) {
329 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) 342 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL)
330 s_wrapped = false; 343 s_wrapped = false;
331 } 344 }
332 } 345 }
333 346
334 EXTERN_C_END 347 EXTERN_C_END
335 348
336 #endif // defined(__native_client__) && !defined(__GLIBC__) 349 #endif // defined(__native_client__) && !defined(__GLIBC__)
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc ('k') | native_client_sdk/src/libraries/nacl_io/kernel_wrap_real.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698