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 #ifndef LIBRARIES_NACL_MOUNTS_KERNEL_INTERCEPT_H_ | 5 #ifndef LIBRARIES_NACL_MOUNTS_KERNEL_INTERCEPT_H_ |
6 #define LIBRARIES_NACL_MOUNTS_KERNEL_INTERCEPT_H_ | 6 #define LIBRARIES_NACL_MOUNTS_KERNEL_INTERCEPT_H_ |
7 | 7 |
8 #include "nacl_mounts/ostypes.h" | 8 #include "nacl_mounts/ostypes.h" |
9 #include "utils/macros.h" | 9 #include "utils/macros.h" |
10 | 10 |
11 EXTERN_C_BEGIN | 11 EXTERN_C_BEGIN |
12 | 12 |
13 // The kernel intercept module provides a C->C++ thunk between the libc | 13 // The kernel intercept module provides a C->C++ thunk between the libc |
14 // kernel calls and the KernelProxy singleton. | 14 // kernel calls and the KernelProxy singleton. |
15 | 15 |
16 // ki_init must be called with an uninitialized KernelProxy object. Calling | 16 // ki_init must be called with an uninitialized KernelProxy object. Calling |
17 // with NULL will instantiate a default kernel proxy object. ki_init must | 17 // with NULL will instantiate a default kernel proxy object. ki_init must |
18 // be called before any other ki_XXX function can be used. | 18 // be called before any other ki_XXX function can be used. |
19 void ki_init(void* kernel_proxy); | 19 void ki_init(void* kernel_proxy); |
| 20 int ki_is_initialized(); |
20 | 21 |
21 int ki_chdir(const char* path); | 22 int ki_chdir(const char* path); |
22 char* ki_getcwd(char* buf, size_t size); | 23 char* ki_getcwd(char* buf, size_t size); |
23 char* ki_getwd(char* buf); | 24 char* ki_getwd(char* buf); |
24 int ki_dup(int oldfd); | 25 int ki_dup(int oldfd); |
25 int ki_chmod(const char* path, mode_t mode); | 26 int ki_chmod(const char* path, mode_t mode); |
26 int ki_stat(const char* path, struct stat* buf); | 27 int ki_stat(const char* path, struct stat* buf); |
27 int ki_mkdir(const char* path, mode_t mode); | 28 int ki_mkdir(const char* path, mode_t mode); |
28 int ki_rmdir(const char* path); | 29 int ki_rmdir(const char* path); |
29 int ki_mount(const char* source, const char* target, const char* filesystemtype, | 30 int ki_mount(const char* source, const char* target, const char* filesystemtype, |
30 unsigned long mountflags, const void *data); | 31 unsigned long mountflags, const void *data); |
31 int ki_umount(const char* path); | 32 int ki_umount(const char* path); |
32 int ki_open(const char* path, int oflag); | 33 int ki_open(const char* path, int oflag); |
33 ssize_t ki_read(int fd, void* buf, size_t nbyte); | 34 ssize_t ki_read(int fd, void* buf, size_t nbyte); |
34 ssize_t ki_write(int fd, const void* buf, size_t nbyte); | 35 ssize_t ki_write(int fd, const void* buf, size_t nbyte); |
35 int ki_fstat(int fd, struct stat *buf); | 36 int ki_fstat(int fd, struct stat *buf); |
36 int ki_getdents(int fd, void* buf, unsigned int count); | 37 int ki_getdents(int fd, void* buf, unsigned int count); |
37 int ki_fsync(int fd); | 38 int ki_fsync(int fd); |
38 int ki_isatty(int fd); | 39 int ki_isatty(int fd); |
39 int ki_close(int fd); | 40 int ki_close(int fd); |
| 41 off_t ki_lseek(int fd, off_t offset, int whence); |
40 int ki_remove(const char* path); | 42 int ki_remove(const char* path); |
41 int ki_unlink(const char* path); | 43 int ki_unlink(const char* path); |
42 int ki_access(const char* path, int amode); | 44 int ki_access(const char* path, int amode); |
43 | 45 |
44 EXTERN_C_END | 46 EXTERN_C_END |
45 | 47 |
46 #endif // LIBRARIES_NACL_MOUNTS_KERNEL_INTERCEPT_H_ | 48 #endif // LIBRARIES_NACL_MOUNTS_KERNEL_INTERCEPT_H_ |
OLD | NEW |