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

Side by Side Diff: native_client_sdk/src/libraries/nacl_mounts/kernel_intercept.cc

Issue 11066105: [NaCl SDK] nacl_mounts: wrap functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 8 years, 2 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_mounts/kernel_intercept.h" 5 #include "nacl_mounts/kernel_intercept.h"
6 6
7 #include "nacl_mounts/kernel_proxy.h" 7 #include "nacl_mounts/kernel_proxy.h"
8 8
9 static KernelProxy* s_kp; 9 static KernelProxy* s_kp;
10 10
11 void ki_init(void* kp) { 11 void ki_init(void* kp) {
12 if (kp == NULL) kp = new KernelProxy(); 12 if (kp == NULL) kp = new KernelProxy();
13 s_kp = static_cast<KernelProxy*>(kp); 13 s_kp = static_cast<KernelProxy*>(kp);
14 s_kp->Init(); 14 s_kp->Init();
15 } 15 }
16 16
17 int ki_is_initialized() {
18 return s_kp != NULL;
19 }
20
17 int ki_chdir(const char* path) { 21 int ki_chdir(const char* path) {
18 return s_kp->chdir(path); 22 return s_kp->chdir(path);
19 } 23 }
20 24
21 char* ki_getcwd(char* buf, size_t size) { 25 char* ki_getcwd(char* buf, size_t size) {
22 return s_kp->getcwd(buf, size); 26 return s_kp->getcwd(buf, size);
23 } 27 }
24 28
25 char* ki_getwd(char* buf) { 29 char* ki_getwd(char* buf) {
26 return s_kp->getwd(buf); 30 return s_kp->getwd(buf);
(...skipping 16 matching lines...) Expand all
43 } 47 }
44 48
45 int ki_rmdir(const char *path) { 49 int ki_rmdir(const char *path) {
46 return s_kp->rmdir(path); 50 return s_kp->rmdir(path);
47 } 51 }
48 52
49 int ki_mount(const char *source, const char *target, const char *filesystemtype, 53 int ki_mount(const char *source, const char *target, const char *filesystemtype,
50 unsigned long mountflags, const void *data) { 54 unsigned long mountflags, const void *data) {
51 return s_kp->mount(source, target, filesystemtype, mountflags, data); 55 return s_kp->mount(source, target, filesystemtype, mountflags, data);
52 } 56 }
57
53 int ki_umount(const char *path) { 58 int ki_umount(const char *path) {
54 return s_kp->umount(path); 59 return s_kp->umount(path);
55 } 60 }
61
56 int ki_open(const char *path, int oflag) { 62 int ki_open(const char *path, int oflag) {
57 return s_kp->open(path, oflag); 63 return s_kp->open(path, oflag);
58 } 64 }
59 65
60 ssize_t ki_read(int fd, void *buf, size_t nbyte) { 66 ssize_t ki_read(int fd, void *buf, size_t nbyte) {
61 return s_kp->read(fd, buf, nbyte); 67 return s_kp->read(fd, buf, nbyte);
62 } 68 }
63 69
64 ssize_t ki_write(int fd, const void *buf, size_t nbyte) { 70 ssize_t ki_write(int fd, const void *buf, size_t nbyte) {
65 return s_kp->write(fd, buf, nbyte); 71 return s_kp->write(fd, buf, nbyte);
(...skipping 12 matching lines...) Expand all
78 } 84 }
79 85
80 int ki_isatty(int fd) { 86 int ki_isatty(int fd) {
81 return s_kp->isatty(fd); 87 return s_kp->isatty(fd);
82 } 88 }
83 89
84 int ki_close(int fd) { 90 int ki_close(int fd) {
85 return s_kp->close(fd); 91 return s_kp->close(fd);
86 } 92 }
87 93
94 off_t ki_lseek(int fd, off_t offset, int whence) {
95 return s_kp->lseek(fd, offset, whence);
96 }
97
88 int ki_remove(const char* path) { 98 int ki_remove(const char* path) {
89 return s_kp->remove(path); 99 return s_kp->remove(path);
90 } 100 }
91 101
92 int ki_unlink(const char* path) { 102 int ki_unlink(const char* path) {
93 return s_kp->unlink(path); 103 return s_kp->unlink(path);
94 } 104 }
95 105
96 int ki_access(const char* path, int amode) { 106 int ki_access(const char* path, int amode) {
97 return s_kp->access(path, amode); 107 return s_kp->access(path, amode);
98 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698