| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_ | 6 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_ |
| 7 #define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_ | 7 #define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_ |
| 8 | 8 |
| 9 #include <stdarg.h> | 9 #include <stdarg.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 | 12 |
| 13 struct dirent; | 13 struct dirent; |
| 14 struct stat; | 14 struct stat; |
| 15 struct timeval; | 15 struct timeval; |
| 16 | 16 |
| 17 struct NaClMemMappingInfo; | 17 struct NaClMemMappingInfo; |
| 18 | 18 |
| 19 #include <spawn.h> |
| 20 |
| 19 #if defined(__cplusplus) | 21 #if defined(__cplusplus) |
| 20 extern "C" { | 22 extern "C" { |
| 21 #endif | 23 #endif |
| 22 | 24 |
| 23 #define NACL_IRT_DEV_FDIO_v0_2 "nacl-irt-dev-fdio-0.2" | 25 #define NACL_IRT_DEV_FDIO_v0_2 "nacl-irt-dev-fdio-0.2" |
| 26 struct nacl_irt_dev_fdio_v0_2 { |
| 27 int (*close)(int fd); |
| 28 int (*dup)(int fd, int *newfd); |
| 29 int (*dup2)(int fd, int newfd); |
| 30 int (*read)(int fd, void *buf, size_t count, size_t *nread); |
| 31 int (*write)(int fd, const void *buf, size_t count, size_t *nwrote); |
| 32 int (*seek)(int fd, off_t offset, int whence, off_t *new_offset); |
| 33 int (*fstat)(int fd, struct stat *); |
| 34 int (*getdents)(int fd, struct dirent *, size_t count, size_t *nread); |
| 35 int (*fchdir)(int fd); |
| 36 int (*fchmod)(int fd, mode_t mode); |
| 37 int (*fsync)(int fd); |
| 38 int (*fdatasync)(int fd); |
| 39 int (*ftruncate)(int fd, off_t length); |
| 40 }; |
| 41 |
| 42 #define NACL_IRT_DEV_FDIO_v0_3 "nacl-irt-dev-fdio-0.3" |
| 24 struct nacl_irt_dev_fdio { | 43 struct nacl_irt_dev_fdio { |
| 25 int (*close)(int fd); | 44 int (*close)(int fd); |
| 26 int (*dup)(int fd, int *newfd); | 45 int (*dup)(int fd, int *newfd); |
| 27 int (*dup2)(int fd, int newfd); | 46 int (*dup2)(int fd, int newfd); |
| 28 int (*read)(int fd, void *buf, size_t count, size_t *nread); | 47 int (*read)(int fd, void *buf, size_t count, size_t *nread); |
| 29 int (*write)(int fd, const void *buf, size_t count, size_t *nwrote); | 48 int (*write)(int fd, const void *buf, size_t count, size_t *nwrote); |
| 30 int (*seek)(int fd, off_t offset, int whence, off_t *new_offset); | 49 int (*seek)(int fd, off_t offset, int whence, off_t *new_offset); |
| 31 int (*fstat)(int fd, struct stat *); | 50 int (*fstat)(int fd, struct stat *); |
| 32 int (*getdents)(int fd, struct dirent *, size_t count, size_t *nread); | 51 int (*getdents)(int fd, struct dirent *, size_t count, size_t *nread); |
| 33 int (*fchdir)(int fd); | 52 int (*fchdir)(int fd); |
| 34 int (*fchmod)(int fd, mode_t mode); | 53 int (*fchmod)(int fd, mode_t mode); |
| 35 int (*fsync)(int fd); | 54 int (*fsync)(int fd); |
| 36 int (*fdatasync)(int fd); | 55 int (*fdatasync)(int fd); |
| 37 int (*ftruncate)(int fd, off_t length); | 56 int (*ftruncate)(int fd, off_t length); |
| 57 int (*pipe)(int pipefd[2]); |
| 38 }; | 58 }; |
| 39 | 59 |
| 40 /* | 60 /* |
| 41 * The "irt-dev-filename" is similiar to "irt-filename" but provides | 61 * The "irt-dev-filename" is similiar to "irt-filename" but provides |
| 42 * additional functions, including those that do directory manipulation. | 62 * additional functions, including those that do directory manipulation. |
| 43 * Inside Chromium, requests for this interface may fail, or may return | 63 * Inside Chromium, requests for this interface may fail, or may return |
| 44 * functions which always return errors. | 64 * functions which always return errors. |
| 45 */ | 65 */ |
| 46 #define NACL_IRT_DEV_FILENAME_v0_2 "nacl-irt-dev-filename-0.2" | 66 #define NACL_IRT_DEV_FILENAME_v0_2 "nacl-irt-dev-filename-0.2" |
| 47 struct nacl_irt_dev_filename_v0_2 { | 67 struct nacl_irt_dev_filename_v0_2 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 74 int (*utimes)(const char *filename, const struct timeval *times); | 94 int (*utimes)(const char *filename, const struct timeval *times); |
| 75 }; | 95 }; |
| 76 | 96 |
| 77 #define NACL_IRT_DEV_LIST_MAPPINGS_v0_1 \ | 97 #define NACL_IRT_DEV_LIST_MAPPINGS_v0_1 \ |
| 78 "nacl-irt-dev-list-mappings-0.1" | 98 "nacl-irt-dev-list-mappings-0.1" |
| 79 struct nacl_irt_dev_list_mappings { | 99 struct nacl_irt_dev_list_mappings { |
| 80 int (*list_mappings)(struct NaClMemMappingInfo *regions, | 100 int (*list_mappings)(struct NaClMemMappingInfo *regions, |
| 81 size_t count, size_t *result_count); | 101 size_t count, size_t *result_count); |
| 82 }; | 102 }; |
| 83 | 103 |
| 104 #define NACL_IRT_DEV_PROCESS_v0_1 "nacl-irt-dev-process-0.1" |
| 105 struct nacl_irt_dev_process { |
| 106 int (*getpid)(pid_t *pid); |
| 107 int (*getppid)(pid_t *ppid); |
| 108 int (*setpgid)(pid_t pid, pid_t pgid); |
| 109 int (*getpgid)(pid_t pid, pid_t *pgid); |
| 110 int (*setsid)(pid_t *sid); |
| 111 int (*getsid)(pid_t pid, pid_t *sid); |
| 112 int (*kill)(pid_t pid, int sig); |
| 113 int (*posix_spawn)(pid_t *pid, const char *path, |
| 114 const posix_spawn_file_actions_t *file_actions, |
| 115 const posix_spawnattr_t *attrp, |
| 116 char *const argv[], char *const envp[]); |
| 117 int (*signal)(int sig, sighandler_t handler, sighandler_t *oldhandler); |
| 118 int (*sigprocmask)(int how, const sigset_t *set, sigset_t *oldset); |
| 119 int (*wait)(int *pid, int *status); |
| 120 int (*waitpid)(int *pid, int *status, int options); |
| 121 }; |
| 122 |
| 84 #if defined(__cplusplus) | 123 #if defined(__cplusplus) |
| 85 } | 124 } |
| 86 #endif | 125 #endif |
| 87 | 126 |
| 88 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H */ | 127 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H */ |
| OLD | NEW |