Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: src/trusted/platform/nacl_process.h

Issue 10832400: Process abstraction layer for NaCl Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 /*
8 * NaCl Service Runtime process abstraction layer.
9 */
10
11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_PROCESS_H_
12 #define NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_PROCESS_H_
13
14 #include "native_client/src/include/nacl_base.h"
15 #include "native_client/src/include/nacl_compiler_annotations.h"
16 #include "native_client/src/include/portability.h"
17
18 EXTERN_C_BEGIN
19
20 #if NACL_LINUX || NACL_OSX || defined(__native_client__)
21 # include "native_client/src/trusted/platform/posix/nacl_process_types.h"
22 #elif NACL_WINDOWS
23 # include "native_client/src/trusted/platform/win/nacl_process_types.h"
24 #else
25 # error Unsupported platform
26 #endif
27
28 EXTERN_C_BEGIN
29
30 /*
31 * Portable process creation and management interface.
32 */
33
34 /*
35 * Flags available for NaClProcessLaunch.
36 */
37 #define NACL_PROCESS_LAUNCH_NEW_GROUP 0x1 /* new process group */
38 #define NACL_PROCESS_LAUNCH_CLOSE_FDS 0x2 /* close all open fds */
39
40 /*
41 * Launch a process via the command line |cmd|.
42 *
43 * Upon success, if |npp| handle is non-NULL, it will be filled in with the
44 * handle of the launched process.
45 *
46 * Returns 1 upon success.
47 */
48 #if NACL_WINDOWS
49 int NaClProcessLaunch(struct NaClProcess *npp,
50 char *cmd,
51 char *env,
52 int flags);
53 #else
54 int NaClProcessLaunch(struct NaClProcess *npp,
55 char *const *argv,
56 char *const *envp,
57 int flags);
58 #endif
59
60 /*
61 * Attempts to kill the process identified by the process handle |npp,
62 * giving it the specified exit code. If |wait| is true, wait for the
63 * process to be actually terminated before returning.
64 *
65 * Returns 1 on success, 0 otherwise.
66 */
67 int NaClProcessKill(struct NaClProcess *npp, int exit_code, int wait);
68
69 /*
70 * Return status values from NaClGetStatus.
71 */
72 #define NACL_PROCESS_STATUS_NORMAL_EXIT 0 /* zero exit status */
73 #define NACL_PROCESS_STATUS_ABNORMAL_EXIT 1 /* non-zero exit status */
74 #define NACL_PROCESS_STATUS_KILLED 2 /* SIGKILL or task manager */
75 #define NACL_PROCESS_STATUS_CRASHED 3 /* e.g. segmentation fault */
76 #define NACL_PROCESS_STATUS_STILL_RUNNING 4 /* child hasn't exited yet */
77
78 /*
79 * Get the status of process identified by the process handle |npp|.
80 *
81 * Note: on Linux, this function will only return a useful result the
82 * first time it is called after the child exists (because it reaps the
83 * child and the information will no longer be available).
84 *
85 * Returns 1 on success, 0 otherwise.
86 */
87 int NaClProcessGetStatus(struct NaClProcess *npp,
88 int *status);
89
90 /*
91 * Waits for process to exit. On POSIX systems, if the process hasn't been
92 * signaled then puts the exit code in |exit_code|; otherwise it's considered
93 * a failure. On Windows |exit_code| is always filled.
94 *
95 * Returns 1 on success, 0 otherwise.
96 */
97 int NaClProcessWaitForExitCode(struct NaClProcess *npp,
98 int *exit_code);
99
100 EXTERN_C_END
101
102 #endif /* NATIVE_CLIENT_SRC_TRUSTED_PLATFORM_NACL_PROCESS_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698