| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 #include "bin/io_buffer.h" | 6 #include "bin/io_buffer.h" |
| 7 #include "bin/process.h" | 7 #include "bin/process.h" |
| 8 #include "bin/socket.h" | 8 #include "bin/socket.h" |
| 9 | 9 |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 if (Dart_IsError(error)) Dart_PropagateError(error); | 194 if (Dart_IsError(error)) Dart_PropagateError(error); |
| 195 Dart_ThrowException(error); | 195 Dart_ThrowException(error); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 | 199 |
| 200 void FUNCTION_NAME(Process_Kill)(Dart_NativeArguments args) { | 200 void FUNCTION_NAME(Process_Kill)(Dart_NativeArguments args) { |
| 201 Dart_Handle process = Dart_GetNativeArgument(args, 1); | 201 Dart_Handle process = Dart_GetNativeArgument(args, 1); |
| 202 intptr_t pid = -1; | 202 intptr_t pid = -1; |
| 203 Process::GetProcessIdNativeField(process, &pid); | 203 Process::GetProcessIdNativeField(process, &pid); |
| 204 int signal = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); | 204 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 2)); |
| 205 bool success = Process::Kill(pid, signal); | 205 bool success = Process::Kill(pid, signal); |
| 206 Dart_SetReturnValue(args, Dart_NewBoolean(success)); | 206 Dart_SetReturnValue(args, Dart_NewBoolean(success)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { | 210 void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { |
| 211 int64_t status = 0; | 211 int64_t status = 0; |
| 212 // Ignore result if passing invalid argument and just exit 0. | 212 // Ignore result if passing invalid argument and just exit 0. |
| 213 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); | 213 DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
| 214 exit(static_cast<int>(status)); | 214 exit(static_cast<int>(status)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 int external_length = strlen(system_string); | 282 int external_length = strlen(system_string); |
| 283 uint8_t* buffer = NULL; | 283 uint8_t* buffer = NULL; |
| 284 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 284 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 285 memmove(buffer, system_string, external_length); | 285 memmove(buffer, system_string, external_length); |
| 286 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 286 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 287 Dart_SetReturnValue(args, external_array); | 287 Dart_SetReturnValue(args, external_array); |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace bin | 290 } // namespace bin |
| 291 } // namespace dart | 291 } // namespace dart |
| OLD | NEW |