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 #ifndef RUNTIME_PLATFORM_UTILS_LINUX_H_ | 5 #ifndef RUNTIME_PLATFORM_UTILS_LINUX_H_ |
6 #define RUNTIME_PLATFORM_UTILS_LINUX_H_ | 6 #define RUNTIME_PLATFORM_UTILS_LINUX_H_ |
7 | 7 |
8 #include <endian.h> // NOLINT | 8 #include <endian.h> // NOLINT |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return htole32(value); | 55 return htole32(value); |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { | 59 inline uint64_t Utils::HostToLittleEndian64(uint64_t value) { |
60 return htole64(value); | 60 return htole64(value); |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { | 64 inline char* Utils::StrError(int err, char* buffer, size_t bufsize) { |
65 #if !defined(__GLIBC__) || \ | 65 #if !defined(__GLIBC__) || \ |
66 ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) | 66 ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) |
67 // Use the XSI version. | 67 // Use the XSI version. |
68 if (strerror_r(err, buffer, bufsize) != 0) { | 68 if (strerror_r(err, buffer, bufsize) != 0) { |
69 snprintf(buffer, bufsize, "%s", "strerror_r failed"); | 69 snprintf(buffer, bufsize, "%s", "strerror_r failed"); |
70 } | 70 } |
71 return buffer; | 71 return buffer; |
72 #else | 72 #else |
73 // Use the GNU specific version. | 73 // Use the GNU specific version. |
74 return strerror_r(err, buffer, bufsize); | 74 return strerror_r(err, buffer, bufsize); |
75 #endif | 75 #endif |
76 } | 76 } |
77 | 77 |
78 } // namespace dart | 78 } // namespace dart |
79 | 79 |
80 #endif // RUNTIME_PLATFORM_UTILS_LINUX_H_ | 80 #endif // RUNTIME_PLATFORM_UTILS_LINUX_H_ |
OLD | NEW |