Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/platform-posix.cc

Issue 7353017: 2011-07-13: Version 3.4.12 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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>
40 41
41 #include <arpa/inet.h> 42 #include <arpa/inet.h>
42 #include <netinet/in.h> 43 #include <netinet/in.h>
43 #include <netdb.h> 44 #include <netdb.h>
44 45
45 #if defined(ANDROID) 46 #if defined(ANDROID)
46 #define LOG_TAG "v8" 47 #define LOG_TAG "v8"
47 #include <utils/Log.h> // LOG_PRI_VA 48 #include <utils/Log.h> // LOG_PRI_VA
48 #endif 49 #endif
49 50
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 int OS::GetLastError() { 124 int OS::GetLastError() {
124 return errno; 125 return errno;
125 } 126 }
126 127
127 128
128 // ---------------------------------------------------------------------------- 129 // ----------------------------------------------------------------------------
129 // POSIX stdio support. 130 // POSIX stdio support.
130 // 131 //
131 132
132 FILE* OS::FOpen(const char* path, const char* mode) { 133 FILE* OS::FOpen(const char* path, const char* mode) {
133 return fopen(path, mode); 134 FILE* file = fopen(path, mode);
135 if (file == NULL) return NULL;
136 struct stat file_stat;
137 if (fstat(fileno(file), &file_stat) != 0) return NULL;
138 bool is_regular_file = ((file_stat.st_mode & S_IFREG) != 0);
139 if (is_regular_file) return file;
140 fclose(file);
141 return NULL;
134 } 142 }
135 143
136 144
137 bool OS::Remove(const char* path) { 145 bool OS::Remove(const char* path) {
138 return (remove(path) == 0); 146 return (remove(path) == 0);
139 } 147 }
140 148
141 149
150 FILE* OS::OpenTemporaryFile() {
151 return tmpfile();
152 }
153
154
142 const char* const OS::LogFileOpenMode = "w"; 155 const char* const OS::LogFileOpenMode = "w";
143 156
144 157
145 void OS::Print(const char* format, ...) { 158 void OS::Print(const char* format, ...) {
146 va_list args; 159 va_list args;
147 va_start(args, format); 160 va_start(args, format);
148 VPrint(format, args); 161 VPrint(format, args);
149 va_end(args); 162 va_end(args);
150 } 163 }
151 164
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return ntohl(value); 440 return ntohl(value);
428 } 441 }
429 442
430 443
431 Socket* OS::CreateSocket() { 444 Socket* OS::CreateSocket() {
432 return new POSIXSocket(); 445 return new POSIXSocket();
433 } 446 }
434 447
435 448
436 } } // namespace v8::internal 449 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698