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_IO_KERNEL_INTERCEPT_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ |
6 #define LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ | 6 #define LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <sys/time.h> | 9 #include <sys/time.h> |
10 | 10 |
11 #include <ppapi/c/ppb.h> | 11 #include <ppapi/c/ppb.h> |
12 #include <ppapi/c/pp_instance.h> | 12 #include <ppapi/c/pp_instance.h> |
13 | 13 |
14 #include "nacl_io/ossignal.h" | 14 #include "nacl_io/ossignal.h" |
15 #include "nacl_io/ossocket.h" | 15 #include "nacl_io/ossocket.h" |
16 #include "nacl_io/osstat.h" | 16 #include "nacl_io/osstat.h" |
17 #include "nacl_io/ostermios.h" | 17 #include "nacl_io/ostermios.h" |
18 #include "nacl_io/ostypes.h" | 18 #include "nacl_io/ostypes.h" |
19 #include "nacl_io/osutime.h" | 19 #include "nacl_io/osutime.h" |
20 #include "sdk_util/macros.h" | 20 #include "sdk_util/macros.h" |
21 | 21 |
22 EXTERN_C_BEGIN | 22 EXTERN_C_BEGIN |
23 | 23 |
24 struct fuse_operations; | 24 struct fuse_operations; |
25 | 25 |
26 // The kernel intercept module provides a C->C++ thunk between the libc | 26 /* |
27 // kernel calls and the KernelProxy singleton. | 27 * The kernel intercept module provides a C->C++ thunk between the libc |
| 28 * kernel calls and the KernelProxy singleton. |
| 29 */ |
28 | 30 |
29 // ki_init must be called with an uninitialized KernelProxy object. Calling | 31 /* |
30 // with NULL will instantiate a default kernel proxy object. ki_init must | 32 * ki_init must be called with an uninitialized KernelProxy object. Calling |
31 // be called before any other ki_XXX function can be used. | 33 * with NULL will instantiate a default kernel proxy object. ki_init must |
| 34 * be called before any other ki_XXX function can be used. |
| 35 */ |
32 void ki_init(void* kernel_proxy); | 36 void ki_init(void* kernel_proxy); |
33 void ki_init_ppapi(void* kernel_proxy, | 37 void ki_init_ppapi(void* kernel_proxy, |
34 PP_Instance instance, | 38 PP_Instance instance, |
35 PPB_GetInterface get_browser_interface); | 39 PPB_GetInterface get_browser_interface); |
| 40 |
| 41 /* |
| 42 * ki_init_interface() is a variant of ki_init() that can be called with |
| 43 * a PepperInterface object. The ownership of this object then passes |
| 44 * to nacl_io and it will be deleted on ki_uninit(). |
| 45 */ |
| 46 void ki_init_interface(void* kp, void* pepper_interface); |
| 47 |
36 int ki_register_fs_type(const char* fs_type, struct fuse_operations* fuse_ops); | 48 int ki_register_fs_type(const char* fs_type, struct fuse_operations* fuse_ops); |
37 int ki_unregister_fs_type(const char* fs_type); | 49 int ki_unregister_fs_type(const char* fs_type); |
38 int ki_is_initialized(); | 50 int ki_is_initialized(); |
39 void ki_uninit(); | 51 void ki_uninit(); |
40 | 52 |
41 int ki_chdir(const char* path); | 53 int ki_chdir(const char* path); |
42 char* ki_getcwd(char* buf, size_t size); | 54 char* ki_getcwd(char* buf, size_t size); |
43 char* ki_getwd(char* buf); | 55 char* ki_getwd(char* buf); |
44 int ki_dup(int oldfd); | 56 int ki_dup(int oldfd); |
45 int ki_dup2(int oldfd, int newfd); | 57 int ki_dup2(int oldfd, int newfd); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 int ki_killpg(pid_t pid, int sig); | 109 int ki_killpg(pid_t pid, int sig); |
98 int ki_sigaction(int signum, const struct sigaction* action, | 110 int ki_sigaction(int signum, const struct sigaction* action, |
99 struct sigaction* oaction); | 111 struct sigaction* oaction); |
100 int ki_sigpause(int sigmask); | 112 int ki_sigpause(int sigmask); |
101 int ki_sigpending(sigset_t* set); | 113 int ki_sigpending(sigset_t* set); |
102 int ki_sigsuspend(const sigset_t* set); | 114 int ki_sigsuspend(const sigset_t* set); |
103 sighandler_t ki_signal(int signum, sighandler_t handler); | 115 sighandler_t ki_signal(int signum, sighandler_t handler); |
104 sighandler_t ki_sigset(int signum, sighandler_t handler); | 116 sighandler_t ki_sigset(int signum, sighandler_t handler); |
105 | 117 |
106 #ifdef PROVIDES_SOCKET_API | 118 #ifdef PROVIDES_SOCKET_API |
107 // Socket Functions | 119 /* Socket Functions */ |
108 int ki_accept(int fd, struct sockaddr* addr, socklen_t* len); | 120 int ki_accept(int fd, struct sockaddr* addr, socklen_t* len); |
109 int ki_bind(int fd, const struct sockaddr* addr, socklen_t len); | 121 int ki_bind(int fd, const struct sockaddr* addr, socklen_t len); |
110 int ki_connect(int fd, const struct sockaddr* addr, socklen_t len); | 122 int ki_connect(int fd, const struct sockaddr* addr, socklen_t len); |
111 struct hostent* ki_gethostbyname(const char* name); | 123 struct hostent* ki_gethostbyname(const char* name); |
112 int ki_getpeername(int fd, struct sockaddr* addr, socklen_t* len); | 124 int ki_getpeername(int fd, struct sockaddr* addr, socklen_t* len); |
113 int ki_getsockname(int fd, struct sockaddr* addr, socklen_t* len); | 125 int ki_getsockname(int fd, struct sockaddr* addr, socklen_t* len); |
114 int ki_getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len); | 126 int ki_getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len); |
115 int ki_listen(int fd, int backlog); | 127 int ki_listen(int fd, int backlog); |
116 ssize_t ki_recv(int fd, void* buf, size_t len, int flags); | 128 ssize_t ki_recv(int fd, void* buf, size_t len, int flags); |
117 ssize_t ki_recvfrom(int fd, void* buf, size_t len, int flags, | 129 ssize_t ki_recvfrom(int fd, void* buf, size_t len, int flags, |
118 struct sockaddr* addr, socklen_t* addrlen); | 130 struct sockaddr* addr, socklen_t* addrlen); |
119 ssize_t ki_recvmsg(int fd, struct msghdr* msg, int flags); | 131 ssize_t ki_recvmsg(int fd, struct msghdr* msg, int flags); |
120 ssize_t ki_send(int fd, const void* buf, size_t len, int flags); | 132 ssize_t ki_send(int fd, const void* buf, size_t len, int flags); |
121 ssize_t ki_sendto(int fd, const void* buf, size_t len, int flags, | 133 ssize_t ki_sendto(int fd, const void* buf, size_t len, int flags, |
122 const struct sockaddr* addr, socklen_t addrlen); | 134 const struct sockaddr* addr, socklen_t addrlen); |
123 ssize_t ki_sendmsg(int fd, const struct msghdr* msg, int flags); | 135 ssize_t ki_sendmsg(int fd, const struct msghdr* msg, int flags); |
124 int ki_setsockopt(int fd, int lvl, int optname, const void* optval, | 136 int ki_setsockopt(int fd, int lvl, int optname, const void* optval, |
125 socklen_t len); | 137 socklen_t len); |
126 int ki_shutdown(int fd, int how); | 138 int ki_shutdown(int fd, int how); |
127 int ki_socket(int domain, int type, int protocol); | 139 int ki_socket(int domain, int type, int protocol); |
128 int ki_socketpair(int domain, int type, int protocl, int* sv); | 140 int ki_socketpair(int domain, int type, int protocl, int* sv); |
129 #endif // PROVIDES_SOCKET_API | 141 #endif /* PROVIDES_SOCKET_API */ |
130 | 142 |
131 EXTERN_C_END | 143 EXTERN_C_END |
132 | 144 |
133 #endif // LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ | 145 #endif /* LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ */ |
OLD | NEW |