| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 int OS::SNPrint(char* str, size_t size, const char* format, ...) { | 146 int OS::SNPrint(char* str, size_t size, const char* format, ...) { |
| 147 va_list args; | 147 va_list args; |
| 148 va_start(args, format); | 148 va_start(args, format); |
| 149 int retval = VSNPrint(str, size, format, args); | 149 int retval = VSNPrint(str, size, format, args); |
| 150 va_end(args); | 150 va_end(args); |
| 151 return retval; | 151 return retval; |
| 152 } | 152 } |
| 153 | 153 |
| 154 | 154 |
| 155 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { | 155 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { |
| 156 return vsnprintf(str, size, format, args); | 156 int retval = vsnprintf(str, size, format, args); |
| 157 if (retval < 0) { |
| 158 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format); |
| 159 } |
| 160 return retval; |
| 157 } | 161 } |
| 158 | 162 |
| 159 | 163 |
| 160 void OS::PrintErr(const char* format, ...) { | 164 void OS::PrintErr(const char* format, ...) { |
| 161 va_list args; | 165 va_list args; |
| 162 va_start(args, format); | 166 va_start(args, format); |
| 163 VFPrint(stderr, format, args); | 167 VFPrint(stderr, format, args); |
| 164 va_end(args); | 168 va_end(args); |
| 165 } | 169 } |
| 166 | 170 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 182 void OS::Abort() { | 186 void OS::Abort() { |
| 183 abort(); | 187 abort(); |
| 184 } | 188 } |
| 185 | 189 |
| 186 | 190 |
| 187 void OS::Exit(int code) { | 191 void OS::Exit(int code) { |
| 188 exit(code); | 192 exit(code); |
| 189 } | 193 } |
| 190 | 194 |
| 191 } // namespace dart | 195 } // namespace dart |
| OLD | NEW |