OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_BIN_PROCESS_H_ | 5 #ifndef RUNTIME_BIN_PROCESS_H_ |
6 #define RUNTIME_BIN_PROCESS_H_ | 6 #define RUNTIME_BIN_PROCESS_H_ |
7 | 7 |
8 #include <errno.h> | 8 #include <errno.h> |
9 | 9 |
10 #include "bin/builtin.h" | 10 #include "bin/builtin.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 intptr_t exit_code() { return exit_code_; } | 34 intptr_t exit_code() { return exit_code_; } |
35 | 35 |
36 private: | 36 private: |
37 Dart_Handle stdout_data_; | 37 Dart_Handle stdout_data_; |
38 Dart_Handle stderr_data_; | 38 Dart_Handle stderr_data_; |
39 intptr_t exit_code_; | 39 intptr_t exit_code_; |
40 | 40 |
41 DISALLOW_ALLOCATION(); | 41 DISALLOW_ALLOCATION(); |
42 }; | 42 }; |
43 | 43 |
44 | |
45 // To be kept in sync with ProcessSignal consts in sdk/lib/io/process.dart | 44 // To be kept in sync with ProcessSignal consts in sdk/lib/io/process.dart |
46 // Note that this map is as on Linux. | 45 // Note that this map is as on Linux. |
47 enum ProcessSignals { | 46 enum ProcessSignals { |
48 kSighup = 1, | 47 kSighup = 1, |
49 kSigint = 2, | 48 kSigint = 2, |
50 kSigquit = 3, | 49 kSigquit = 3, |
51 kSigill = 4, | 50 kSigill = 4, |
52 kSigtrap = 5, | 51 kSigtrap = 5, |
53 kSigabrt = 6, | 52 kSigabrt = 6, |
54 kSigbus = 7, | 53 kSigbus = 7, |
(...skipping 15 matching lines...) Expand all Loading... |
70 kSigxcpu = 24, | 69 kSigxcpu = 24, |
71 kSigxfsz = 25, | 70 kSigxfsz = 25, |
72 kSigvtalrm = 26, | 71 kSigvtalrm = 26, |
73 kSigprof = 27, | 72 kSigprof = 27, |
74 kSigwinch = 28, | 73 kSigwinch = 28, |
75 kSigpoll = 29, | 74 kSigpoll = 29, |
76 kSigsys = 31, | 75 kSigsys = 31, |
77 kLastSignal = kSigsys, | 76 kLastSignal = kSigsys, |
78 }; | 77 }; |
79 | 78 |
80 | |
81 // To be kept in sync with ProcessStartMode consts in sdk/lib/io/process.dart. | 79 // To be kept in sync with ProcessStartMode consts in sdk/lib/io/process.dart. |
82 enum ProcessStartMode { | 80 enum ProcessStartMode { |
83 kNormal = 0, | 81 kNormal = 0, |
84 kDetached = 1, | 82 kDetached = 1, |
85 kDetachedWithStdio = 2, | 83 kDetachedWithStdio = 2, |
86 }; | 84 }; |
87 | 85 |
88 | |
89 class Process { | 86 class Process { |
90 public: | 87 public: |
91 // Start a new process providing access to stdin, stdout, stderr and | 88 // Start a new process providing access to stdin, stdout, stderr and |
92 // process exit streams. | 89 // process exit streams. |
93 static int Start(const char* path, | 90 static int Start(const char* path, |
94 char* arguments[], | 91 char* arguments[], |
95 intptr_t arguments_length, | 92 intptr_t arguments_length, |
96 const char* working_directory, | 93 const char* working_directory, |
97 char* environment[], | 94 char* environment[], |
98 intptr_t environment_length, | 95 intptr_t environment_length, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 152 |
156 private: | 153 private: |
157 static int global_exit_code_; | 154 static int global_exit_code_; |
158 static Mutex* global_exit_code_mutex_; | 155 static Mutex* global_exit_code_mutex_; |
159 static ExitHook exit_hook_; | 156 static ExitHook exit_hook_; |
160 | 157 |
161 DISALLOW_ALLOCATION(); | 158 DISALLOW_ALLOCATION(); |
162 DISALLOW_IMPLICIT_CONSTRUCTORS(Process); | 159 DISALLOW_IMPLICIT_CONSTRUCTORS(Process); |
163 }; | 160 }; |
164 | 161 |
165 | |
166 class SignalInfo { | 162 class SignalInfo { |
167 public: | 163 public: |
168 SignalInfo(intptr_t fd, intptr_t signal, SignalInfo* next) | 164 SignalInfo(intptr_t fd, intptr_t signal, SignalInfo* next) |
169 : fd_(fd), | 165 : fd_(fd), |
170 signal_(signal), | 166 signal_(signal), |
171 // SignalInfo is expected to be created when in a isolate. | 167 // SignalInfo is expected to be created when in a isolate. |
172 port_(Dart_GetMainPortId()), | 168 port_(Dart_GetMainPortId()), |
173 next_(next), | 169 next_(next), |
174 prev_(NULL) { | 170 prev_(NULL) { |
175 if (next_ != NULL) { | 171 if (next_ != NULL) { |
(...skipping 21 matching lines...) Expand all Loading... |
197 intptr_t fd_; | 193 intptr_t fd_; |
198 intptr_t signal_; | 194 intptr_t signal_; |
199 // The port_ is used to identify what isolate the signal-info belongs to. | 195 // The port_ is used to identify what isolate the signal-info belongs to. |
200 Dart_Port port_; | 196 Dart_Port port_; |
201 SignalInfo* next_; | 197 SignalInfo* next_; |
202 SignalInfo* prev_; | 198 SignalInfo* prev_; |
203 | 199 |
204 DISALLOW_COPY_AND_ASSIGN(SignalInfo); | 200 DISALLOW_COPY_AND_ASSIGN(SignalInfo); |
205 }; | 201 }; |
206 | 202 |
207 | |
208 // Utility class for collecting the output when running a process | 203 // Utility class for collecting the output when running a process |
209 // synchronously by using Process::Wait. This class is sub-classed in | 204 // synchronously by using Process::Wait. This class is sub-classed in |
210 // the platform specific files to implement reading into the buffers | 205 // the platform specific files to implement reading into the buffers |
211 // allocated. | 206 // allocated. |
212 class BufferListBase { | 207 class BufferListBase { |
213 protected: | 208 protected: |
214 static const intptr_t kBufferSize = 16 * 1024; | 209 static const intptr_t kBufferSize = 16 * 1024; |
215 | 210 |
216 class BufferListNode { | 211 class BufferListNode { |
217 public: | 212 public: |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 363 |
369 private: | 364 private: |
370 DISALLOW_COPY_AND_ASSIGN(BufferList); | 365 DISALLOW_COPY_AND_ASSIGN(BufferList); |
371 }; | 366 }; |
372 #endif // defined(HOST_OS_ANDROID) ... | 367 #endif // defined(HOST_OS_ANDROID) ... |
373 | 368 |
374 } // namespace bin | 369 } // namespace bin |
375 } // namespace dart | 370 } // namespace dart |
376 | 371 |
377 #endif // RUNTIME_BIN_PROCESS_H_ | 372 #endif // RUNTIME_BIN_PROCESS_H_ |
OLD | NEW |