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

Side by Side Diff: src/base/platform/platform-freebsd.cc

Issue 556543004: Unbreak FreeBSD build (hopefully). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Platform-specific code for FreeBSD goes here. For the POSIX-compatible 5 // Platform-specific code for FreeBSD goes here. For the POSIX-compatible
6 // parts, the implementation is in platform-posix.cc. 6 // parts, the implementation is in platform-posix.cc.
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 #include <semaphore.h> 9 #include <semaphore.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { 124 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
125 std::vector<SharedLibraryAddress> result; 125 std::vector<SharedLibraryAddress> result;
126 static const int MAP_LENGTH = 1024; 126 static const int MAP_LENGTH = 1024;
127 int fd = open("/proc/self/maps", O_RDONLY); 127 int fd = open("/proc/self/maps", O_RDONLY);
128 if (fd < 0) return result; 128 if (fd < 0) return result;
129 while (true) { 129 while (true) {
130 char addr_buffer[11]; 130 char addr_buffer[11];
131 addr_buffer[0] = '0'; 131 addr_buffer[0] = '0';
132 addr_buffer[1] = 'x'; 132 addr_buffer[1] = 'x';
133 addr_buffer[10] = 0; 133 addr_buffer[10] = 0;
134 int result = read(fd, addr_buffer + 2, 8); 134 ssize_t bytes_read = read(fd, addr_buffer + 2, 8);
135 if (result < 8) break; 135 if (bytes_read < 8) break;
136 unsigned start = StringToLong(addr_buffer); 136 unsigned start = StringToLong(addr_buffer);
137 result = read(fd, addr_buffer + 2, 1); 137 bytes_read = read(fd, addr_buffer + 2, 1);
138 if (result < 1) break; 138 if (bytes_read < 1) break;
139 if (addr_buffer[2] != '-') break; 139 if (addr_buffer[2] != '-') break;
140 result = read(fd, addr_buffer + 2, 8); 140 bytes_read = read(fd, addr_buffer + 2, 8);
141 if (result < 8) break; 141 if (bytes_read < 8) break;
142 unsigned end = StringToLong(addr_buffer); 142 unsigned end = StringToLong(addr_buffer);
143 char buffer[MAP_LENGTH]; 143 char buffer[MAP_LENGTH];
144 int bytes_read = -1; 144 int bytes_read = -1;
145 do { 145 do {
146 bytes_read++; 146 bytes_read++;
147 if (bytes_read >= MAP_LENGTH - 1) 147 if (bytes_read >= MAP_LENGTH - 1)
148 break; 148 break;
149 result = read(fd, buffer + bytes_read, 1); 149 bytes_read = read(fd, buffer + bytes_read, 1);
150 if (result < 1) break; 150 if (bytes_read < 1) break;
151 } while (buffer[bytes_read] != '\n'); 151 } while (buffer[bytes_read] != '\n');
152 buffer[bytes_read] = 0; 152 buffer[bytes_read] = 0;
153 // Ignore mappings that are not executable. 153 // Ignore mappings that are not executable.
154 if (buffer[3] != 'x') continue; 154 if (buffer[3] != 'x') continue;
155 char* start_of_path = index(buffer, '/'); 155 char* start_of_path = index(buffer, '/');
156 // There may be no filename in this line. Skip to next. 156 // There may be no filename in this line. Skip to next.
157 if (start_of_path == NULL) continue; 157 if (start_of_path == NULL) continue;
158 buffer[bytes_read] = 0; 158 buffer[bytes_read] = 0;
159 result.push_back(SharedLibraryAddress(start_of_path, start, end)); 159 result.push_back(SharedLibraryAddress(start_of_path, start, end));
160 } 160 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return munmap(base, size) == 0; 298 return munmap(base, size) == 0;
299 } 299 }
300 300
301 301
302 bool VirtualMemory::HasLazyCommits() { 302 bool VirtualMemory::HasLazyCommits() {
303 // TODO(alph): implement for the platform. 303 // TODO(alph): implement for the platform.
304 return false; 304 return false;
305 } 305 }
306 306
307 } } // namespace v8::base 307 } } // namespace v8::base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698