| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifdef FLETCH_ENABLE_NATIVE_PROCESSES | 5 #ifdef DARTINO_ENABLE_NATIVE_PROCESSES |
| 6 | 6 |
| 7 #ifdef FLETCH_TARGET_OS_POSIX | 7 #ifdef DARTINO_TARGET_OS_POSIX |
| 8 | 8 |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| 11 #include <sys/wait.h> | 11 #include <sys/wait.h> |
| 12 #include <fcntl.h> | 12 #include <fcntl.h> |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 #include <unistd.h> | 14 #include <unistd.h> |
| 15 | 15 |
| 16 #include "src/shared/platform.h" | 16 #include "src/shared/platform.h" |
| 17 #include "src/vm/natives.h" | 17 #include "src/vm/natives.h" |
| 18 #include "src/vm/object.h" | 18 #include "src/vm/object.h" |
| 19 #include "src/vm/process.h" | 19 #include "src/vm/process.h" |
| 20 | 20 |
| 21 namespace fletch { | 21 namespace dartino { |
| 22 | 22 |
| 23 const int MAX_MESSAGE_LENGTH = 256; | 23 const int MAX_MESSAGE_LENGTH = 256; |
| 24 | 24 |
| 25 static int ClosePipes(int pipes[2]) { | 25 static int ClosePipes(int pipes[2]) { |
| 26 int err = TEMP_FAILURE_RETRY(close(pipes[0])); | 26 int err = TEMP_FAILURE_RETRY(close(pipes[0])); |
| 27 if (err < 0) { | 27 if (err < 0) { |
| 28 int tmp_errno = errno; | 28 int tmp_errno = errno; |
| 29 TEMP_FAILURE_RETRY(close(pipes[1])); | 29 TEMP_FAILURE_RETRY(close(pipes[1])); |
| 30 errno = tmp_errno; | 30 errno = tmp_errno; |
| 31 return err; | 31 return err; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // In child, fork again and call exec from grandchild, should not return; | 289 // In child, fork again and call exec from grandchild, should not return; |
| 290 RunDetached(path, args, pipes[1]); | 290 RunDetached(path, args, pipes[1]); |
| 291 | 291 |
| 292 // We cannot get to here since either we exited due to success or error or | 292 // We cannot get to here since either we exited due to success or error or |
| 293 // got overlayed by execv. | 293 // got overlayed by execv. |
| 294 UNREACHABLE(); | 294 UNREACHABLE(); |
| 295 exit(1); // silence compiler | 295 exit(1); // silence compiler |
| 296 } | 296 } |
| 297 END_NATIVE() | 297 END_NATIVE() |
| 298 | 298 |
| 299 } // namespace fletch | 299 } // namespace dartino |
| 300 | 300 |
| 301 #endif // FLETCH_TARGET_OS_POSIX | 301 #endif // DARTINO_TARGET_OS_POSIX |
| 302 | 302 |
| 303 #endif // FLETCH_ENABLE_NATIVE_PROCESSES | 303 #endif // DARTINO_ENABLE_NATIVE_PROCESSES |
| OLD | NEW |