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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <android/log.h> // NOLINT | 10 #include <android/log.h> // NOLINT |
| 11 #include <endian.h> // NOLINT |
11 #include <errno.h> // NOLINT | 12 #include <errno.h> // NOLINT |
12 #include <limits.h> // NOLINT | 13 #include <limits.h> // NOLINT |
13 #include <malloc.h> // NOLINT | 14 #include <malloc.h> // NOLINT |
14 #include <time.h> // NOLINT | 15 #include <time.h> // NOLINT |
15 #include <sys/resource.h> // NOLINT | 16 #include <sys/resource.h> // NOLINT |
16 #include <sys/time.h> // NOLINT | 17 #include <sys/time.h> // NOLINT |
17 #include <sys/types.h> // NOLINT | 18 #include <sys/types.h> // NOLINT |
18 #include <unistd.h> // NOLINT | 19 #include <unistd.h> // NOLINT |
19 | 20 |
20 #include "platform/utils.h" | 21 #include "platform/utils.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void OS::DebugBreak() { | 317 void OS::DebugBreak() { |
317 UNIMPLEMENTED(); | 318 UNIMPLEMENTED(); |
318 } | 319 } |
319 | 320 |
320 | 321 |
321 char* OS::StrNDup(const char* s, intptr_t n) { | 322 char* OS::StrNDup(const char* s, intptr_t n) { |
322 return strndup(s, n); | 323 return strndup(s, n); |
323 } | 324 } |
324 | 325 |
325 | 326 |
| 327 uint16_t HostToBigEndian16(uint16_t value) { |
| 328 return htobe16(value); |
| 329 } |
| 330 |
| 331 |
| 332 uint32_t HostToBigEndian32(uint32_t value) { |
| 333 return htobe32(value); |
| 334 } |
| 335 |
| 336 |
| 337 uint64_t HostToBigEndian64(uint64_t value) { |
| 338 return htobe64(value); |
| 339 } |
| 340 |
| 341 |
| 342 uint16_t HostToLittleEndian16(uint16_t value) { |
| 343 return htole16(value); |
| 344 } |
| 345 |
| 346 |
| 347 uint32_t HostToLittleEndian32(uint32_t value) { |
| 348 return htole32(value); |
| 349 } |
| 350 |
| 351 |
| 352 uint64_t HostToLittleEndian64(uint64_t value) { |
| 353 return htole64(value); |
| 354 } |
| 355 |
| 356 |
326 void OS::Print(const char* format, ...) { | 357 void OS::Print(const char* format, ...) { |
327 va_list args; | 358 va_list args; |
328 va_start(args, format); | 359 va_start(args, format); |
329 VFPrint(stdout, format, args); | 360 VFPrint(stdout, format, args); |
330 // Forward to the Android log for remote access. | 361 // Forward to the Android log for remote access. |
331 __android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args); | 362 __android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args); |
332 va_end(args); | 363 va_end(args); |
333 } | 364 } |
334 | 365 |
335 | 366 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 452 } |
422 | 453 |
423 | 454 |
424 void OS::Exit(int code) { | 455 void OS::Exit(int code) { |
425 exit(code); | 456 exit(code); |
426 } | 457 } |
427 | 458 |
428 } // namespace dart | 459 } // namespace dart |
429 | 460 |
430 #endif // defined(TARGET_OS_ANDROID) | 461 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |