| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include <fcntl.h> | 5 #include <fcntl.h> |
| 6 #include <launchpad/launchpad.h> | 6 #include <launchpad/launchpad.h> |
| 7 #include <launchpad/vmo.h> | 7 #include <launchpad/vmo.h> |
| 8 #include <magenta/status.h> | 8 #include <magenta/status.h> |
| 9 #include <magenta/syscalls.h> | 9 #include <magenta/syscalls.h> |
| 10 #include <magenta/syscalls/object.h> | 10 #include <magenta/syscalls/object.h> |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // This is mostly taken from //magenta/system/uapp/mxsh with the addtion of | 146 // This is mostly taken from //magenta/system/uapp/mxsh with the addtion of |
| 147 // launchpad_add_pipe calls to setup pipes for stdout and stderr. | 147 // launchpad_add_pipe calls to setup pipes for stdout and stderr. |
| 148 static mx_status_t lp_setup(launchpad_t** lp_out, mx_handle_t binary_vmo, | 148 static mx_status_t lp_setup(launchpad_t** lp_out, mx_handle_t binary_vmo, |
| 149 int argc, const char* const* argv, | 149 int argc, const char* const* argv, |
| 150 int *stdout_out, int *stderr_out) { | 150 int *stdout_out, int *stderr_out) { |
| 151 if ((lp_out == NULL) || (stdout_out == NULL) || (stderr_out == NULL)) { | 151 if ((lp_out == NULL) || (stdout_out == NULL) || (stderr_out == NULL)) { |
| 152 return ERR_INVALID_ARGS; | 152 return ERR_INVALID_ARGS; |
| 153 } | 153 } |
| 154 launchpad_t* lp; | 154 launchpad_t* lp; |
| 155 mx_status_t status; | 155 mx_status_t status; |
| 156 status = launchpad_create(argv[0], &lp); | 156 status = launchpad_create(0, argv[0], &lp); |
| 157 RETURN_IF_ERROR(status); | 157 RETURN_IF_ERROR(status); |
| 158 status = launchpad_arguments(lp, argc, argv); | 158 status = launchpad_arguments(lp, argc, argv); |
| 159 RETURN_IF_ERROR(status); | 159 RETURN_IF_ERROR(status); |
| 160 status = launchpad_clone_mxio_root(lp); | 160 status = launchpad_clone_mxio_root(lp); |
| 161 RETURN_IF_ERROR(status); | 161 RETURN_IF_ERROR(status); |
| 162 status = launchpad_add_pipe(lp, stdout_out, 1); | 162 status = launchpad_add_pipe(lp, stdout_out, 1); |
| 163 RETURN_IF_ERROR(status); | 163 RETURN_IF_ERROR(status); |
| 164 status = launchpad_add_pipe(lp, stderr_out, 2); | 164 status = launchpad_add_pipe(lp, stderr_out, 2); |
| 165 RETURN_IF_ERROR(status); | 165 RETURN_IF_ERROR(status); |
| 166 status = launchpad_add_vdso_vmo(lp); | 166 status = launchpad_add_vdso_vmo(lp); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 RETURN_IF_ERROR(status); | 439 RETURN_IF_ERROR(status); |
| 440 | 440 |
| 441 // Complain if we didn't try to run all of the tests. | 441 // Complain if we didn't try to run all of the tests. |
| 442 if (test_list_index != lines_count) { | 442 if (test_list_index != lines_count) { |
| 443 fprintf(stderr, "Failed to attempt all the tests!\n"); | 443 fprintf(stderr, "Failed to attempt all the tests!\n"); |
| 444 fflush(0); | 444 fflush(0); |
| 445 return -1; | 445 return -1; |
| 446 } | 446 } |
| 447 return 0; | 447 return 0; |
| 448 } | 448 } |
| OLD | NEW |