OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) | 145 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) |
146 | 146 |
147 #undef MATH_FUNCTION | 147 #undef MATH_FUNCTION |
148 | 148 |
149 | 149 |
150 double OS::nan_value() { | 150 double OS::nan_value() { |
151 // NAN from math.h is defined in C99 and not in POSIX. | 151 // NAN from math.h is defined in C99 and not in POSIX. |
152 return NAN; | 152 return NAN; |
153 } | 153 } |
154 | 154 |
| 155 int OS::GetCurrentProcessId() { |
| 156 return static_cast<int>(getpid()); |
| 157 } |
155 | 158 |
156 // ---------------------------------------------------------------------------- | 159 // ---------------------------------------------------------------------------- |
157 // POSIX date/time support. | 160 // POSIX date/time support. |
158 // | 161 // |
159 | 162 |
160 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { | 163 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
161 struct rusage usage; | 164 struct rusage usage; |
162 | 165 |
163 if (getrusage(RUSAGE_SELF, &usage) < 0) return -1; | 166 if (getrusage(RUSAGE_SELF, &usage) < 0) return -1; |
164 *secs = usage.ru_utime.tv_sec; | 167 *secs = usage.ru_utime.tv_sec; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 return ntohl(value); | 539 return ntohl(value); |
537 } | 540 } |
538 | 541 |
539 | 542 |
540 Socket* OS::CreateSocket() { | 543 Socket* OS::CreateSocket() { |
541 return new POSIXSocket(); | 544 return new POSIXSocket(); |
542 } | 545 } |
543 | 546 |
544 | 547 |
545 } } // namespace v8::internal | 548 } } // namespace v8::internal |
OLD | NEW |