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