| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 19 matching lines...) Expand all Loading... |
| 30 // Mac OS, FreeBSD and OpenBSD. | 30 // Mac OS, FreeBSD and OpenBSD. |
| 31 | 31 |
| 32 #include <unistd.h> | 32 #include <unistd.h> |
| 33 #include <errno.h> | 33 #include <errno.h> |
| 34 #include <time.h> | 34 #include <time.h> |
| 35 | 35 |
| 36 #include <sys/socket.h> | 36 #include <sys/socket.h> |
| 37 #include <sys/resource.h> | 37 #include <sys/resource.h> |
| 38 #include <sys/time.h> | 38 #include <sys/time.h> |
| 39 #include <sys/types.h> | 39 #include <sys/types.h> |
| 40 #include <sys/stat.h> | |
| 41 | 40 |
| 42 #include <arpa/inet.h> | 41 #include <arpa/inet.h> |
| 43 #include <netinet/in.h> | 42 #include <netinet/in.h> |
| 44 #include <netdb.h> | 43 #include <netdb.h> |
| 45 | 44 |
| 46 #if defined(ANDROID) | 45 #if defined(ANDROID) |
| 47 #define LOG_TAG "v8" | 46 #define LOG_TAG "v8" |
| 48 #include <utils/Log.h> // LOG_PRI_VA | 47 #include <utils/Log.h> // LOG_PRI_VA |
| 49 #endif | 48 #endif |
| 50 | 49 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 int OS::GetLastError() { | 123 int OS::GetLastError() { |
| 125 return errno; | 124 return errno; |
| 126 } | 125 } |
| 127 | 126 |
| 128 | 127 |
| 129 // ---------------------------------------------------------------------------- | 128 // ---------------------------------------------------------------------------- |
| 130 // POSIX stdio support. | 129 // POSIX stdio support. |
| 131 // | 130 // |
| 132 | 131 |
| 133 FILE* OS::FOpen(const char* path, const char* mode) { | 132 FILE* OS::FOpen(const char* path, const char* mode) { |
| 134 struct stat file_stat; | 133 return fopen(path, mode); |
| 135 if (stat(path, &file_stat) == 0 && (file_stat.st_mode & S_IFREG)) | |
| 136 return fopen(path, mode); | |
| 137 return NULL; | |
| 138 } | 134 } |
| 139 | 135 |
| 140 | 136 |
| 141 bool OS::Remove(const char* path) { | 137 bool OS::Remove(const char* path) { |
| 142 return (remove(path) == 0); | 138 return (remove(path) == 0); |
| 143 } | 139 } |
| 144 | 140 |
| 145 | 141 |
| 146 const char* const OS::LogFileOpenMode = "w"; | 142 const char* const OS::LogFileOpenMode = "w"; |
| 147 | 143 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 return ntohl(value); | 427 return ntohl(value); |
| 432 } | 428 } |
| 433 | 429 |
| 434 | 430 |
| 435 Socket* OS::CreateSocket() { | 431 Socket* OS::CreateSocket() { |
| 436 return new POSIXSocket(); | 432 return new POSIXSocket(); |
| 437 } | 433 } |
| 438 | 434 |
| 439 | 435 |
| 440 } } // namespace v8::internal | 436 } } // namespace v8::internal |
| OLD | NEW |