| 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/platform.h" | 7 #include "bin/platform.h" |
| 8 #include "bin/process.h" | 8 #include "bin/process.h" |
| 9 #include "bin/socket.h" | 9 #include "bin/socket.h" |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 Dart_Handle process = Dart_GetNativeArgument(args, 0); | 236 Dart_Handle process = Dart_GetNativeArgument(args, 0); |
| 237 if (Dart_IsNull(process)) { | 237 if (Dart_IsNull(process)) { |
| 238 pid = Process::CurrentProcessId(); | 238 pid = Process::CurrentProcessId(); |
| 239 } else { | 239 } else { |
| 240 Process::GetProcessIdNativeField(process, &pid); | 240 Process::GetProcessIdNativeField(process, &pid); |
| 241 } | 241 } |
| 242 Dart_SetReturnValue(args, Dart_NewInteger(pid)); | 242 Dart_SetReturnValue(args, Dart_NewInteger(pid)); |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 void FUNCTION_NAME(Process_SetSignalHandler)(Dart_NativeArguments args) { | |
| 247 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); | |
| 248 intptr_t id = Process::SetSignalHandler(signal); | |
| 249 if (id == -1) { | |
| 250 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); | |
| 251 } else { | |
| 252 Dart_SetReturnValue(args, Dart_NewInteger(id)); | |
| 253 } | |
| 254 } | |
| 255 | |
| 256 | |
| 257 void FUNCTION_NAME(Process_ClearSignalHandler)(Dart_NativeArguments args) { | |
| 258 intptr_t signal = DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 0)); | |
| 259 Process::ClearSignalHandler(signal); | |
| 260 } | |
| 261 | |
| 262 | |
| 263 Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, | 246 Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process, |
| 264 intptr_t* pid) { | 247 intptr_t* pid) { |
| 265 return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); | 248 return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid); |
| 266 } | 249 } |
| 267 | 250 |
| 268 | 251 |
| 269 Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process, | 252 Dart_Handle Process::SetProcessIdNativeField(Dart_Handle process, |
| 270 intptr_t pid) { | 253 intptr_t pid) { |
| 271 return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid); | 254 return Dart_SetNativeInstanceField(process, kProcessIdNativeField, pid); |
| 272 } | 255 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 298 int external_length = strlen(system_string); | 281 int external_length = strlen(system_string); |
| 299 uint8_t* buffer = NULL; | 282 uint8_t* buffer = NULL; |
| 300 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); | 283 Dart_Handle external_array = IOBuffer::Allocate(external_length, &buffer); |
| 301 memmove(buffer, system_string, external_length); | 284 memmove(buffer, system_string, external_length); |
| 302 if (utf8 != system_string) free(const_cast<char*>(system_string)); | 285 if (utf8 != system_string) free(const_cast<char*>(system_string)); |
| 303 Dart_SetReturnValue(args, external_array); | 286 Dart_SetReturnValue(args, external_array); |
| 304 } | 287 } |
| 305 | 288 |
| 306 } // namespace bin | 289 } // namespace bin |
| 307 } // namespace dart | 290 } // namespace dart |
| OLD | NEW |