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/os.h" | 5 #include "vm/os.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <time.h> | 9 #include <time.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return sysconf(_SC_NPROCESSORS_ONLN); | 122 return sysconf(_SC_NPROCESSORS_ONLN); |
123 } | 123 } |
124 | 124 |
125 | 125 |
126 void OS::Sleep(int64_t millis) { | 126 void OS::Sleep(int64_t millis) { |
127 // TODO(5411554): For now just use usleep we may have to revisit this. | 127 // TODO(5411554): For now just use usleep we may have to revisit this. |
128 usleep(millis * 1000); | 128 usleep(millis * 1000); |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 void OS::DebugBreak() { | |
133 #if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32) | |
134 asm("int $3"); | |
135 #elif defined(HOST_ARCH_ARM) | |
136 asm("svc #0x9f0001"); // __ARM_NR_breakpoint | |
137 #else | |
138 #error Unsupported architecture. | |
139 #endif | |
140 } | |
141 | |
142 | |
143 void OS::Print(const char* format, ...) { | 132 void OS::Print(const char* format, ...) { |
144 va_list args; | 133 va_list args; |
145 va_start(args, format); | 134 va_start(args, format); |
146 VFPrint(stdout, format, args); | 135 VFPrint(stdout, format, args); |
147 va_end(args); | 136 va_end(args); |
148 } | 137 } |
149 | 138 |
150 | 139 |
151 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 140 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
152 vfprintf(stream, format, args); | 141 vfprintf(stream, format, args); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 void OS::Abort() { | 182 void OS::Abort() { |
194 abort(); | 183 abort(); |
195 } | 184 } |
196 | 185 |
197 | 186 |
198 void OS::Exit(int code) { | 187 void OS::Exit(int code) { |
199 exit(code); | 188 exit(code); |
200 } | 189 } |
201 | 190 |
202 } // namespace dart | 191 } // namespace dart |
OLD | NEW |