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

Side by Side Diff: base/linux_util.cc

Issue 89523002: Move Posix file utils to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « base/files/file_path_watcher_linux.cc ('k') | base/process/process_handle_linux.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "base/linux_util.h" 5 #include "base/linux_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 scoped_ptr<char[]> syscall_data(new char[expected_data.length()]); 280 scoped_ptr<char[]> syscall_data(new char[expected_data.length()]);
281 for (std::vector<pid_t>::const_iterator 281 for (std::vector<pid_t>::const_iterator
282 i = tids.begin(); i != tids.end(); ++i) { 282 i = tids.begin(); i != tids.end(); ++i) {
283 const pid_t current_tid = *i; 283 const pid_t current_tid = *i;
284 snprintf(buf, sizeof(buf), "/proc/%d/task/%d/syscall", pid, current_tid); 284 snprintf(buf, sizeof(buf), "/proc/%d/task/%d/syscall", pid, current_tid);
285 int fd = open(buf, O_RDONLY); 285 int fd = open(buf, O_RDONLY);
286 if (fd < 0) 286 if (fd < 0)
287 continue; 287 continue;
288 if (syscall_supported != NULL) 288 if (syscall_supported != NULL)
289 *syscall_supported = true; 289 *syscall_supported = true;
290 bool read_ret = 290 bool read_ret = ReadFromFD(fd, syscall_data.get(), expected_data.length());
291 file_util::ReadFromFD(fd, syscall_data.get(), expected_data.length());
292 close(fd); 291 close(fd);
293 if (!read_ret) 292 if (!read_ret)
294 continue; 293 continue;
295 294
296 if (0 == strncmp(expected_data.c_str(), syscall_data.get(), 295 if (0 == strncmp(expected_data.c_str(), syscall_data.get(),
297 expected_data.length())) { 296 expected_data.length())) {
298 return current_tid; 297 return current_tid;
299 } 298 }
300 } 299 }
301 return -1; 300 return -1;
302 } 301 }
303 302
304 } // namespace base 303 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/process/process_handle_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698