| 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 * Saves the current internal state. This is used by test code which can | 45 * Saves the current internal state. This is used by test code which can |
| 46 * use this to save the current state before calling ki_init(). The | 46 * use this to save the current state before calling ki_init(). The |
| 47 * pushed state is restored in the next call to ki_uninit(). | 47 * pushed state is restored in the next call to ki_uninit(). |
| 48 */ | 48 */ |
| 49 int ki_push_state_for_testing(); | 49 int ki_push_state_for_testing(); |
| 50 | 50 |
| 51 int ki_init_ppapi(void* kernel_proxy, | 51 int ki_init_ppapi(void* kernel_proxy, |
| 52 PP_Instance instance, | 52 PP_Instance instance, |
| 53 PPB_GetInterface get_browser_interface); | 53 PPB_GetInterface get_browser_interface); |
| 54 | 54 |
| 55 | |
| 56 /* | 55 /* |
| 57 * ki_init_interface() is a variant of ki_init() that can be called with | 56 * ki_init_interface() is a variant of ki_init() that can be called with |
| 58 * a PepperInterface object. | 57 * a PepperInterface object. |
| 59 */ | 58 */ |
| 60 int ki_init_interface(void* kernel_proxy, void* pepper_interface); | 59 int ki_init_interface(void* kernel_proxy, void* pepper_interface); |
| 61 | 60 |
| 62 #ifdef __cplusplus | 61 #ifdef __cplusplus |
| 63 nacl_io::KernelProxy* ki_get_proxy(); | 62 nacl_io::KernelProxy* ki_get_proxy(); |
| 64 #endif | 63 #endif |
| 65 | 64 |
| 66 int ki_is_initialized(); | 65 int ki_is_initialized(); |
| 67 void ki_uninit(); | 66 void ki_uninit(); |
| 68 | 67 |
| 69 int ki_chdir(const char* path); | 68 int ki_chdir(const char* path); |
| 70 void ki_exit(int status); | 69 void ki_exit(int status); |
| 71 char* ki_getcwd(char* buf, size_t size); | 70 char* ki_getcwd(char* buf, size_t size); |
| 72 char* ki_getwd(char* buf); | 71 char* ki_getwd(char* buf); |
| 73 int ki_dup(int oldfd); | 72 int ki_dup(int oldfd); |
| 74 int ki_dup2(int oldfd, int newfd); | 73 int ki_dup2(int oldfd, int newfd); |
| 75 int ki_chmod(const char* path, mode_t mode); | 74 int ki_chmod(const char* path, mode_t mode); |
| 76 int ki_fchdir(int fd); | 75 int ki_fchdir(int fd); |
| 77 int ki_fchmod(int fd, mode_t mode); | 76 int ki_fchmod(int fd, mode_t mode); |
| 78 int ki_stat(const char* path, struct stat* buf); | 77 int ki_stat(const char* path, struct stat* buf); |
| 79 int ki_mkdir(const char* path, mode_t mode); | 78 int ki_mkdir(const char* path, mode_t mode); |
| 80 int ki_rmdir(const char* path); | 79 int ki_rmdir(const char* path); |
| 81 int ki_mount(const char* source, const char* target, const char* filesystemtype, | 80 int ki_mount(const char* source, |
| 82 unsigned long mountflags, const void *data); | 81 const char* target, |
| 82 const char* filesystemtype, |
| 83 unsigned long mountflags, |
| 84 const void* data); |
| 83 int ki_umount(const char* path); | 85 int ki_umount(const char* path); |
| 84 int ki_open(const char* path, int oflag); | 86 int ki_open(const char* path, int oflag); |
| 85 int ki_pipe(int pipefds[2]); | 87 int ki_pipe(int pipefds[2]); |
| 86 ssize_t ki_read(int fd, void* buf, size_t nbyte); | 88 ssize_t ki_read(int fd, void* buf, size_t nbyte); |
| 87 ssize_t ki_write(int fd, const void* buf, size_t nbyte); | 89 ssize_t ki_write(int fd, const void* buf, size_t nbyte); |
| 88 int ki_fstat(int fd, struct stat *buf); | 90 int ki_fstat(int fd, struct stat* buf); |
| 89 int ki_getdents(int fd, void* buf, unsigned int count); | 91 int ki_getdents(int fd, void* buf, unsigned int count); |
| 90 int ki_fsync(int fd); | 92 int ki_fsync(int fd); |
| 91 int ki_fdatasync(int fd); | 93 int ki_fdatasync(int fd); |
| 92 int ki_ftruncate(int fd, off_t length); | 94 int ki_ftruncate(int fd, off_t length); |
| 93 int ki_isatty(int fd); | 95 int ki_isatty(int fd); |
| 94 int ki_close(int fd); | 96 int ki_close(int fd); |
| 95 off_t ki_lseek(int fd, off_t offset, int whence); | 97 off_t ki_lseek(int fd, off_t offset, int whence); |
| 96 int ki_remove(const char* path); | 98 int ki_remove(const char* path); |
| 97 int ki_unlink(const char* path); | 99 int ki_unlink(const char* path); |
| 98 int ki_truncate(const char* path, off_t length); | 100 int ki_truncate(const char* path, off_t length); |
| 99 int ki_lstat(const char* path, struct stat* buf); | 101 int ki_lstat(const char* path, struct stat* buf); |
| 100 int ki_link(const char* oldpath, const char* newpath); | 102 int ki_link(const char* oldpath, const char* newpath); |
| 101 int ki_rename(const char* oldpath, const char* newpath); | 103 int ki_rename(const char* oldpath, const char* newpath); |
| 102 int ki_symlink(const char* oldpath, const char* newpath); | 104 int ki_symlink(const char* oldpath, const char* newpath); |
| 103 int ki_access(const char* path, int amode); | 105 int ki_access(const char* path, int amode); |
| 104 int ki_readlink(const char *path, char *buf, size_t count); | 106 int ki_readlink(const char* path, char* buf, size_t count); |
| 105 int ki_utimes(const char *path, const struct timeval times[2]); | 107 int ki_utimes(const char* path, const struct timeval times[2]); |
| 106 void* ki_mmap(void* addr, size_t length, int prot, int flags, int fd, | 108 void* ki_mmap(void* addr, |
| 109 size_t length, |
| 110 int prot, |
| 111 int flags, |
| 112 int fd, |
| 107 off_t offset); | 113 off_t offset); |
| 108 int ki_munmap(void* addr, size_t length); | 114 int ki_munmap(void* addr, size_t length); |
| 109 int ki_open_resource(const char* file); | 115 int ki_open_resource(const char* file); |
| 110 int ki_fcntl(int d, int request, va_list args); | 116 int ki_fcntl(int d, int request, va_list args); |
| 111 int ki_ioctl(int d, int request, va_list args); | 117 int ki_ioctl(int d, int request, va_list args); |
| 112 int ki_chown(const char* path, uid_t owner, gid_t group); | 118 int ki_chown(const char* path, uid_t owner, gid_t group); |
| 113 int ki_fchown(int fd, uid_t owner, gid_t group); | 119 int ki_fchown(int fd, uid_t owner, gid_t group); |
| 114 int ki_lchown(const char* path, uid_t owner, gid_t group); | 120 int ki_lchown(const char* path, uid_t owner, gid_t group); |
| 115 int ki_utime(const char* filename, const struct utimbuf* times); | 121 int ki_utime(const char* filename, const struct utimbuf* times); |
| 116 | 122 |
| 117 int ki_poll(struct pollfd *fds, nfds_t nfds, int timeout); | 123 int ki_poll(struct pollfd* fds, nfds_t nfds, int timeout); |
| 118 int ki_select(int nfds, fd_set* readfds, fd_set* writefds, | 124 int ki_select(int nfds, |
| 119 fd_set* exceptfds, struct timeval* timeout); | 125 fd_set* readfds, |
| 126 fd_set* writefds, |
| 127 fd_set* exceptfds, |
| 128 struct timeval* timeout); |
| 120 | 129 |
| 121 int ki_tcflush(int fd, int queue_selector); | 130 int ki_tcflush(int fd, int queue_selector); |
| 122 int ki_tcgetattr(int fd, struct termios* termios_p); | 131 int ki_tcgetattr(int fd, struct termios* termios_p); |
| 123 int ki_tcsetattr(int fd, int optional_actions, | 132 int ki_tcsetattr(int fd, int optional_actions, const struct termios* termios_p); |
| 124 const struct termios *termios_p); | |
| 125 int ki_kill(pid_t pid, int sig); | 133 int ki_kill(pid_t pid, int sig); |
| 126 int ki_killpg(pid_t pid, int sig); | 134 int ki_killpg(pid_t pid, int sig); |
| 127 int ki_sigaction(int signum, const struct sigaction* action, | 135 int ki_sigaction(int signum, |
| 136 const struct sigaction* action, |
| 128 struct sigaction* oaction); | 137 struct sigaction* oaction); |
| 129 int ki_sigpause(int sigmask); | 138 int ki_sigpause(int sigmask); |
| 130 int ki_sigpending(sigset_t* set); | 139 int ki_sigpending(sigset_t* set); |
| 131 int ki_sigsuspend(const sigset_t* set); | 140 int ki_sigsuspend(const sigset_t* set); |
| 132 sighandler_t ki_signal(int signum, sighandler_t handler); | 141 sighandler_t ki_signal(int signum, sighandler_t handler); |
| 133 sighandler_t ki_sigset(int signum, sighandler_t handler); | 142 sighandler_t ki_sigset(int signum, sighandler_t handler); |
| 134 | 143 |
| 135 #ifdef PROVIDES_SOCKET_API | 144 #ifdef PROVIDES_SOCKET_API |
| 136 /* Socket Functions */ | 145 /* Socket Functions */ |
| 137 int ki_accept(int fd, struct sockaddr* addr, socklen_t* len); | 146 int ki_accept(int fd, struct sockaddr* addr, socklen_t* len); |
| 138 int ki_bind(int fd, const struct sockaddr* addr, socklen_t len); | 147 int ki_bind(int fd, const struct sockaddr* addr, socklen_t len); |
| 139 int ki_connect(int fd, const struct sockaddr* addr, socklen_t len); | 148 int ki_connect(int fd, const struct sockaddr* addr, socklen_t len); |
| 140 void ki_freeaddrinfo(struct addrinfo *res); | 149 void ki_freeaddrinfo(struct addrinfo* res); |
| 141 int ki_getaddrinfo(const char *node, const char *service, | 150 int ki_getaddrinfo(const char* node, |
| 142 const struct addrinfo *hints, | 151 const char* service, |
| 143 struct addrinfo **res); | 152 const struct addrinfo* hints, |
| 153 struct addrinfo** res); |
| 144 struct hostent* ki_gethostbyname(const char* name); | 154 struct hostent* ki_gethostbyname(const char* name); |
| 145 int ki_getpeername(int fd, struct sockaddr* addr, socklen_t* len); | 155 int ki_getpeername(int fd, struct sockaddr* addr, socklen_t* len); |
| 146 int ki_getsockname(int fd, struct sockaddr* addr, socklen_t* len); | 156 int ki_getsockname(int fd, struct sockaddr* addr, socklen_t* len); |
| 147 int ki_getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len); | 157 int ki_getsockopt(int fd, int lvl, int optname, void* optval, socklen_t* len); |
| 148 int ki_listen(int fd, int backlog); | 158 int ki_listen(int fd, int backlog); |
| 149 ssize_t ki_recv(int fd, void* buf, size_t len, int flags); | 159 ssize_t ki_recv(int fd, void* buf, size_t len, int flags); |
| 150 ssize_t ki_recvfrom(int fd, void* buf, size_t len, int flags, | 160 ssize_t ki_recvfrom(int fd, |
| 151 struct sockaddr* addr, socklen_t* addrlen); | 161 void* buf, |
| 162 size_t len, |
| 163 int flags, |
| 164 struct sockaddr* addr, |
| 165 socklen_t* addrlen); |
| 152 ssize_t ki_recvmsg(int fd, struct msghdr* msg, int flags); | 166 ssize_t ki_recvmsg(int fd, struct msghdr* msg, int flags); |
| 153 ssize_t ki_send(int fd, const void* buf, size_t len, int flags); | 167 ssize_t ki_send(int fd, const void* buf, size_t len, int flags); |
| 154 ssize_t ki_sendto(int fd, const void* buf, size_t len, int flags, | 168 ssize_t ki_sendto(int fd, |
| 155 const struct sockaddr* addr, socklen_t addrlen); | 169 const void* buf, |
| 170 size_t len, |
| 171 int flags, |
| 172 const struct sockaddr* addr, |
| 173 socklen_t addrlen); |
| 156 ssize_t ki_sendmsg(int fd, const struct msghdr* msg, int flags); | 174 ssize_t ki_sendmsg(int fd, const struct msghdr* msg, int flags); |
| 157 int ki_setsockopt(int fd, int lvl, int optname, const void* optval, | 175 int ki_setsockopt(int fd, |
| 176 int lvl, |
| 177 int optname, |
| 178 const void* optval, |
| 158 socklen_t len); | 179 socklen_t len); |
| 159 int ki_shutdown(int fd, int how); | 180 int ki_shutdown(int fd, int how); |
| 160 int ki_socket(int domain, int type, int protocol); | 181 int ki_socket(int domain, int type, int protocol); |
| 161 int ki_socketpair(int domain, int type, int protocl, int* sv); | 182 int ki_socketpair(int domain, int type, int protocl, int* sv); |
| 162 #endif /* PROVIDES_SOCKET_API */ | 183 #endif /* PROVIDES_SOCKET_API */ |
| 163 | 184 |
| 164 EXTERN_C_END | 185 EXTERN_C_END |
| 165 | 186 |
| 166 #endif /* LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ */ | 187 #endif /* LIBRARIES_NACL_IO_KERNEL_INTERCEPT_H_ */ |
| OLD | NEW |