OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2014 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 | 6 |
7 #include <setjmp.h> | 7 #include <setjmp.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <sys/wait.h> | 9 #include <sys/wait.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 * Synchronously eval JavaScript. | 53 * Synchronously eval JavaScript. |
54 * | 54 * |
55 * Args: | 55 * Args: |
56 * cmd: Null terminated string containing code to eval. | 56 * cmd: Null terminated string containing code to eval. |
57 * data: Pointer to a char* to receive eval string result. | 57 * data: Pointer to a char* to receive eval string result. |
58 * len: Pointer to a size_t to receive the length of the result. | 58 * len: Pointer to a size_t to receive the length of the result. |
59 */ | 59 */ |
60 void jseval(const char* cmd, char** data, size_t* len); | 60 void jseval(const char* cmd, char** data, size_t* len); |
61 | 61 |
62 /* | 62 /* |
| 63 * Create a pipe that can communicate cross-process via JS. |
| 64 * |
| 65 * Args: |
| 66 * pipefd: Point to place to store a read [0] and write [1] fd. |
| 67 * Returns: |
| 68 * Zero on success. |
| 69 * TODO(bradnelson): The should work differently, see both: |
| 70 * https://bugs.chromium.org/p/webports/issues/detail?id=247 |
| 71 * https://bugs.chromium.org/p/webports/issues/detail?id=248 |
| 72 * Only declared when pipe is not defined as doing -Dpipe=nacl_spawn_pipe |
| 73 * is a common (though not universal) way to inject this. |
| 74 * In this case, system headers declaration of pipe don't always match |
| 75 * this definition of pipe. |
| 76 */ |
| 77 #if !defined(pipe) |
| 78 int nacl_spawn_pipe(int pipefd[2]); |
| 79 #endif |
| 80 |
| 81 /* |
| 82 * Create a pipe that can communicate cross-process via JS w/ flags. |
| 83 * |
| 84 * Args: |
| 85 * pipefd: Point to place to store a read [0] and write [1] fd. |
| 86 * flags: Flags to create the fd's with (for example O_NONBLOCK). |
| 87 * Returns: |
| 88 * Zero on success. |
| 89 * TODO(bradnelson): The should work differently, see both: |
| 90 * https://bugs.chromium.org/p/webports/issues/detail?id=247 |
| 91 * https://bugs.chromium.org/p/webports/issues/detail?id=248 |
| 92 */ |
| 93 int nacl_spawn_pipe2(int pipefd[2], int flags); |
| 94 |
| 95 /* |
63 * Implement vfork as a macro. | 96 * Implement vfork as a macro. |
64 * | 97 * |
65 * Returns: | 98 * Returns: |
66 * Pid of a child, or zero if in the child. | 99 * Pid of a child, or zero if in the child. |
67 * | 100 * |
68 * Done as a macro in order to allow portable implementation of | 101 * Done as a macro in order to allow portable implementation of |
69 * vfork's behavior, which requires multiple returns from the same | 102 * vfork's behavior, which requires multiple returns from the same |
70 * code location. | 103 * code location. |
71 * A before function is called to setup vfork state, | 104 * A before function is called to setup vfork state, |
72 * followed by setjmp passing its result to an after function. | 105 * followed by setjmp passing its result to an after function. |
(...skipping 26 matching lines...) Expand all Loading... |
99 * The newer version of glibc already declared execvpe | 132 * The newer version of glibc already declared execvpe |
100 */ | 133 */ |
101 #if !defined(__GLIBC__) || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9) | 134 #if !defined(__GLIBC__) || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 9) |
102 int execvpe(const char *file, char *const argv[], char *const envp[]); | 135 int execvpe(const char *file, char *const argv[], char *const envp[]); |
103 #endif | 136 #endif |
104 int execlpe(const char *path, const char *arg, ...); /* char* const envp[] */ | 137 int execlpe(const char *path, const char *arg, ...); /* char* const envp[] */ |
105 | 138 |
106 __END_DECLS | 139 __END_DECLS |
107 | 140 |
108 #endif /* NACL_SPAWN_SPAWN_H_ */ | 141 #endif /* NACL_SPAWN_SPAWN_H_ */ |
OLD | NEW |